-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathmain.py
More file actions
36 lines (30 loc) · 1.03 KB
/
Copy pathmain.py
File metadata and controls
36 lines (30 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import sys
import traceback
import tkinter as tk
from tkinter import messagebox
from utils.sys_helper import run_as_admin, setup_dpi_awareness
from utils.data_manager import DataManager
from device.controller import DeviceController
from core.analyzer import VisionAnalyzer
from gui.app import MatrixAssistantApp
def handle_exception(exc_type, exc_value, exc_traceback):
"""全局异常捕获处理器"""
error_msg = "".join(traceback.format_exception(exc_type, exc_value, exc_traceback))
messagebox.showerror("运行错误", error_msg)
def main():
"""主程序入口配置及启动逻辑"""
setup_dpi_awareness()
if not run_as_admin():
return
# 注册全局异常处理器
sys.excepthook = handle_exception
root = tk.Tk()
# 注入依赖与实例化核心模块
dm = DataManager()
controller = DeviceController()
analyzer = VisionAnalyzer(dm)
# 加载主应用界面
app = MatrixAssistantApp(root, dm, controller, analyzer)
root.mainloop()
if __name__ == "__main__":
main()