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": {