fix: 优化静默进程标记逻辑
This commit is contained in:
@@ -275,11 +275,11 @@ class QueueConfig(LQConfig):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
|
||||
self.queueSet_Name = ConfigItem("QueueSet", "Name", "")
|
||||
self.queueSet_TimeEnabled = ConfigItem(
|
||||
self.QueueSet_Name = ConfigItem("QueueSet", "Name", "")
|
||||
self.QueueSet_TimeEnabled = ConfigItem(
|
||||
"QueueSet", "TimeEnabled", False, BoolValidator()
|
||||
)
|
||||
self.queueSet_AfterAccomplish = OptionsConfigItem(
|
||||
self.QueueSet_AfterAccomplish = OptionsConfigItem(
|
||||
"QueueSet",
|
||||
"AfterAccomplish",
|
||||
"NoAction",
|
||||
@@ -705,7 +705,7 @@ class AppConfig(GlobalConfig):
|
||||
self.main_window = None
|
||||
self.PASSWORD = ""
|
||||
self.running_list = []
|
||||
self.silence_list = []
|
||||
self.silence_dict: Dict[Path, datetime] = {}
|
||||
self.info_bar_list = []
|
||||
self.stage_dict = {
|
||||
"ALL": {"value": [], "text": []},
|
||||
|
||||
@@ -380,14 +380,14 @@ class _TaskManager(QObject):
|
||||
# 根据调度队列情况设置电源状态
|
||||
if (
|
||||
Config.queue_dict[name]["Config"].get(
|
||||
Config.queue_dict[name]["Config"].queueSet_AfterAccomplish
|
||||
Config.queue_dict[name]["Config"].QueueSet_AfterAccomplish
|
||||
)
|
||||
!= "NoAction"
|
||||
and Config.power_sign == "NoAction"
|
||||
):
|
||||
Config.set_power_sign(
|
||||
Config.queue_dict[name]["Config"].get(
|
||||
Config.queue_dict[name]["Config"].queueSet_AfterAccomplish
|
||||
Config.queue_dict[name]["Config"].QueueSet_AfterAccomplish
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ class _MainTimer(QObject):
|
||||
|
||||
for name, info in Config.queue_dict.items():
|
||||
|
||||
if not info["Config"].get(info["Config"].queueSet_TimeEnabled):
|
||||
if not info["Config"].get(info["Config"].QueueSet_TimeEnabled):
|
||||
continue
|
||||
|
||||
data = info["Config"].toDict()
|
||||
@@ -114,9 +114,12 @@ class _MainTimer(QObject):
|
||||
|
||||
emulator_windows = []
|
||||
for window in windows:
|
||||
for emulator_path in Config.silence_list:
|
||||
# 此处排除雷电名为新通知的窗口
|
||||
if str(emulator_path) in window and window[0] != "新通知":
|
||||
for emulator_path, endtime in Config.silence_dict.items():
|
||||
if (
|
||||
datetime.now() < endtime
|
||||
and str(emulator_path) in window
|
||||
and window[0] != "新通知" # 此处排除雷电名为新通知的窗口
|
||||
):
|
||||
emulator_windows.append(window)
|
||||
|
||||
if emulator_windows:
|
||||
|
||||
@@ -570,12 +570,14 @@ class MaaManager(QObject):
|
||||
self.if_open_emulator = True
|
||||
break
|
||||
|
||||
# 添加静默进程标记
|
||||
# 更新静默进程标记有效时间
|
||||
logger.info(
|
||||
f"添加静默进程标记:{self.emulator_path}",
|
||||
f"更新静默进程标记:{self.emulator_path},标记有效时间:{datetime.now() + timedelta(seconds=self.wait_time + 10)}",
|
||||
module=f"MAA调度器-{self.name}",
|
||||
)
|
||||
Config.silence_list.append(self.emulator_path)
|
||||
Config.silence_dict[self.emulator_path] = (
|
||||
datetime.now() + timedelta(seconds=self.wait_time + 10)
|
||||
)
|
||||
|
||||
self.search_ADB_address()
|
||||
|
||||
@@ -1082,15 +1084,6 @@ class MaaManager(QObject):
|
||||
if self.isInterruptionRequested:
|
||||
return None
|
||||
|
||||
# 10s后移除静默进程标记
|
||||
QTimer.singleShot(
|
||||
10000, partial(Config.silence_list.remove, self.emulator_path)
|
||||
)
|
||||
logger.info(
|
||||
f"10s后移除静默进程标记:{self.emulator_path}",
|
||||
module=f"MAA调度器-{self.name}",
|
||||
)
|
||||
|
||||
if "-" in self.ADB_address:
|
||||
ADB_ip = f"{self.ADB_address.split("-")[0]}-"
|
||||
ADB_port = int(self.ADB_address.split("-")[1])
|
||||
|
||||
@@ -317,13 +317,17 @@ class GeneralManager(QObject):
|
||||
self.script_result = "游戏/模拟器启动失败"
|
||||
break
|
||||
|
||||
# 添加静默进程标记
|
||||
# 更新静默进程标记
|
||||
if self.set["Game"]["Style"] == "Emulator":
|
||||
logger.info(
|
||||
f"添加静默进程标记:{self.game_path}",
|
||||
f"更新静默进程标记:{self.game_path},标记有效时间:{datetime.now() + timedelta(seconds=self.set['Game']['WaitTime'] + 10)}",
|
||||
module=f"通用调度器-{self.name}",
|
||||
)
|
||||
Config.silence_list.append(self.game_path)
|
||||
Config.silence_dict[
|
||||
self.game_path
|
||||
] = datetime.now() + timedelta(
|
||||
seconds=self.set["Game"]["WaitTime"] + 10
|
||||
)
|
||||
|
||||
self.update_log_text.emit(
|
||||
f"正在等待游戏/模拟器完成启动\n请等待{self.set['Game']['WaitTime']}s"
|
||||
@@ -331,17 +335,6 @@ class GeneralManager(QObject):
|
||||
|
||||
self.sleep(self.set["Game"]["WaitTime"])
|
||||
|
||||
# 10s后移除静默进程标记
|
||||
if self.set["Game"]["Style"] == "Emulator":
|
||||
logger.info(
|
||||
f"10s后移除静默进程标记:{self.game_path}",
|
||||
module=f"通用调度器-{self.name}",
|
||||
)
|
||||
QTimer.singleShot(
|
||||
10000,
|
||||
partial(Config.silence_list.remove, self.game_path),
|
||||
)
|
||||
|
||||
# 运行脚本任务
|
||||
logger.info(
|
||||
f"运行脚本任务:{self.script_exe_path},参数:{self.set['Script']['Arguments']}",
|
||||
|
||||
@@ -240,8 +240,8 @@ class DispatchCenter(QWidget):
|
||||
self.script_list["主调度台"].top_bar.object.addItem(
|
||||
(
|
||||
"队列"
|
||||
if info["Config"].get(info["Config"].queueSet_Name) == ""
|
||||
else f"队列 - {info["Config"].get(info["Config"].queueSet_Name)}"
|
||||
if info["Config"].get(info["Config"].QueueSet_Name) == ""
|
||||
else f"队列 - {info["Config"].get(info["Config"].QueueSet_Name)}"
|
||||
),
|
||||
userData=name,
|
||||
)
|
||||
@@ -312,8 +312,8 @@ class DispatchCenter(QWidget):
|
||||
continue
|
||||
text_list.append(
|
||||
"队列"
|
||||
if info["Config"].get(info["Config"].queueSet_Name) == ""
|
||||
else f"队列 - {info["Config"].get(info["Config"].queueSet_Name)}"
|
||||
if info["Config"].get(info["Config"].QueueSet_Name) == ""
|
||||
else f"队列 - {info["Config"].get(info["Config"].QueueSet_Name)}"
|
||||
)
|
||||
data_list.append(name)
|
||||
|
||||
|
||||
@@ -399,7 +399,7 @@ class QueueManager(QWidget):
|
||||
content="用于标识调度队列的名称",
|
||||
text="请输入调度队列名称",
|
||||
qconfig=self.config,
|
||||
configItem=self.config.queueSet_Name,
|
||||
configItem=self.config.QueueSet_Name,
|
||||
parent=self,
|
||||
)
|
||||
self.card_Enable = SwitchSettingCard(
|
||||
@@ -407,7 +407,7 @@ class QueueManager(QWidget):
|
||||
title="定时运行状态",
|
||||
content="调度队列定时运行状态,仅启用时会执行定时任务",
|
||||
qconfig=self.config,
|
||||
configItem=self.config.queueSet_TimeEnabled,
|
||||
configItem=self.config.QueueSet_TimeEnabled,
|
||||
parent=self,
|
||||
)
|
||||
self.card_AfterAccomplish = ComboBoxSettingCard(
|
||||
@@ -423,7 +423,7 @@ class QueueManager(QWidget):
|
||||
"关机(强制)",
|
||||
],
|
||||
qconfig=self.config,
|
||||
configItem=self.config.queueSet_AfterAccomplish,
|
||||
configItem=self.config.QueueSet_AfterAccomplish,
|
||||
parent=self,
|
||||
)
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
"version_info": {
|
||||
"4.4.1.5": {
|
||||
"程序优化": [
|
||||
"优化调度队列配置逻辑"
|
||||
"优化调度队列配置逻辑",
|
||||
"优化静默进程标记逻辑,避免未能及时移除导致相关功能持续开启"
|
||||
]
|
||||
},
|
||||
"4.4.1.4": {
|
||||
|
||||
Reference in New Issue
Block a user