-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
39 lines (30 loc) · 973 Bytes
/
main.py
File metadata and controls
39 lines (30 loc) · 973 Bytes
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
37
38
39
"""Entry point for the WL-EMG monitor application."""
from __future__ import annotations
import asyncio
import os
import sys
import platform
# macOS Metal 優化:設定 Qt 使用 Metal 渲染後端
if platform.system() == 'Darwin': # macOS
os.environ['QSG_RHI_BACKEND'] = 'metal'
os.environ['QT_MAC_WANTS_LAYER'] = '1' # 啟用 Core Animation layer
print("🍎 macOS 檢測到:使用 Metal 渲染後端")
from PyQt6 import QtWidgets
import pyqtgraph as pg
import qasync
from emg_monitor.ui.main_window import MainWindow
def run() -> None:
"""Launch the Qt application."""
# 不要在這裡設定 antialias,已在 main_window.py 設定
app = QtWidgets.QApplication(sys.argv)
loop = qasync.QEventLoop(app)
asyncio.set_event_loop(loop)
window = MainWindow()
window.show()
with loop:
try:
loop.run_forever()
except KeyboardInterrupt:
pass
if __name__ == "__main__":
run()