onekeydiag/src/main.py
2025-08-25 14:44:51 +08:00

32 lines
1008 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import os
import sys
import service
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QIcon
from main_window import MainWindow # 导入重构后的主窗口类
if __name__ == "__main__":
# Windows系统特定设置确保任务栏图标正确显示
try:
from ctypes import windll
myappid = 'marcin.ZiJin.onekeydiag.1.0' # 自定义唯一ID
windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
except ImportError:
pass # 非Windows系统忽略
# 初始化服务缓存
# service.app_cache_init()
# 创建PyQt应用实例
app = QApplication(sys.argv)
# 获取文件系统中存放的icon
icon_path = service.get_icon_path()
if os.path.exists(icon_path):
app.setWindowIcon(QIcon(icon_path))
else:
print("not found favicon")
# 初始化并显示主窗口
window = MainWindow()
window.show()
# 进入应用主循环
sys.exit(app.exec_())