添加PyInstaller打包支持和运行时路径修复

- 创建PyInstaller规范文件和打包脚本
- 修复开发/打包环境路径兼容性问题
- 添加PaddleOCR运行时依赖(opencv-contrib-python, pypdfium2, pyclipper)
- 支持打包后的多进程启动
- 修复图标路径和翻译文件路径
- 清理重复的模型和FFmpeg文件
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
yaofanguk
2026-04-10 19:23:05 +08:00
parent 293cd9bbee
commit c80e7fabc9
18 changed files with 423 additions and 33 deletions

12
gui.py
View File

@@ -41,8 +41,14 @@ class SubtitleExtractorGUI(FluentWindow):
# self.themeListener = SystemThemeListener(self)
# self.themeListener.start()
# 设置窗口图标
self.setWindowIcon(QtGui.QIcon("design/vsr.ico"))
# 设置窗口图标(支持打包环境)
if getattr(sys, 'frozen', False):
# 打包后的环境
icon_path = os.path.join(sys._MEIPASS, 'design', 'vsr.ico')
else:
# 开发环境
icon_path = "design/vsr.ico"
self.setWindowIcon(QtGui.QIcon(icon_path))
self.setWindowTitle(tr['SubtitleExtractorGUI']['Title'] + " v" + VERSION)
# 创建界面布局
self._create_layout()
@@ -162,6 +168,8 @@ class SubtitleExtractorGUI(FluentWindow):
if __name__ == '__main__':
# 支持打包后的多进程
multiprocessing.freeze_support()
multiprocessing.set_start_method("spawn")
QApplication.setHighDpiScaleFactorRoundingPolicy(
Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)