Commit 7858fbdc authored by smile2019's avatar smile2019

启动前检查依赖是否安装

parent 6119b401
{"video_path": null, "excel_path": null, "detection_info": {"detected": false, "nd_process": 0.0, "last_time": 0.0, "caption_boundings": [], "has_subtitle": true}, "speaker_info": {"speaker_id": "\u6653\u6653\uff0c\u5973\uff0c\u5e74\u8f7b\u4eba", "speaker_speed": "1.10(4.5\u5b57/\u79d2)"}}
\ No newline at end of file
{"video_path": "C:/Users/Smile/Desktop/1203901881-1-192.mp4", "excel_path": "C:/Users/Smile/Desktop/accessibility-movie/accessibility_movie_2/product_test/test1\\1203901881-1-192.xlsx", "detection_info": {"detected": true, "nd_process": 1, "last_time": 849.933, "caption_boundings": [631, 673], "has_subtitle": true}, "speaker_info": {"speaker_id": "\u6653\u6653\uff0c\u5973\uff0c\u5e74\u8f7b\u4eba", "speaker_speed": "1.10(4.5\u5b57/\u79d2)"}}
\ No newline at end of file
This diff is collapsed.
import sys
import winreg
def is_lav_filters_installed():
"""检查deploy中的install_audio.bat;install_splitter.bat;install_video.bat是否成功安装到注册表
Returns:
_type_: _description_
"""
try:
# 检查注册表LAVSplitter.ax
with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Classes\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{171252A0-8820-4AFE-9DF8-5C92B2D66B04}", 0, winreg.KEY_READ) as key:
pass
# 检查注册表LAVVideo.ax
with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Classes\CLSID\{278407C2-558C-4BED-83A0-B6FA454200BD}", 0, winreg.KEY_READ) as key:
pass
# 检查注册表LAVAudio.ax
with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Classes\CLSID\{20ED4A03-6AFD-4FD9-980B-2F6143AA0892}", 0, winreg.KEY_READ) as key:
pass
return True
except FileNotFoundError:
return False
if __name__ == '__main__':
if is_lav_filters_installed():
print("LAV Filters is installed.")
else:
print("LAV Filters is not installed.")
\ No newline at end of file
......@@ -4,14 +4,33 @@ import traceback
from PyQt5.QtCore import *;
from PyQt5.QtGui import *;
from PyQt5.QtWidgets import *;
from PyQt5 import QtWidgets
from main_window import MainWindow
from qt_material import apply_stylesheet
from prompt_dialog import Prompt_Dialog
import os
import subprocess
import winreg
os.environ['PYQTGRAPH_QT_LIB'] = 'PyQt5'
project_path = None
# 检查
def is_lav_filters_installed():
try:
# 检查注册表LAVSplitter.ax
with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Classes\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{171252A0-8820-4AFE-9DF8-5C92B2D66B04}", 0, winreg.KEY_READ) as key:
pass
# 检查注册表LAVVideo.ax
with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Classes\CLSID\{278407C2-558C-4BED-83A0-B6FA454200BD}", 0, winreg.KEY_READ) as key:
pass
# 检查注册表LAVAudio.ax
with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Classes\CLSID\{20ED4A03-6AFD-4FD9-980B-2F6143AA0892}", 0, winreg.KEY_READ) as key:
pass
return True
except FileNotFoundError:
return False
def change_project_path(path):
"""用于切换当前工程路径
......@@ -24,24 +43,33 @@ def change_project_path(path):
if __name__ == '__main__':
try:
subprocess.call(['deploy.bat'])
QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
QCoreApplication.setAttribute(Qt.AA_UseHighDpiPixmaps)
currentExitCode = MainWindow.EXIT_CODE_REBOOT
while currentExitCode == MainWindow.EXIT_CODE_REBOOT:
if is_lav_filters_installed() == True:
QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
QCoreApplication.setAttribute(Qt.AA_UseHighDpiPixmaps)
app = QApplication(sys.argv)
app.setWindowIcon(QIcon("./res/images/eagle_2.ico"))
mainWindow = MainWindow(project_path)
if project_path == None or project_path == "":
mainWindow.setWindowTitle(f"无障碍电影制作软件(请打开或新建工程)")
else:
project_name = os.path.basename(project_path)
mainWindow.setWindowTitle(f"无障碍电影制作软件(当前工程为:{project_name})")
mainWindow.renew_signal.connect(change_project_path)
apply_stylesheet(app, theme='dark_amber.xml')
mainWindow.show()
currentExitCode = app.exec_()
app = None
mainWindow = MainWindow(project_path)
QtWidgets.QMessageBox.critical(mainWindow,'警告','缺失相关依赖',QtWidgets.QMessageBox.Yes)
else:
QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
QCoreApplication.setAttribute(Qt.AA_UseHighDpiPixmaps)
currentExitCode = MainWindow.EXIT_CODE_REBOOT
while currentExitCode == MainWindow.EXIT_CODE_REBOOT:
app = QApplication(sys.argv)
app.setWindowIcon(QIcon("./res/images/eagle_2.ico"))
mainWindow = MainWindow(project_path)
if project_path == None or project_path == "":
mainWindow.setWindowTitle(f"无障碍电影制作软件(请打开或新建工程)")
else:
project_name = os.path.basename(project_path)
mainWindow.setWindowTitle(f"无障碍电影制作软件(当前工程为:{project_name})")
mainWindow.renew_signal.connect(change_project_path)
apply_stylesheet(app, theme='dark_amber.xml')
mainWindow.show()
currentExitCode = app.exec_()
app = None
except Exception as e:
exc_traceback = ''.join(
traceback.format_exception(*sys.exc_info()))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment