添加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

View File

@@ -1,3 +1,5 @@
import os
import sys
from enum import Enum
from qfluentwidgets import getIconColor, Theme, FluentIconBase
@@ -8,4 +10,12 @@ class MyFluentIcon(FluentIconBase, Enum):
def path(self, theme=Theme.AUTO):
# getIconColor() return "white" or "black" according to current theme
return f'./ui/icon/{self.value}_{getIconColor(theme)}.svg'
# 支持打包环境和开发环境
if getattr(sys, 'frozen', False):
# 打包环境:使用 sys._MEIPASS 作为基础路径
base_path = sys._MEIPASS
else:
# 开发环境:使用相对路径
base_path = os.path.join(os.path.dirname(__file__), '..')
return os.path.join(base_path, 'ui', 'icon', f'{self.value}_{getIconColor(theme)}.svg')