From a93a60d125823d1bace5cc197ee8d70ce13bc2cf Mon Sep 17 00:00:00 2001 From: DLmaster Date: Fri, 7 Feb 2025 15:37:07 +0800 Subject: [PATCH 1/3] =?UTF-8?q?chore(core):=20=E4=BC=98=E5=8C=96=E9=9D=99?= =?UTF-8?q?=E9=BB=98=E5=88=A4=E5=AE=9A=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/timer.py | 41 +++++++++++++++++++++++------------------ app/models/MAA.py | 27 ++++++++------------------- resources/version.json | 4 ++-- 3 files changed, 33 insertions(+), 39 deletions(-) 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/", From c3e710b5cf18b55a81351a5d48b11b84c8efc29c Mon Sep 17 00:00:00 2001 From: DLmaster Date: Fri, 7 Feb 2025 15:53:37 +0800 Subject: [PATCH 2/3] =?UTF-8?q?chore(gui):=20=E8=B0=83=E6=95=B4MAA?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E7=9B=AE=E5=BD=95=E6=97=B6=E6=89=93=E5=BC=80?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E5=B7=B2=E9=85=8D=E7=BD=AE=E7=9A=84=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ui/member_manager.py | 6 +++++- resources/version.json | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/ui/member_manager.py b/app/ui/member_manager.py index a90201e..60d4740 100644 --- a/app/ui/member_manager.py +++ b/app/ui/member_manager.py @@ -535,7 +535,11 @@ class MaaSettingBox(QWidget): def PathClicked(self): - folder = QFileDialog.getExistingDirectory(self, "选择MAA目录", "./") + folder = QFileDialog.getExistingDirectory( + self, + "选择MAA目录", + Config.maa_config.get(Config.maa_config.MaaSet_Path), + ) if ( not folder or Config.maa_config.get(Config.maa_config.MaaSet_Path) == folder diff --git a/resources/version.json b/resources/version.json index f8fe05c..8667198 100644 --- a/resources/version.json +++ b/resources/version.json @@ -1,7 +1,7 @@ { "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- 优化弹窗逻辑\n- 优化静默判定逻辑", + "announcement": "\n## 新增功能\n- 添加用户每日代理次数上限功能 #15\n- 新增代理成功消息推送渠道Server酱与企业微信群机器人推送\n- 添加更新类别可选项\n- 添加调度队列完成任务后行为选项\n## 修复BUG\n- 修复自定义基建无法正常使用的问题\n- 修正人工排查文案\n- 修复高级MAA配置序号错位\n- 修复高级用户列表无法配置问题\n- 修复主调度台选项乱动问题\n- 修复更新器文件夹定位问题\n## 程序优化\n- 优化弹窗逻辑\n- 优化静默判定逻辑\n- 调整MAA设置目录时打开当前已配置的目录位置", "proxy_list": [ "", "https://gitproxy.click/", From 748fa7a004ab772c8e70bd5cc6de4fd26b2eacef Mon Sep 17 00:00:00 2001 From: DLmaster Date: Fri, 7 Feb 2025 18:27:01 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix(gui):=20=E4=BF=AE=E5=A4=8D=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E8=AE=B0=E5=BF=86=E5=8A=9F=E8=83=BD=E5=A4=B1=E6=95=88?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/config.py | 2 ++ app/core/task_manager.py | 2 -- app/ui/main_window.py | 16 ++++++++-------- resources/version.json | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index 6f05a49..833d11c 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -127,6 +127,8 @@ class AppConfig: self.queue_config = QueueConfig() self.maa_config = MaaConfig() + qconfig.load(self.config_path, self.global_config) + config_list = self.search_config() for config in config_list: if config[0] == "Maa": diff --git a/app/core/task_manager.py b/app/core/task_manager.py index 28d9fcc..85e97f8 100644 --- a/app/core/task_manager.py +++ b/app/core/task_manager.py @@ -67,8 +67,6 @@ class Task(QThread): self.logs = [] - self.question_response.connect(lambda: print("response")) - def run(self): if "设置MAA" in self.mode: diff --git a/app/ui/main_window.py b/app/ui/main_window.py index efb49f7..28e99e9 100644 --- a/app/ui/main_window.py +++ b/app/ui/main_window.py @@ -223,7 +223,7 @@ class AUTO_MAA(MSFluentWindow): else: self.titleBar.minBtn.clicked.disconnect() - self.titleBar.minBtn.clicked.connect(self.showMinimized) + self.titleBar.minBtn.clicked.connect(self.window().showMinimized) def on_tray_activated(self, reason): """双击返回主界面""" @@ -285,11 +285,11 @@ class AUTO_MAA(MSFluentWindow): ), ) ) - self.setGeometry(location[0], location[1], size[0], size[1]) - self.show() + self.window().setGeometry(location[0], location[1], size[0], size[1]) + self.window().show() if not if_quick: if Config.global_config.get(Config.global_config.ui_maximized): - self.showMaximized() + self.window().showMaximized() self.set_min_method() self.show_ui("配置托盘") @@ -303,7 +303,7 @@ class AUTO_MAA(MSFluentWindow): elif mode == "隐藏到托盘": # 保存窗口相关属性 - if not self.isMaximized(): + if not self.window().isMaximized(): Config.global_config.set( Config.global_config.ui_size, @@ -314,14 +314,14 @@ class AUTO_MAA(MSFluentWindow): f"{self.geometry().x()}x{self.geometry().y()}", ) Config.global_config.set( - Config.global_config.ui_maximized, self.isMaximized() + Config.global_config.ui_maximized, self.window().isMaximized() ) Config.global_config.save() # 隐藏主窗口 if not if_quick: - self.hide() + self.window().hide() self.tray.show() def closeEvent(self, event: QCloseEvent): @@ -338,6 +338,6 @@ class AUTO_MAA(MSFluentWindow): Config.close_database() logger.info("AUTO_MAA主程序关闭") - logger.info("===================================") + logger.info("----------------END----------------") event.accept() diff --git a/resources/version.json b/resources/version.json index 8667198..6432c87 100644 --- a/resources/version.json +++ b/resources/version.json @@ -1,7 +1,7 @@ { "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- 优化弹窗逻辑\n- 优化静默判定逻辑\n- 调整MAA设置目录时打开当前已配置的目录位置", + "announcement": "\n## 新增功能\n- 添加用户每日代理次数上限功能 #15\n- 新增代理成功消息推送渠道Server酱与企业微信群机器人推送\n- 添加更新类别可选项\n- 添加调度队列完成任务后行为选项\n## 修复BUG\n- 修复自定义基建无法正常使用的问题\n- 修正人工排查文案\n- 修复高级MAA配置序号错位\n- 修复高级用户列表无法配置问题\n- 修复主调度台选项乱动问题\n- 修复更新器文件夹定位问题\n- 修复窗口记忆功能失效问题\n## 程序优化\n- 优化弹窗逻辑\n- 优化静默判定逻辑\n- 调整MAA设置目录时打开当前已配置的目录位置", "proxy_list": [ "", "https://gitproxy.click/",