feat(ui): 主调度台添加仅一次电源任务,UI样式优化
This commit is contained in:
@@ -260,8 +260,10 @@ class QueueConfig(QConfig):
|
||||
self.queueSet_AfterAccomplish = OptionsConfigItem(
|
||||
"QueueSet",
|
||||
"AfterAccomplish",
|
||||
"None",
|
||||
OptionsValidator(["None", "KillSelf", "Sleep", "Hibernate", "Shutdown"]),
|
||||
"NoAction",
|
||||
OptionsValidator(
|
||||
["NoAction", "KillSelf", "Sleep", "Hibernate", "Shutdown"]
|
||||
),
|
||||
)
|
||||
|
||||
self.time_TimeEnabled_0 = ConfigItem(
|
||||
@@ -627,6 +629,7 @@ class AppConfig(GlobalConfig):
|
||||
gameid_refreshed = Signal()
|
||||
PASSWORD_refreshed = Signal()
|
||||
user_info_changed = Signal()
|
||||
power_sign_changed = Signal()
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
@@ -649,7 +652,7 @@ class AppConfig(GlobalConfig):
|
||||
"ALL": {"value": [], "text": []},
|
||||
"Today": {"value": [], "text": []},
|
||||
}
|
||||
self.power_signal = None
|
||||
self.power_sign = "NoAction"
|
||||
self.if_ignore_silence = False
|
||||
self.if_database_opened = False
|
||||
|
||||
@@ -1311,6 +1314,12 @@ class AppConfig(GlobalConfig):
|
||||
|
||||
self.user_info_changed.emit()
|
||||
|
||||
def set_power_sign(self, sign: str) -> None:
|
||||
"""设置当前电源状态"""
|
||||
|
||||
self.power_sign = sign
|
||||
self.power_sign_changed.emit()
|
||||
|
||||
def save_history(self, key: str, content: dict) -> None:
|
||||
"""保存历史记录"""
|
||||
|
||||
|
||||
@@ -265,11 +265,13 @@ class _TaskManager(QObject):
|
||||
Config.queue_dict[name]["Config"].get(
|
||||
Config.queue_dict[name]["Config"].queueSet_AfterAccomplish
|
||||
)
|
||||
!= "None"
|
||||
and not Config.power_signal
|
||||
!= "NoAction"
|
||||
and Config.power_sign == "NoAction"
|
||||
):
|
||||
Config.power_signal = Config.queue_dict[name]["Config"].get(
|
||||
Config.queue_dict[name]["Config"].queueSet_AfterAccomplish
|
||||
Config.set_power_sign(
|
||||
Config.queue_dict[name]["Config"].get(
|
||||
Config.queue_dict[name]["Config"].queueSet_AfterAccomplish
|
||||
)
|
||||
)
|
||||
|
||||
def check_maa_version(self, v: str):
|
||||
|
||||
@@ -116,25 +116,25 @@ class _MainTimer(QWidget):
|
||||
|
||||
def check_power(self):
|
||||
|
||||
if Config.power_signal and not Config.running_list:
|
||||
if Config.power_sign != "NoAction" and not Config.running_list:
|
||||
|
||||
from app.ui import ProgressRingMessageBox
|
||||
|
||||
mode_book = {
|
||||
"Shutdown": "关机",
|
||||
"Hibernate": "休眠",
|
||||
"KillSelf": "退出软件",
|
||||
"Sleep": "睡眠",
|
||||
"KillSelf": "关闭AUTO_MAA",
|
||||
"Hibernate": "休眠",
|
||||
"Shutdown": "关机",
|
||||
}
|
||||
|
||||
choice = ProgressRingMessageBox(
|
||||
Config.main_window, f"{mode_book[Config.power_signal]}倒计时"
|
||||
Config.main_window, f"{mode_book[Config.power_sign]}倒计时"
|
||||
)
|
||||
if choice.exec():
|
||||
System.set_power(Config.power_signal)
|
||||
Config.power_signal = None
|
||||
System.set_power(Config.power_sign)
|
||||
Config.set_power_sign("NoAction")
|
||||
else:
|
||||
Config.power_signal = None
|
||||
Config.set_power_sign("NoAction")
|
||||
|
||||
|
||||
MainTimer = _MainTimer()
|
||||
|
||||
Reference in New Issue
Block a user