chore(core): 优化静默判定逻辑
This commit is contained in:
@@ -86,25 +86,30 @@ class MainTimer(QWidget):
|
|||||||
def set_silence(self):
|
def set_silence(self):
|
||||||
"""设置静默模式"""
|
"""设置静默模式"""
|
||||||
|
|
||||||
windows = System.get_window_info()
|
if (
|
||||||
if any(
|
Config.global_config.get(Config.global_config.function_IfSilence)
|
||||||
str(emulator_path) in window
|
and Config.global_config.get(Config.global_config.function_BossKey) != ""
|
||||||
for window in windows
|
|
||||||
for emulator_path in Config.silence_list
|
|
||||||
):
|
):
|
||||||
try:
|
|
||||||
pyautogui.hotkey(
|
windows = System.get_window_info()
|
||||||
*[
|
if any(
|
||||||
_.strip().lower()
|
str(emulator_path) in window
|
||||||
for _ in Config.global_config.get(
|
for window in windows
|
||||||
Config.global_config.function_BossKey
|
for emulator_path in Config.silence_list
|
||||||
).split("+")
|
):
|
||||||
]
|
try:
|
||||||
)
|
pyautogui.hotkey(
|
||||||
except pyautogui.FailSafeException as e:
|
*[
|
||||||
if not self.if_FailSafeException:
|
_.strip().lower()
|
||||||
logger.warning(f"FailSafeException: {e}")
|
for _ in Config.global_config.get(
|
||||||
self.if_FailSafeException = True
|
Config.global_config.function_BossKey
|
||||||
|
).split("+")
|
||||||
|
]
|
||||||
|
)
|
||||||
|
except pyautogui.FailSafeException as e:
|
||||||
|
if not self.if_FailSafeException:
|
||||||
|
logger.warning(f"FailSafeException: {e}")
|
||||||
|
self.if_FailSafeException = True
|
||||||
|
|
||||||
def search_queue(self) -> list:
|
def search_queue(self) -> list:
|
||||||
"""搜索所有调度队列实例"""
|
"""搜索所有调度队列实例"""
|
||||||
|
|||||||
@@ -188,17 +188,12 @@ class MaaManager(QObject):
|
|||||||
creationflags=subprocess.CREATE_NO_WINDOW,
|
creationflags=subprocess.CREATE_NO_WINDOW,
|
||||||
)
|
)
|
||||||
# 添加静默进程标记
|
# 添加静默进程标记
|
||||||
if Config.global_config.get(
|
with self.maa_set_path.open(mode="r", encoding="utf-8") as f:
|
||||||
Config.global_config.function_IfSilence
|
set = json.load(f)
|
||||||
):
|
self.emulator_path = Path(
|
||||||
with self.maa_set_path.open(
|
set["Configurations"]["Default"]["Start.EmulatorPath"]
|
||||||
mode="r", encoding="utf-8"
|
)
|
||||||
) as f:
|
Config.silence_list.append(self.emulator_path)
|
||||||
set = json.load(f)
|
|
||||||
self.emulator_path = Path(
|
|
||||||
set["Configurations"]["Default"]["Start.EmulatorPath"]
|
|
||||||
)
|
|
||||||
Config.silence_list.append(self.emulator_path)
|
|
||||||
# 记录是否超时的标记
|
# 记录是否超时的标记
|
||||||
self.if_time_out = False
|
self.if_time_out = False
|
||||||
|
|
||||||
@@ -254,10 +249,7 @@ class MaaManager(QObject):
|
|||||||
"检测到MAA进程完成代理任务\n正在等待相关程序结束\n请等待10s"
|
"检测到MAA进程完成代理任务\n正在等待相关程序结束\n请等待10s"
|
||||||
)
|
)
|
||||||
# 移除静默进程标记
|
# 移除静默进程标记
|
||||||
if Config.global_config.get(
|
Config.silence_list.remove(self.emulator_path)
|
||||||
Config.global_config.function_IfSilence
|
|
||||||
):
|
|
||||||
Config.silence_list.remove(self.emulator_path)
|
|
||||||
for _ in range(10):
|
for _ in range(10):
|
||||||
if self.isInterruptionRequested:
|
if self.isInterruptionRequested:
|
||||||
break
|
break
|
||||||
@@ -278,10 +270,7 @@ class MaaManager(QObject):
|
|||||||
)
|
)
|
||||||
killprocess.wait()
|
killprocess.wait()
|
||||||
# 移除静默进程标记
|
# 移除静默进程标记
|
||||||
if Config.global_config.get(
|
Config.silence_list.remove(self.emulator_path)
|
||||||
Config.global_config.function_IfSilence
|
|
||||||
):
|
|
||||||
Config.silence_list.remove(self.emulator_path)
|
|
||||||
# 推送异常通知
|
# 推送异常通知
|
||||||
Notify.push_notification(
|
Notify.push_notification(
|
||||||
"用户自动代理出现异常!",
|
"用户自动代理出现异常!",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"main_version": "4.2.2.3",
|
"main_version": "4.2.2.4",
|
||||||
"updater_version": "1.1.1.3",
|
"updater_version": "1.1.1.3",
|
||||||
"announcement": "\n## 新增功能\n- 添加用户每日代理次数上限功能 #15\n- 新增代理成功消息推送渠道Server酱与企业微信群机器人推送\n- 添加更新类别可选项\n- 添加调度队列完成任务后行为选项\n## 修复BUG\n- 修复自定义基建无法正常使用的问题\n- 修正人工排查文案\n- 修复高级MAA配置序号错位\n- 修复高级用户列表无法配置问题\n- 修复主调度台选项乱动问题\n- 修复更新器文件夹定位问题\n## 程序优化\n- 优化弹窗逻辑",
|
"announcement": "\n## 新增功能\n- 添加用户每日代理次数上限功能 #15\n- 新增代理成功消息推送渠道Server酱与企业微信群机器人推送\n- 添加更新类别可选项\n- 添加调度队列完成任务后行为选项\n## 修复BUG\n- 修复自定义基建无法正常使用的问题\n- 修正人工排查文案\n- 修复高级MAA配置序号错位\n- 修复高级用户列表无法配置问题\n- 修复主调度台选项乱动问题\n- 修复更新器文件夹定位问题\n## 程序优化\n- 优化弹窗逻辑\n- 优化静默判定逻辑",
|
||||||
"proxy_list": [
|
"proxy_list": [
|
||||||
"",
|
"",
|
||||||
"https://gitproxy.click/",
|
"https://gitproxy.click/",
|
||||||
|
|||||||
Reference in New Issue
Block a user