Skip to content

Commit d81a773

Browse files
committed
fix: 图标相关显示异常
1 parent 12b6523 commit d81a773

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

aao/app.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ def __init__(
102102
super().__init__()
103103
self.setWindowTitle("ArknightsAutoOperator")
104104
self.resize(960, 620)
105+
# 窗口图标(左上角 + Windows 任务栏)
106+
from PySide6.QtGui import QIcon
107+
108+
from aao.utils.runtime_paths import project_root
109+
110+
icon_path = project_root() / "logo.png"
111+
if icon_path.exists():
112+
self.setWindowIcon(QIcon(str(icon_path)))
105113

106114
self._controller = controller
107115
self._tasker = tasker
@@ -519,6 +527,17 @@ def _ensure_admin() -> None:
519527

520528
def main() -> int:
521529
_ensure_admin()
530+
531+
# Windows 任务栏分组:设 AppUserModelID,否则用 Python/PyInstaller 默认图标
532+
if sys.platform == "win32":
533+
import ctypes
534+
535+
try:
536+
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(
537+
"Windsland52.ArknightsAutoOperator"
538+
) # pyright: ignore[reportAttributeAccessIssue]
539+
except (AttributeError, OSError):
540+
pass
522541
# 先 configure_paths 让 settings_page 能读到 config/settings.json
523542
configure_paths()
524543
# 确保 AFA 在运行(凹图热键依赖;没在则拉起自带 AFA.exe)

0 commit comments

Comments
 (0)