From d7e502e22f65a681f724566161b5adb278eb9ae2 Mon Sep 17 00:00:00 2001 From: DLmaster Date: Wed, 9 Apr 2025 11:22:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(ui):=20=E5=AF=B9win10=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E8=BF=9B=E4=B8=80=E6=AD=A5=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 48 ------------------------------------------ app/ui/main_window.py | 44 ++++++++++++++++++-------------------- resources/version.json | 3 +++ 3 files changed, 23 insertions(+), 72 deletions(-) delete mode 100644 .gitignore diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 7b10742..0000000 --- a/.gitignore +++ /dev/null @@ -1,48 +0,0 @@ -.idea/AUTO_MAA.iml -.idea/inspectionProfiles/profiles_settings.xml -.idea/misc.xml -.idea/vcs.xml -.idea/modules.xml -.idea/workspace.xml -app/__pycache__/__init__.cpython-312.pyc -app/core/__pycache__/__init__.cpython-312.pyc -app/core/__pycache__/main_info_bar.cpython-312.pyc -app/core/__pycache__/config.cpython-312.pyc -app/core/__pycache__/task_manager.cpython-312.pyc -app/core/__pycache__/timer.cpython-312.pyc -app/models/__pycache__/__init__.cpython-312.pyc -testPython/.idea/workspace.xml -testPython/.idea/testPython.iml -testPython/.idea/vcs.xml -testPython/.idea/misc.xml -testPython/.idea/modules.xml -testPython/.idea/inspectionProfiles/profiles_settings.xml -debug/AUTO_MAA.log -data/key/verifysalt.txt -resources/notice.json -data/key/private_key.bin -data/key/public_key.pem -data/key/PASSWORDsalt.txt -data/key/AES_password_verify.bin -data/gameid.txt -data/data.db -config/QueueConfig/调度队列_1.json -config/MaaConfig/脚本_1/user_data.db -config/MaaConfig/脚本_1/config.json -config/config.json -app/utils/__pycache__/downloader.cpython-312.pyc -app/utils/__pycache__/__init__.cpython-312.pyc -app/ui/__pycache__/Widget.cpython-312.pyc -app/ui/__pycache__/setting.cpython-312.pyc -app/ui/__pycache__/queue_manager.cpython-312.pyc -app/ui/__pycache__/member_manager.cpython-312.pyc -app/ui/__pycache__/main_window.cpython-312.pyc -app/ui/__pycache__/history.cpython-312.pyc -app/ui/__pycache__/home.cpython-312.pyc -app/ui/__pycache__/__init__.cpython-312.pyc -app/services/__pycache__/system.cpython-312.pyc -app/services/__pycache__/security.cpython-312.pyc -app/services/__pycache__/notification.cpython-312.pyc -app/services/__pycache__/__init__.cpython-312.pyc -app/models/__pycache__/MAA.cpython-312.pyc -app/ui/__pycache__/dispatch_center.cpython-312.pyc diff --git a/app/ui/main_window.py b/app/ui/main_window.py index 6fa390a..053fdd9 100644 --- a/app/ui/main_window.py +++ b/app/ui/main_window.py @@ -42,7 +42,7 @@ from qfluentwidgets import ( MSFluentWindow, NavigationItemPosition, qconfig, - FluentBackgroundTheme + FluentBackgroundTheme, ) from PySide6.QtGui import QIcon, QCloseEvent from PySide6.QtCore import Qt, QTimer @@ -70,13 +70,7 @@ class AUTO_MAA(MSFluentWindow): self.setWindowTitle("AUTO_MAA") setTheme(Theme.AUTO, lazy=True) - if isDarkTheme(): - self.setStyleSheet(""" - CardWidget {background-color: #313131;} - FluentBackgroundTheme {background-color: #313131;} - """) - else: - self.setStyleSheet("""background-color: #ffffff;""") + self.switch_theme() self.splashScreen = SplashScreen(self.windowIcon(), self) self.show_ui("显示主窗口", if_quick=True) @@ -215,30 +209,32 @@ class AUTO_MAA(MSFluentWindow): self.themeListener.systemThemeChanged.connect(self.switch_theme) self.themeListener.start() - def switch_theme(self): - #切换主题 + def switch_theme(self) -> None: + """切换主题""" setTheme(Theme.AUTO, lazy=True) QTimer.singleShot(300, lambda: setTheme(Theme.AUTO, lazy=True)) - # 云母特效不兼容Win10,如果True则通过云母进行主题转换,False则根据当前主题设置背景颜色 + # 云母特效启用时需要增加重试机制 - if sys.platform != 'win32' or sys.getwindowsversion().build < 22000: - #根据当前主题设置背景颜色 - if isDarkTheme(): - self.setStyleSheet(""" - CardWidget {background-color: #313131;} - HeaderCardWidget {background-color: #313131;} - background-color: #313131; - """) - else: - self.setStyleSheet("background-color: #ffffff;") - - else: - print(sys.platform) + # 云母特效不兼容Win10,如果True则通过云母进行主题转换,False则根据当前主题设置背景颜色 + if self.isMicaEffectEnabled(): QTimer.singleShot( 300, lambda: self.windowEffect.setMicaEffect(self.winId(), isDarkTheme()), ) + else: + # 根据当前主题设置背景颜色 + if isDarkTheme(): + self.setStyleSheet( + """ + CardWidget {background-color: #313131;} + HeaderCardWidget {background-color: #313131;} + background-color: #313131; + """ + ) + else: + self.setStyleSheet("background-color: #ffffff;") + def start_up_task(self) -> None: """启动时任务""" diff --git a/resources/version.json b/resources/version.json index 5a01106..f044d69 100644 --- a/resources/version.json +++ b/resources/version.json @@ -4,6 +4,9 @@ "announcement": "\n## 新增功能\n- 屏蔽MuMu模拟器开屏广告功能上线\n- 更新器支持多线程下载\n- 添加强制关闭ADB与模拟器等增强任务项\n## 修复BUG\n- 修复统计信息HTML模板公招匹配错误\n- 修复密码显示按钮动画异常\n- 修复`检测到MAA未能实际执行任务`报错被异常屏蔽\n- 修复MAA超时判定异常失效\n## 程序优化\n- 关机等电源操作添加100s倒计时\n- 人工排查弹窗方法优化\n- 人工排查时自动屏蔽静默操作\n- 公告样式优化", "version_info": { "4.2.5.8":{ + "修复BUG": [ + "对win10主题进一步适配" + ], "程序优化": [ "loguru开始捕获子线程异常", "通知服务添加校验项"