From 74ce441b9031c977486fa8486bb555cac742cec3 Mon Sep 17 00:00:00 2001 From: DLmaster361 Date: Fri, 9 May 2025 21:52:18 +0800 Subject: [PATCH] =?UTF-8?q?feat(core):=20=E7=94=B5=E6=BA=90=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E9=80=89=E9=A1=B9=E6=94=B9=E4=B8=BA=E6=89=80=E6=9C=89?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=AE=8C=E6=88=90=E5=90=8E=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/config.py | 1 + app/core/task_manager.py | 22 +++------------------- app/core/timer.py | 23 +++++++++++++++++++++++ resources/version.json | 3 +++ 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index 6705348..1b24bed 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -649,6 +649,7 @@ class AppConfig(GlobalConfig): "ALL": {"value": [], "text": []}, "Today": {"value": [], "text": []}, } + self.power_signal = None self.if_ignore_silence = False self.if_database_opened = False diff --git a/app/core/task_manager.py b/app/core/task_manager.py index 868f611..ae398d2 100644 --- a/app/core/task_manager.py +++ b/app/core/task_manager.py @@ -266,27 +266,11 @@ class _TaskManager(QObject): Config.queue_dict[name]["Config"].queueSet_AfterAccomplish ) != "None" + and not Config.power_signal ): - - from app.ui import ProgressRingMessageBox - - mode_book = { - "Shutdown": "关机", - "Hibernate": "休眠", - "Sleep": "睡眠", - "KillSelf": "关闭AUTO_MAA", - } - - choice = ProgressRingMessageBox( - Config.main_window, - f"{mode_book[Config.queue_dict[name]["Config"].get(Config.queue_dict[name]["Config"].queueSet_AfterAccomplish)]}倒计时", + Config.power_signal = Config.queue_dict[name]["Config"].get( + Config.queue_dict[name]["Config"].queueSet_AfterAccomplish ) - if choice.exec(): - System.set_power( - Config.queue_dict[name]["Config"].get( - Config.queue_dict[name]["Config"].queueSet_AfterAccomplish - ) - ) def check_maa_version(self, v: str): """检查MAA版本""" diff --git a/app/core/timer.py b/app/core/timer.py index f019076..0d16f95 100644 --- a/app/core/timer.py +++ b/app/core/timer.py @@ -46,6 +46,7 @@ class _MainTimer(QWidget): self.Timer = QTimer() self.Timer.timeout.connect(self.timed_start) self.Timer.timeout.connect(self.set_silence) + self.Timer.timeout.connect(self.check_power) self.Timer.start(1000) self.LongTimer = QTimer() self.LongTimer.timeout.connect(self.long_timed_task) @@ -113,5 +114,27 @@ class _MainTimer(QWidget): logger.warning(f"FailSafeException: {e}") self.if_FailSafeException = True + def check_power(self): + + if Config.power_signal and not Config.running_list: + + from app.ui import ProgressRingMessageBox + + mode_book = { + "Shutdown": "关机", + "Hibernate": "休眠", + "Sleep": "睡眠", + "KillSelf": "关闭AUTO_MAA", + } + + choice = ProgressRingMessageBox( + Config.main_window, f"{mode_book[Config.power_signal]}倒计时" + ) + if choice.exec(): + System.set_power(Config.power_signal) + Config.power_signal = None + else: + Config.power_signal = None + MainTimer = _MainTimer() diff --git a/resources/version.json b/resources/version.json index 54b20d8..05e7015 100644 --- a/resources/version.json +++ b/resources/version.json @@ -5,6 +5,9 @@ "4.3.8.1": { "新增功能": [ "自定义基建显示配置名称" + ], + "修复bug": [ + "电源相关选项改为所有任务完成后生效" ] }, "4.3.7.0": {