From 3cdb1e511d9211d6a29591361ec4f01eac6174dc Mon Sep 17 00:00:00 2001 From: DLmaster361 Date: Sat, 26 Jul 2025 13:11:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/config.py | 2 +- app/core/timer.py | 20 +++++++++++++------- app/services/system.py | 19 +++++++++++++------ resources/version.json | 7 ++++++- 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index ffd9e13..b27c8ba 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -713,7 +713,7 @@ class GeneralSubConfig(LQConfig): class AppConfig(GlobalConfig): - VERSION = "4.4.1.3" + VERSION = "4.4.1.4" stage_refreshed = Signal() PASSWORD_refreshed = Signal() diff --git a/app/core/timer.py b/app/core/timer.py index e41a2f0..690c460 100644 --- a/app/core/timer.py +++ b/app/core/timer.py @@ -112,12 +112,18 @@ class _MainTimer(QObject): windows = System.get_window_info() - # 此处排除雷电名为新通知的窗口 - if any( - str(emulator_path) in window and window[0] != "新通知" - for window in windows - for emulator_path in Config.silence_list - ): + emulator_windows = [] + for window in windows: + for emulator_path in Config.silence_list: + # 此处排除雷电名为新通知的窗口 + if str(emulator_path) in window and window[0] != "新通知": + emulator_windows.append(window) + + if emulator_windows: + + logger.info( + f"检测到模拟器窗口:{emulator_windows}", module="主业务定时器" + ) try: keyboard.press_and_release( "+".join( @@ -146,7 +152,7 @@ class _MainTimer(QObject): "Sleep": "睡眠", "Hibernate": "休眠", "Shutdown": "关机", - "ShutdownForce": "关机(强制)" + "ShutdownForce": "关机(强制)", } choice = ProgressRingMessageBox( diff --git a/app/services/system.py b/app/services/system.py index 9ab8636..36a9fba 100644 --- a/app/services/system.py +++ b/app/services/system.py @@ -204,10 +204,8 @@ class _SystemHandler: elif mode == "Shutdown": - logger.info("执行关机操作", module="系统服务") - logger.info("正在清除模拟器进程",module="系统服务") self.kill_emulator_processes() - logger.info("清除模拟器进程完成,正在关机",module="系统服务") + logger.info("执行关机操作", module="系统服务") subprocess.run(["shutdown", "/s", "/t", "0"]) elif mode == "ShutdownForce": @@ -262,16 +260,25 @@ class _SystemHandler: sys.exit(0) def kill_emulator_processes(self): - # 这里暂时仅支持 MuMu 模拟器 - keywords = ["Nemu", "nemu", "emulator","MuMu"] + """这里暂时仅支持 MuMu 模拟器""" + + logger.info("正在清除模拟器进程", module="系统服务") + + keywords = ["Nemu", "nemu", "emulator", "MuMu"] for proc in psutil.process_iter(["pid", "name"]): try: pname = proc.info["name"].lower() if any(keyword.lower() in pname for keyword in keywords): proc.kill() - logger.info(f"已关闭 MuMu 模拟器进程: {proc.info['name']}", module="系统服务") + logger.info( + f"已关闭 MuMu 模拟器进程: {proc.info['name']}", + module="系统服务", + ) except (psutil.NoSuchProcess, psutil.AccessDenied): continue + + logger.success("模拟器进程清除完成", module="系统服务") + def is_startup(self) -> bool: """判断程序是否已经开机自启""" diff --git a/resources/version.json b/resources/version.json index 3f06f20..c01428e 100644 --- a/resources/version.json +++ b/resources/version.json @@ -1,6 +1,11 @@ { - "main_version": "4.4.1.3", + "main_version": "4.4.1.4", "version_info": { + "4.4.1.4": { + "修复BUG": [ + "添加强制关机功能并优化关机流程" + ] + }, "4.4.1.3": { "修复BUG": [ "移除崩溃弹窗机制"