diff --git a/app/core/timer.py b/app/core/timer.py index bcf5909..6664a4b 100644 --- a/app/core/timer.py +++ b/app/core/timer.py @@ -86,25 +86,30 @@ class MainTimer(QWidget): def set_silence(self): """设置静默模式""" - windows = System.get_window_info() - if any( - str(emulator_path) in window - for window in windows - for emulator_path in Config.silence_list + if ( + Config.global_config.get(Config.global_config.function_IfSilence) + and Config.global_config.get(Config.global_config.function_BossKey) != "" ): - try: - pyautogui.hotkey( - *[ - _.strip().lower() - for _ in Config.global_config.get( - Config.global_config.function_BossKey - ).split("+") - ] - ) - except pyautogui.FailSafeException as e: - if not self.if_FailSafeException: - logger.warning(f"FailSafeException: {e}") - self.if_FailSafeException = True + + windows = System.get_window_info() + if any( + str(emulator_path) in window + for window in windows + for emulator_path in Config.silence_list + ): + try: + pyautogui.hotkey( + *[ + _.strip().lower() + for _ in Config.global_config.get( + Config.global_config.function_BossKey + ).split("+") + ] + ) + except pyautogui.FailSafeException as e: + if not self.if_FailSafeException: + logger.warning(f"FailSafeException: {e}") + self.if_FailSafeException = True def search_queue(self) -> list: """搜索所有调度队列实例""" diff --git a/app/models/MAA.py b/app/models/MAA.py index 9536b79..77815ba 100644 --- a/app/models/MAA.py +++ b/app/models/MAA.py @@ -188,17 +188,12 @@ class MaaManager(QObject): creationflags=subprocess.CREATE_NO_WINDOW, ) # 添加静默进程标记 - if Config.global_config.get( - Config.global_config.function_IfSilence - ): - with self.maa_set_path.open( - mode="r", encoding="utf-8" - ) as f: - set = json.load(f) - self.emulator_path = Path( - set["Configurations"]["Default"]["Start.EmulatorPath"] - ) - Config.silence_list.append(self.emulator_path) + with self.maa_set_path.open(mode="r", encoding="utf-8") as f: + set = json.load(f) + self.emulator_path = Path( + set["Configurations"]["Default"]["Start.EmulatorPath"] + ) + Config.silence_list.append(self.emulator_path) # 记录是否超时的标记 self.if_time_out = False @@ -254,10 +249,7 @@ class MaaManager(QObject): "检测到MAA进程完成代理任务\n正在等待相关程序结束\n请等待10s" ) # 移除静默进程标记 - if Config.global_config.get( - Config.global_config.function_IfSilence - ): - Config.silence_list.remove(self.emulator_path) + Config.silence_list.remove(self.emulator_path) for _ in range(10): if self.isInterruptionRequested: break @@ -278,10 +270,7 @@ class MaaManager(QObject): ) killprocess.wait() # 移除静默进程标记 - if Config.global_config.get( - Config.global_config.function_IfSilence - ): - Config.silence_list.remove(self.emulator_path) + Config.silence_list.remove(self.emulator_path) # 推送异常通知 Notify.push_notification( "用户自动代理出现异常!", diff --git a/resources/version.json b/resources/version.json index 1f5706b..f8fe05c 100644 --- a/resources/version.json +++ b/resources/version.json @@ -1,7 +1,7 @@ { - "main_version": "4.2.2.3", + "main_version": "4.2.2.4", "updater_version": "1.1.1.3", - "announcement": "\n## 新增功能\n- 添加用户每日代理次数上限功能 #15\n- 新增代理成功消息推送渠道Server酱与企业微信群机器人推送\n- 添加更新类别可选项\n- 添加调度队列完成任务后行为选项\n## 修复BUG\n- 修复自定义基建无法正常使用的问题\n- 修正人工排查文案\n- 修复高级MAA配置序号错位\n- 修复高级用户列表无法配置问题\n- 修复主调度台选项乱动问题\n- 修复更新器文件夹定位问题\n## 程序优化\n- 优化弹窗逻辑", + "announcement": "\n## 新增功能\n- 添加用户每日代理次数上限功能 #15\n- 新增代理成功消息推送渠道Server酱与企业微信群机器人推送\n- 添加更新类别可选项\n- 添加调度队列完成任务后行为选项\n## 修复BUG\n- 修复自定义基建无法正常使用的问题\n- 修正人工排查文案\n- 修复高级MAA配置序号错位\n- 修复高级用户列表无法配置问题\n- 修复主调度台选项乱动问题\n- 修复更新器文件夹定位问题\n## 程序优化\n- 优化弹窗逻辑\n- 优化静默判定逻辑", "proxy_list": [ "", "https://gitproxy.click/",