添加PyInstaller macOS打包支持:资源路径处理、multiprocessing兼容、配置文件外置
Some checks failed
Docker Build and Push / check-secrets (push) Successful in 2s
Docker Build and Push / build-and-push (cpu, latest) (push) Has been skipped
Docker Build and Push / build-and-push (cuda, 11.8) (push) Has been skipped
Docker Build and Push / build-and-push (cuda, 12.6) (push) Has been skipped
Docker Build and Push / build-and-push (cuda, 12.8) (push) Has been skipped
Docker Build and Push / build-and-push (directml, latest) (push) Has been skipped
Build Windows CPU / build (push) Has been cancelled
Build Windows CUDA 11.8 / build (push) Has been cancelled
Build Windows CUDA 12.6 / build (push) Has been cancelled
Build Windows CUDA 12.8 / build (push) Has been cancelled
Build Windows DirectML / build (push) Has been cancelled

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
flavioy
2026-04-09 22:08:37 +08:00
parent 2d1d3fe37b
commit ec94f2e04b
3 changed files with 19 additions and 2 deletions

11
gui.py
View File

@@ -8,6 +8,14 @@
import sys
import os
# PyInstaller 打包后资源路径处理
def resource_path(relative_path):
"""获取资源文件的绝对路径(兼容 PyInstaller 打包)"""
if getattr(sys, 'frozen', False):
return os.path.join(sys._MEIPASS, relative_path)
return os.path.join(os.path.abspath(os.path.dirname(__file__)), relative_path)
import configparser
import cv2
import multiprocessing
@@ -42,7 +50,7 @@ class SubtitleExtractorGUI(FluentWindow):
# self.themeListener.start()
# 设置窗口图标
self.setWindowIcon(QtGui.QIcon("design/vsr.ico"))
self.setWindowIcon(QtGui.QIcon(resource_path("design/vsr.ico")))
self.setWindowTitle(tr['SubtitleExtractorGUI']['Title'] + " v" + VERSION)
# 创建界面布局
self._create_layout()
@@ -162,6 +170,7 @@ class SubtitleExtractorGUI(FluentWindow):
if __name__ == '__main__':
multiprocessing.freeze_support()
multiprocessing.set_start_method("spawn")
QApplication.setHighDpiScaleFactorRoundingPolicy(
Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)