feat(DLPilot): v0.4.0 — PySide6-Fluent-Widgets UI and Light theme

This commit is contained in:
2026-09-24 19:09:24 +08:00
parent cf61916a9a
commit 74b64dcfd5
9 changed files with 969 additions and 74 deletions
+16 -7
View File
@@ -3,8 +3,8 @@
"""
把 hdmi_gui.py 打包成单文件 exe(工具名: DLPilot)
================================
使用 PyInstaller --onefile --noconsole: Python 解释器 + 标准库 + tkinter
全部打进一个 exe, 目标机器无需安装任何依赖。
使用 PyInstaller --onefile --noconsole: Python 解释器、PySide6 和
PySide6-Fluent-Widgets 全部打进一个 exe, 目标机器无需安装依赖。
用法:
python build_exe.py 自动安装 PyInstaller(如缺)并打包
@@ -35,13 +35,22 @@ def ensure_pyinstaller():
def extra_collect_args():
"""CustomTkinter 的主题/字体等数据文件必须显式收集, 否则打包后 GUI 启动报错"""
"""Fluent Widgets 的主题资源必须收集; PyInstaller 自带 Qt hooks 会处理 PySide6。"""
try:
import customtkinter # noqa: F401
return ['--collect-all', 'customtkinter']
import qfluentwidgets # noqa: F401
except ImportError:
print('警告: 未安装 customtkinter, 打包产物将无法启动 GUI!')
print('警告: 未安装 PySide6-Fluent-Widgets, 请先执行 pip install PySide6-Fluent-Widgets')
return []
return ['--collect-all', 'qfluentwidgets']
def qt_icu_args():
"""Qt6Core imports the unversioned Windows ICU API. PyInstaller can
otherwise pick Poppler's ICU 78 from PATH, whose suffixed exports make
QtCore.pyd fail with WinError 127 on startup."""
if os.name == 'nt' and os.path.exists(r'C:\Windows\System32\icuuc.dll'):
return ['--add-binary', r'C:\Windows\System32\icuuc.dll;.']
return []
def remove_stale(exe_path):
@@ -68,7 +77,7 @@ def build(name, extra_args):
cmd = [sys.executable, '-m', 'PyInstaller',
'--onefile', '--clean', '--name', name,
'--distpath', dist, '--workpath', work, '--specpath', work,
] + extra_args + extra_collect_args() + [os.path.join(SRC, 'hdmi_gui.py')]
] + extra_args + extra_collect_args() + qt_icu_args() + [os.path.join(SRC, 'hdmi_gui.py')]
if os.path.exists(ICO):
# exe 文件图标 + 运行时窗口图标资源(从 _MEIPASS 读取)
cmd += ['--icon', ICO, '--add-data', f'{ICO};.']