feat(core): 电源相关选项改为所有任务完成后生效
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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版本"""
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
"4.3.8.1": {
|
||||
"新增功能": [
|
||||
"自定义基建显示配置名称"
|
||||
],
|
||||
"修复bug": [
|
||||
"电源相关选项改为所有任务完成后生效"
|
||||
]
|
||||
},
|
||||
"4.3.7.0": {
|
||||
|
||||
Reference in New Issue
Block a user