feat(core):初步完成主调度自动代理功能开发
This commit is contained in:
@@ -29,9 +29,9 @@ __version__ = "4.2.0"
|
||||
__author__ = "DLmaster361 <DLmaster_361@163.com>"
|
||||
__license__ = "GPL-3.0 license"
|
||||
|
||||
from .core import AppConfig, QueueConfig, MaaConfig, Task, TaskManager, MainTimer
|
||||
from .core import AppConfig, QueueConfig, MaaConfig, Task, Task_manager, Main_timer
|
||||
from .models import MaaManager
|
||||
from .services import Notification, CryptoHandler, SystemHandler
|
||||
from .services import Notify, Crypto, System
|
||||
from .ui import AUTO_MAA
|
||||
from .utils import Updater, version_text
|
||||
|
||||
@@ -40,12 +40,12 @@ __all__ = [
|
||||
"QueueConfig",
|
||||
"MaaConfig",
|
||||
"Task",
|
||||
"TaskManager",
|
||||
"MainTimer",
|
||||
"Task_manager",
|
||||
"Main_timer",
|
||||
"MaaManager",
|
||||
"Notification",
|
||||
"CryptoHandler",
|
||||
"SystemHandler",
|
||||
"Notify",
|
||||
"Crypto",
|
||||
"System",
|
||||
"AUTO_MAA",
|
||||
"Updater",
|
||||
"version_text",
|
||||
|
||||
Binary file not shown.
@@ -29,17 +29,18 @@ __version__ = "4.2.0"
|
||||
__author__ = "DLmaster361 <DLmaster_361@163.com>"
|
||||
__license__ = "GPL-3.0 license"
|
||||
|
||||
from .config import AppConfig, QueueConfig, MaaConfig
|
||||
from .config import AppConfig, QueueConfig, MaaConfig, Config
|
||||
from .main_info_bar import MainInfoBar
|
||||
from .task_manager import Task, TaskManager
|
||||
from .timer import MainTimer
|
||||
from .task_manager import Task, Task_manager
|
||||
from .timer import Main_timer
|
||||
|
||||
__all__ = [
|
||||
"AppConfig",
|
||||
"Config",
|
||||
"QueueConfig",
|
||||
"MaaConfig",
|
||||
"MainInfoBar",
|
||||
"Task",
|
||||
"TaskManager",
|
||||
"MainTimer",
|
||||
"Task_manager",
|
||||
"Main_timer",
|
||||
]
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -84,7 +84,7 @@ class AppConfig:
|
||||
"updater_version": "0.0.0.0",
|
||||
}
|
||||
with self.version_path.open(mode="w", encoding="utf-8") as f:
|
||||
json.dump(version, f, indent=4)
|
||||
json.dump(version, f, ensure_ascii=False, indent=4)
|
||||
|
||||
# 生成预设gameid替换方案文件
|
||||
if not self.gameid_path.exists():
|
||||
@@ -253,7 +253,7 @@ class AppConfig:
|
||||
history = json.load(f)
|
||||
history[key] = content
|
||||
with self.history_path.open(mode="w", encoding="utf-8") as f:
|
||||
json.dump(history, f, indent=4)
|
||||
json.dump(history, f, ensure_ascii=False, indent=4)
|
||||
|
||||
def get_history(self, key: str) -> dict:
|
||||
"""获取历史记录"""
|
||||
@@ -409,3 +409,6 @@ class MaaConfig(QConfig):
|
||||
RunSet_RunTimesLimit = RangeConfigItem(
|
||||
"RunSet", "RunTimesLimit", 3, RangeValidator(1, 1024)
|
||||
)
|
||||
|
||||
|
||||
Config = AppConfig()
|
||||
|
||||
@@ -26,15 +26,13 @@ v4.2
|
||||
"""
|
||||
|
||||
from loguru import logger
|
||||
from PySide6.QtWidgets import QApplication
|
||||
from PySide6 import QtCore
|
||||
import json
|
||||
from typing import Dict, Union, List
|
||||
|
||||
from .config import AppConfig
|
||||
from .config import Config
|
||||
from .main_info_bar import MainInfoBar
|
||||
from app.models import MaaManager
|
||||
from app.services import Notification
|
||||
from app.services import Notify
|
||||
|
||||
|
||||
class Task(QtCore.QThread):
|
||||
@@ -51,15 +49,11 @@ class Task(QtCore.QThread):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
config: AppConfig,
|
||||
notify: Notification,
|
||||
name: str,
|
||||
info: Dict[str, Dict[str, Union[str, int, bool]]],
|
||||
):
|
||||
super(Task, self).__init__()
|
||||
|
||||
self.config = config
|
||||
self.notify = notify
|
||||
self.name = name
|
||||
self.info = info
|
||||
|
||||
@@ -84,17 +78,15 @@ class Task(QtCore.QThread):
|
||||
self.task_list[i][1] = "运行"
|
||||
self.update_task_list.emit(self.task_list)
|
||||
|
||||
if self.task_list[i][0] not in self.config.running_list:
|
||||
if self.task_list[i][0] not in Config.running_list:
|
||||
|
||||
self.config.running_list.append(self.task_list[i][0])
|
||||
Config.running_list.append(self.task_list[i][0])
|
||||
logger.info(f"任务开始:{self.task_list[i][0]}")
|
||||
self.push_info_bar.emit("info", "任务开始", self.task_list[i][0], 5000)
|
||||
|
||||
if self.member_dict[self.task_list[i][0]][0] == "Maa":
|
||||
|
||||
self.task = MaaManager(
|
||||
self.config,
|
||||
self.notify,
|
||||
"自动代理",
|
||||
self.member_dict[self.task_list[i][0]][1],
|
||||
)
|
||||
@@ -110,7 +102,7 @@ class Task(QtCore.QThread):
|
||||
|
||||
self.task.run()
|
||||
|
||||
self.config.running_list.remove(self.task_list[i][0])
|
||||
Config.running_list.remove(self.task_list[i][0])
|
||||
|
||||
self.task_list[i][1] = "完成"
|
||||
logger.info(f"任务完成:{self.task_list[i][0]}")
|
||||
@@ -129,8 +121,8 @@ class Task(QtCore.QThread):
|
||||
|
||||
member_dict = {}
|
||||
|
||||
if (self.config.app_path / "config/MaaConfig").exists():
|
||||
for subdir in (self.config.app_path / "config/MaaConfig").iterdir():
|
||||
if (Config.app_path / "config/MaaConfig").exists():
|
||||
for subdir in (Config.app_path / "config/MaaConfig").iterdir():
|
||||
if subdir.is_dir():
|
||||
|
||||
member_dict[subdir.name] = ["Maa", subdir]
|
||||
@@ -147,14 +139,12 @@ class TaskManager(QtCore.QObject):
|
||||
"""业务调度器"""
|
||||
|
||||
create_gui = QtCore.Signal(Task)
|
||||
connect_gui = QtCore.Signal(Task)
|
||||
push_info_bar = QtCore.Signal(str, str, str, int)
|
||||
|
||||
def __init__(self, config: AppConfig, notify: Notification):
|
||||
def __init__(self):
|
||||
super(TaskManager, self).__init__()
|
||||
|
||||
self.config = config
|
||||
self.notify = notify
|
||||
|
||||
self.task_list: Dict[str, Task] = {}
|
||||
|
||||
def add_task(
|
||||
@@ -162,29 +152,35 @@ class TaskManager(QtCore.QObject):
|
||||
):
|
||||
"""添加任务"""
|
||||
|
||||
if (
|
||||
mode == "运行队列"
|
||||
and name not in self.config.running_list
|
||||
and name not in self.task_list
|
||||
):
|
||||
if name in Config.running_list or name in self.task_list:
|
||||
|
||||
logger.info(f"任务开始:{name}")
|
||||
MainInfoBar.push_info_bar("info", "任务开始", name, 5000)
|
||||
logger.warning(f"任务已存在:{name}")
|
||||
MainInfoBar.push_info_bar("warning", "任务已存在", name, 5000)
|
||||
return None
|
||||
|
||||
self.config.running_list.append(name)
|
||||
self.task_list[name] = Task(self.config, self.notify, name, info)
|
||||
self.task_list[name].push_info_bar.connect(MainInfoBar.push_info_bar)
|
||||
self.task_list[name].accomplish.connect(
|
||||
lambda logs: self.remove_task(name, logs)
|
||||
)
|
||||
logger.info(f"任务开始:{name}")
|
||||
MainInfoBar.push_info_bar("info", "任务开始", name, 3000)
|
||||
|
||||
Config.running_list.append(name)
|
||||
self.task_list[name] = Task(name, info)
|
||||
self.task_list[name].push_info_bar.connect(MainInfoBar.push_info_bar)
|
||||
self.task_list[name].accomplish.connect(
|
||||
lambda logs: self.remove_task(name, logs)
|
||||
)
|
||||
|
||||
if mode == "新窗口":
|
||||
self.create_gui.emit(self.task_list[name])
|
||||
self.task_list[name].start()
|
||||
|
||||
elif mode == "主窗口":
|
||||
self.connect_gui.emit(self.task_list[name])
|
||||
|
||||
self.task_list[name].start()
|
||||
|
||||
def stop_task(self, name: str):
|
||||
"""中止任务"""
|
||||
|
||||
logger.info(f"中止任务:{name}")
|
||||
MainInfoBar.push_info_bar("info", "中止任务", name, 5000)
|
||||
MainInfoBar.push_info_bar("info", "中止任务", name, 3000)
|
||||
|
||||
if name == "ALL":
|
||||
|
||||
@@ -206,17 +202,20 @@ class TaskManager(QtCore.QObject):
|
||||
"""移除任务标记"""
|
||||
|
||||
logger.info(f"任务结束:{name}")
|
||||
MainInfoBar.push_info_bar("info", "任务结束", name, 5000)
|
||||
MainInfoBar.push_info_bar("info", "任务结束", name, 3000)
|
||||
|
||||
if len(logs) > 0:
|
||||
time = logs[0][1]["Time"]
|
||||
history = ""
|
||||
for log in logs:
|
||||
self.config.save_history(log[0], log[1])
|
||||
Config.save_history(log[0], log[1])
|
||||
history += (
|
||||
f"任务名称:{log[0]},{log[1]["History"].replace("\n","\n ")}\n"
|
||||
)
|
||||
self.config.save_history(name, {"Time": time, "History": history})
|
||||
Config.save_history(name, {"Time": time, "History": history})
|
||||
|
||||
self.task_list.pop(name)
|
||||
self.config.running_list.remove(name)
|
||||
Config.running_list.remove(name)
|
||||
|
||||
|
||||
Task_manager = TaskManager()
|
||||
|
||||
@@ -31,26 +31,19 @@ from PySide6 import QtCore
|
||||
import json
|
||||
import datetime
|
||||
|
||||
from .config import AppConfig
|
||||
from .task_manager import TaskManager
|
||||
from app.services import SystemHandler
|
||||
from .config import Config
|
||||
from .task_manager import Task_manager
|
||||
from app.services import System
|
||||
|
||||
|
||||
class MainTimer(QWidget):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
config: AppConfig,
|
||||
system: SystemHandler,
|
||||
task_manager: TaskManager,
|
||||
parent=None,
|
||||
):
|
||||
super().__init__(parent)
|
||||
|
||||
self.config = config
|
||||
self.system = system
|
||||
self.task_manager = task_manager
|
||||
|
||||
self.Timer = QtCore.QTimer()
|
||||
self.Timer.timeout.connect(self.timed_start)
|
||||
self.Timer.timeout.connect(self.set_silence)
|
||||
@@ -69,7 +62,7 @@ class MainTimer(QWidget):
|
||||
if not info["QueueSet"]["Enabled"]:
|
||||
continue
|
||||
|
||||
history = self.config.get_history(name)
|
||||
history = Config.get_history(name)
|
||||
|
||||
time_set = [
|
||||
info["Time"][f"TimeSet_{_}"]
|
||||
@@ -81,22 +74,22 @@ class MainTimer(QWidget):
|
||||
if (
|
||||
curtime[11:16] in time_set
|
||||
and curtime != history["Time"][:16]
|
||||
and name not in self.config.running_list
|
||||
and name not in Config.running_list
|
||||
):
|
||||
|
||||
logger.info(f"按时间调起任务:{name}")
|
||||
self.task_manager.add_task("运行队列", name, info)
|
||||
Task_manager.add_task("新窗口", name, info)
|
||||
|
||||
def set_silence(self):
|
||||
"""设置静默模式"""
|
||||
# # 临时
|
||||
# windows = self.system.get_window_info()
|
||||
# windows = System.get_window_info()
|
||||
# if any(emulator_path in _ for _ in windows):
|
||||
# try:
|
||||
# pyautogui.hotkey(*boss_key)
|
||||
# except pyautogui.FailSafeException as e:
|
||||
# 执行日志记录,暂时缺省
|
||||
logger.debug(self.config.running_list)
|
||||
logger.debug(Config.running_list)
|
||||
|
||||
def set_last_time(self):
|
||||
"""设置上次运行时间"""
|
||||
@@ -108,12 +101,13 @@ class MainTimer(QWidget):
|
||||
|
||||
queue_list = []
|
||||
|
||||
if (self.config.app_path / "config/QueueConfig").exists():
|
||||
for json_file in (self.config.app_path / "config/QueueConfig").glob(
|
||||
"*.json"
|
||||
):
|
||||
if (Config.app_path / "config/QueueConfig").exists():
|
||||
for json_file in (Config.app_path / "config/QueueConfig").glob("*.json"):
|
||||
with json_file.open("r", encoding="utf-8") as f:
|
||||
info = json.load(f)
|
||||
queue_list.append([json_file.stem, info])
|
||||
|
||||
return queue_list
|
||||
|
||||
|
||||
Main_timer = MainTimer()
|
||||
|
||||
@@ -35,8 +35,8 @@ import time
|
||||
from pathlib import Path
|
||||
from typing import List, Dict, Union
|
||||
|
||||
from app.core import AppConfig
|
||||
from app.services import Notification
|
||||
from app.core import Config
|
||||
from app.services import Notify
|
||||
|
||||
|
||||
class MaaManager(QtCore.QObject):
|
||||
@@ -56,15 +56,11 @@ class MaaManager(QtCore.QObject):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
config: AppConfig,
|
||||
notify: Notification,
|
||||
mode: str,
|
||||
config_path: Path,
|
||||
):
|
||||
super(MaaManager, self).__init__()
|
||||
|
||||
self.config = config
|
||||
self.notify = notify
|
||||
self.mode = mode
|
||||
self.config_path = config_path
|
||||
|
||||
@@ -90,8 +86,8 @@ class MaaManager(QtCore.QObject):
|
||||
self.maa_exe_path = self.maa_root_path / "MAA.exe"
|
||||
self.boss_key = [
|
||||
_.strip().lower()
|
||||
for _ in self.config.global_config.get(
|
||||
self.config.global_config.function_BossKey
|
||||
for _ in Config.global_config.get(
|
||||
Config.global_config.function_BossKey
|
||||
).split("+")
|
||||
]
|
||||
|
||||
@@ -109,6 +105,12 @@ class MaaManager(QtCore.QObject):
|
||||
self.push_info_bar.emit(
|
||||
"error", "启动MAA代理进程失败", "您还未正确配置MAA路径!", -1
|
||||
)
|
||||
self.accomplish.emit(
|
||||
{
|
||||
"Time": begin_time,
|
||||
"History": "由于未正确配置MAA路径,MAA代理进程中止",
|
||||
}
|
||||
)
|
||||
return None
|
||||
|
||||
# 整理用户数据,筛选需代理的用户
|
||||
@@ -176,7 +178,7 @@ class MaaManager(QtCore.QObject):
|
||||
creationflags=subprocess.CREATE_NO_WINDOW,
|
||||
)
|
||||
# 添加静默进程数量标记
|
||||
self.config.if_silence_needed += 1
|
||||
Config.if_silence_needed += 1
|
||||
# 记录是否超时的标记
|
||||
self.if_time_out = False
|
||||
|
||||
@@ -232,7 +234,7 @@ class MaaManager(QtCore.QObject):
|
||||
"检测到MAA进程完成代理任务\n正在等待相关程序结束\n请等待10s"
|
||||
)
|
||||
# 移除静默进程数量标记
|
||||
self.config.if_silence_needed -= 1
|
||||
Config.if_silence_needed -= 1
|
||||
for _ in range(10):
|
||||
if self.isInterruptionRequested:
|
||||
break
|
||||
@@ -253,9 +255,9 @@ class MaaManager(QtCore.QObject):
|
||||
)
|
||||
killprocess.wait()
|
||||
# 移除静默进程数量标记
|
||||
self.config.if_silence_needed -= 1
|
||||
Config.if_silence_needed -= 1
|
||||
# 推送异常通知
|
||||
self.notify.push_notification(
|
||||
Notify.push_notification(
|
||||
"用户自动代理出现异常!",
|
||||
f"用户 {user[0].replace("_", " 今天的")}的{mode_book[j][5:7]}部分出现一次异常",
|
||||
f"{user[0].replace("_", " ")}的{mode_book[j][5:7]}出现异常",
|
||||
@@ -273,7 +275,7 @@ class MaaManager(QtCore.QObject):
|
||||
self.data[user[2]][3] -= 1
|
||||
self.data[user[2]][14] += 1
|
||||
user[1] = "完成"
|
||||
self.notify.push_notification(
|
||||
Notify.push_notification(
|
||||
"成功完成一个自动代理任务!",
|
||||
f"已完成用户 {user[0].replace("_", " 今天的")}任务",
|
||||
f"已完成 {user[0].replace("_", " 的")}",
|
||||
@@ -491,21 +493,19 @@ class MaaManager(QtCore.QObject):
|
||||
)
|
||||
|
||||
# 推送代理结果通知
|
||||
self.notify.push_notification(
|
||||
Notify.push_notification(
|
||||
f"{self.mode[2:4]}任务已完成!",
|
||||
f"已完成用户数:{len(over_index)},未完成用户数:{len(error_index) + len(wait_index)}",
|
||||
f"已完成用户数:{len(over_index)},未完成用户数:{len(error_index) + len(wait_index)}",
|
||||
10,
|
||||
)
|
||||
if not self.config.global_config.get(
|
||||
self.config.global_config.notify_IfSendErrorOnly
|
||||
if not Config.global_config.get(
|
||||
Config.global_config.notify_IfSendErrorOnly
|
||||
) or (
|
||||
self.config.global_config.get(
|
||||
self.config.global_config.notify_IfSendErrorOnly
|
||||
)
|
||||
Config.global_config.get(Config.global_config.notify_IfSendErrorOnly)
|
||||
and len(error_index) + len(wait_index) != 0
|
||||
):
|
||||
self.notify.send_mail(
|
||||
Notify.send_mail(
|
||||
f"{self.mode[:4]}任务报告",
|
||||
f"{end_log}\n\nAUTO_MAA 敬上\n\n我们根据您在 AUTO_MAA 中的设置发送了这封电子邮件,本邮件无需回复\n",
|
||||
)
|
||||
@@ -643,7 +643,7 @@ class MaaManager(QtCore.QObject):
|
||||
"Start.OpenEmulatorAfterLaunch"
|
||||
] = "True" # 启动MAA后自动开启模拟器
|
||||
|
||||
if self.config.if_silence_needed > 0:
|
||||
if Config.if_silence_needed > 0:
|
||||
data["Global"]["Start.MinimizeDirectly"] = "True" # 启动MAA后直接最小化
|
||||
data["Global"]["GUI.UseTray"] = "True" # 显示托盘图标
|
||||
data["Global"]["GUI.MinimizeToTray"] = "True" # 最小化时隐藏至托盘
|
||||
@@ -920,7 +920,7 @@ class MaaManager(QtCore.QObject):
|
||||
"Start.OpenEmulatorAfterLaunch"
|
||||
] = "False" # 启动MAA后自动开启模拟器
|
||||
|
||||
if self.config.if_silence_needed > 0:
|
||||
if Config.if_silence_needed > 0:
|
||||
data["Global"][
|
||||
"Start.MinimizeDirectly"
|
||||
] = "False" # 启动MAA后直接最小化
|
||||
@@ -963,7 +963,7 @@ class MaaManager(QtCore.QObject):
|
||||
|
||||
# 覆写配置文件
|
||||
with self.maa_set_path.open(mode="w", encoding="utf-8") as f:
|
||||
json.dump(data, f, indent=4)
|
||||
json.dump(data, f, ensure_ascii=False, indent=4)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
Binary file not shown.
@@ -29,8 +29,8 @@ __version__ = "4.2.0"
|
||||
__author__ = "DLmaster361 <DLmaster_361@163.com>"
|
||||
__license__ = "GPL-3.0 license"
|
||||
|
||||
from .notification import Notification
|
||||
from .security import CryptoHandler
|
||||
from .system import SystemHandler
|
||||
from .notification import Notify
|
||||
from .security import Crypto
|
||||
from .system import System
|
||||
|
||||
__all__ = ["Notification", "CryptoHandler", "SystemHandler"]
|
||||
__all__ = ["Notify", "Crypto", "System"]
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -30,27 +30,22 @@ import smtplib
|
||||
from email.mime.text import MIMEText
|
||||
from email.header import Header
|
||||
from email.utils import formataddr
|
||||
import os
|
||||
|
||||
from app.core import AppConfig
|
||||
from app.core import Config
|
||||
|
||||
|
||||
class Notification:
|
||||
|
||||
def __init__(self, config: AppConfig):
|
||||
|
||||
self.config = config
|
||||
|
||||
def push_notification(self, title, message, ticker, t):
|
||||
"""推送系统通知"""
|
||||
|
||||
if self.config.global_config.get(self.config.global_config.notify_IfPushPlyer):
|
||||
if Config.global_config.get(Config.global_config.notify_IfPushPlyer):
|
||||
|
||||
notification.notify(
|
||||
title=title,
|
||||
message=message,
|
||||
app_name="AUTO_MAA",
|
||||
app_icon=str(self.config.app_path / "resources/icons/AUTO_MAA.ico"),
|
||||
app_icon=str(Config.app_path / "resources/icons/AUTO_MAA.ico"),
|
||||
timeout=t,
|
||||
ticker=ticker,
|
||||
toast=True,
|
||||
@@ -64,7 +59,7 @@ class Notification:
|
||||
# 声明:此邮箱为AUTO_MAA项目组资产,未经授权不得私自使用
|
||||
# 注意:此声明注释只有使用者更换发信邮箱时才能删除,本条规则优先级高于GPLv3
|
||||
|
||||
if self.config.global_config.get(self.config.global_config.notify_IfSendMail):
|
||||
if Config.global_config.get(Config.global_config.notify_IfSendMail):
|
||||
|
||||
# 第三方 SMTP 服务配置
|
||||
mail_host = "smtp.163.com" # 设置服务器
|
||||
@@ -82,9 +77,7 @@ class Notification:
|
||||
message["To"] = formataddr(
|
||||
(
|
||||
Header("AUTO_MAA用户", "utf-8").encode(),
|
||||
self.config.global_config.get(
|
||||
self.config.global_config.notify_MailAddress
|
||||
),
|
||||
Config.global_config.get(Config.global_config.notify_MailAddress),
|
||||
)
|
||||
) # 收件人显示的名字
|
||||
message["Subject"] = Header(title, "utf-8")
|
||||
@@ -94,9 +87,7 @@ class Notification:
|
||||
smtpObj.login(mail_sender, mail_key)
|
||||
smtpObj.sendmail(
|
||||
mail_sender,
|
||||
self.config.global_config.get(
|
||||
self.config.global_config.notify_MailAddress
|
||||
),
|
||||
Config.global_config.get(Config.global_config.notify_MailAddress),
|
||||
message.as_string(),
|
||||
)
|
||||
return True
|
||||
@@ -104,3 +95,6 @@ class Notification:
|
||||
return f"发送邮件时出错:\n{e}"
|
||||
finally:
|
||||
smtpObj.quit()
|
||||
|
||||
|
||||
Notify = Notification()
|
||||
|
||||
@@ -25,7 +25,6 @@ v4.2
|
||||
作者:DLmaster_361
|
||||
"""
|
||||
|
||||
import os
|
||||
import hashlib
|
||||
import random
|
||||
import secrets
|
||||
@@ -34,37 +33,33 @@ from Crypto.PublicKey import RSA
|
||||
from Crypto.Cipher import PKCS1_OAEP
|
||||
from Crypto.Util.Padding import pad, unpad
|
||||
|
||||
from app.core import AppConfig
|
||||
from app.core import Config
|
||||
|
||||
|
||||
class CryptoHandler:
|
||||
|
||||
def __init__(self, config: AppConfig):
|
||||
|
||||
self.config = config
|
||||
|
||||
def get_PASSWORD(self, PASSWORD: str) -> None:
|
||||
"""配置管理密钥"""
|
||||
|
||||
# 生成目录
|
||||
self.config.key_path.mkdir(parents=True, exist_ok=True)
|
||||
Config.key_path.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# 生成RSA密钥对
|
||||
key = RSA.generate(2048)
|
||||
public_key_local = key.publickey()
|
||||
private_key = key
|
||||
# 保存RSA公钥
|
||||
(self.config.app_path / "data/key/public_key.pem").write_bytes(
|
||||
(Config.app_path / "data/key/public_key.pem").write_bytes(
|
||||
public_key_local.exportKey()
|
||||
)
|
||||
# 生成密钥转换与校验随机盐
|
||||
PASSWORD_salt = secrets.token_hex(random.randint(32, 1024))
|
||||
(self.config.app_path / "data/key/PASSWORDsalt.txt").write_text(
|
||||
(Config.app_path / "data/key/PASSWORDsalt.txt").write_text(
|
||||
PASSWORD_salt,
|
||||
encoding="utf-8",
|
||||
)
|
||||
verify_salt = secrets.token_hex(random.randint(32, 1024))
|
||||
(self.config.app_path / "data/key/verifysalt.txt").write_text(
|
||||
(Config.app_path / "data/key/verifysalt.txt").write_text(
|
||||
verify_salt,
|
||||
encoding="utf-8",
|
||||
)
|
||||
@@ -76,22 +71,20 @@ class CryptoHandler:
|
||||
AES_password_verify = hashlib.sha256(
|
||||
AES_password + verify_salt.encode("utf-8")
|
||||
).digest()
|
||||
(self.config.app_path / "data/key/AES_password_verify.bin").write_bytes(
|
||||
(Config.app_path / "data/key/AES_password_verify.bin").write_bytes(
|
||||
AES_password_verify
|
||||
)
|
||||
# AES-256加密RSA私钥并保存密文
|
||||
AES_key = AES.new(AES_password, AES.MODE_ECB)
|
||||
private_key_local = AES_key.encrypt(pad(private_key.exportKey(), 32))
|
||||
(self.config.app_path / "data/key/private_key.bin").write_bytes(
|
||||
private_key_local
|
||||
)
|
||||
(Config.app_path / "data/key/private_key.bin").write_bytes(private_key_local)
|
||||
|
||||
def encryptx(self, note: str) -> bytes:
|
||||
"""加密数据"""
|
||||
|
||||
# 读取RSA公钥
|
||||
public_key_local = RSA.import_key(
|
||||
(self.config.app_path / "data/key/public_key.pem").read_bytes()
|
||||
(Config.app_path / "data/key/public_key.pem").read_bytes()
|
||||
)
|
||||
# 使用RSA公钥对数据进行加密
|
||||
cipher = PKCS1_OAEP.new(public_key_local)
|
||||
@@ -103,22 +96,20 @@ class CryptoHandler:
|
||||
|
||||
# 读入RSA私钥密文、盐与校验哈希值
|
||||
private_key_local = (
|
||||
(self.config.app_path / "data/key/private_key.bin").read_bytes().strip()
|
||||
(Config.app_path / "data/key/private_key.bin").read_bytes().strip()
|
||||
)
|
||||
PASSWORD_salt = (
|
||||
(self.config.app_path / "data/key/PASSWORDsalt.txt")
|
||||
(Config.app_path / "data/key/PASSWORDsalt.txt")
|
||||
.read_text(encoding="utf-8")
|
||||
.strip()
|
||||
)
|
||||
verify_salt = (
|
||||
(self.config.app_path / "data/key/verifysalt.txt")
|
||||
(Config.app_path / "data/key/verifysalt.txt")
|
||||
.read_text(encoding="utf-8")
|
||||
.strip()
|
||||
)
|
||||
AES_password_verify = (
|
||||
(self.config.app_path / "data/key/AES_password_verify.bin")
|
||||
.read_bytes()
|
||||
.strip()
|
||||
(Config.app_path / "data/key/AES_password_verify.bin").read_bytes().strip()
|
||||
)
|
||||
# 将管理密钥转化为AES-256密钥并验证
|
||||
AES_password = hashlib.sha256(
|
||||
@@ -149,7 +140,7 @@ class CryptoHandler:
|
||||
# 使用新管理密钥重新加密
|
||||
self.get_PASSWORD(PASSWORD_new)
|
||||
for i in range(len(data)):
|
||||
self.config.cur.execute(
|
||||
Config.cur.execute(
|
||||
"UPDATE adminx SET password = ? WHERE mode = ? AND uid = ?",
|
||||
(
|
||||
self.encryptx(new_data[i]),
|
||||
@@ -157,7 +148,7 @@ class CryptoHandler:
|
||||
data[i][16],
|
||||
),
|
||||
)
|
||||
self.config.db.commit(),
|
||||
Config.db.commit(),
|
||||
new_data[i] = None
|
||||
del new_data
|
||||
|
||||
@@ -165,3 +156,6 @@ class CryptoHandler:
|
||||
"""验证管理密钥"""
|
||||
|
||||
return bool(self.decryptx(self.encryptx(""), PASSWORD) != "管理密钥错误")
|
||||
|
||||
|
||||
Crypto = CryptoHandler()
|
||||
|
||||
@@ -31,7 +31,7 @@ import win32process
|
||||
import winreg
|
||||
import psutil
|
||||
|
||||
from app.core import AppConfig
|
||||
from app.core import Config
|
||||
|
||||
|
||||
class SystemHandler:
|
||||
@@ -39,9 +39,7 @@ class SystemHandler:
|
||||
ES_CONTINUOUS = 0x80000000
|
||||
ES_SYSTEM_REQUIRED = 0x00000001
|
||||
|
||||
def __init__(self, config: AppConfig):
|
||||
|
||||
self.config = config
|
||||
def __init__(self):
|
||||
|
||||
self.set_Sleep()
|
||||
self.set_SelfStart()
|
||||
@@ -49,9 +47,7 @@ class SystemHandler:
|
||||
def set_Sleep(self):
|
||||
"""同步系统休眠状态"""
|
||||
|
||||
if self.config.global_config.get(
|
||||
self.config.global_config.function_IfAllowSleep
|
||||
):
|
||||
if Config.global_config.get(Config.global_config.function_IfAllowSleep):
|
||||
# 设置系统电源状态
|
||||
ctypes.windll.kernel32.SetThreadExecutionState(
|
||||
self.ES_CONTINUOUS | self.ES_SYSTEM_REQUIRED
|
||||
@@ -64,7 +60,7 @@ class SystemHandler:
|
||||
"""同步开机自启"""
|
||||
|
||||
if (
|
||||
self.config.global_config.get(self.config.global_config.start_IfSelfStart)
|
||||
Config.global_config.get(Config.global_config.start_IfSelfStart)
|
||||
and not self.is_startup()
|
||||
):
|
||||
key = winreg.OpenKey(
|
||||
@@ -73,14 +69,10 @@ class SystemHandler:
|
||||
winreg.KEY_SET_VALUE,
|
||||
winreg.KEY_ALL_ACCESS | winreg.KEY_WRITE | winreg.KEY_CREATE_SUB_KEY,
|
||||
)
|
||||
winreg.SetValueEx(
|
||||
key, "AUTO_MAA", 0, winreg.REG_SZ, self.config.app_path_sys
|
||||
)
|
||||
winreg.SetValueEx(key, "AUTO_MAA", 0, winreg.REG_SZ, Config.app_path_sys)
|
||||
winreg.CloseKey(key)
|
||||
elif (
|
||||
not self.config.global_config.get(
|
||||
self.config.global_config.start_IfSelfStart
|
||||
)
|
||||
not Config.global_config.get(Config.global_config.start_IfSelfStart)
|
||||
and self.is_startup()
|
||||
):
|
||||
key = winreg.OpenKey(
|
||||
@@ -123,3 +115,6 @@ class SystemHandler:
|
||||
window_info = []
|
||||
win32gui.EnumWindows(callback, window_info)
|
||||
return window_info
|
||||
|
||||
|
||||
System = SystemHandler()
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -60,18 +60,16 @@ import shutil
|
||||
|
||||
uiLoader = QUiLoader()
|
||||
|
||||
from app.core import AppConfig, TaskManager, Task, MainInfoBar
|
||||
from app.services import Notification
|
||||
from app.core import Config, Task_manager, Task, MainInfoBar
|
||||
from app.services import Notify
|
||||
|
||||
|
||||
class DispatchCenter(QWidget):
|
||||
|
||||
def __init__(self, config: AppConfig, task_manager: TaskManager, parent=None):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.setObjectName("调度中枢")
|
||||
self.config = config
|
||||
self.task_manager = task_manager
|
||||
|
||||
self.pivot = Pivot(self)
|
||||
self.stackedWidget = QStackedWidget(self)
|
||||
@@ -79,7 +77,7 @@ class DispatchCenter(QWidget):
|
||||
|
||||
self.script_list: Dict[str, DispatchBox] = {}
|
||||
|
||||
dispatch_box = DispatchBox(self.config, "主调度台", self)
|
||||
dispatch_box = DispatchBox("主调度台", self)
|
||||
self.script_list["主调度台"] = dispatch_box
|
||||
self.stackedWidget.addWidget(self.script_list["主调度台"])
|
||||
self.pivot.addItem(
|
||||
@@ -101,10 +99,10 @@ class DispatchCenter(QWidget):
|
||||
def add_board(self, task: Task) -> None:
|
||||
"""添加一个调度台界面"""
|
||||
|
||||
dispatch_box = DispatchBox(self.config, task.name, self)
|
||||
dispatch_box = DispatchBox(task.name, self)
|
||||
|
||||
dispatch_box.top_bar.button.clicked.connect(
|
||||
lambda: self.task_manager.stop_task(task.name)
|
||||
lambda: Task_manager.stop_task(task.name)
|
||||
)
|
||||
|
||||
task.create_task_list.connect(dispatch_box.info.task.create_task)
|
||||
@@ -128,19 +126,54 @@ class DispatchCenter(QWidget):
|
||||
self.script_list[name].deleteLater()
|
||||
self.pivot.removeWidget(name)
|
||||
|
||||
def connect_main_board(self, task: Task) -> None:
|
||||
"""连接主调度台"""
|
||||
|
||||
self.script_list["主调度台"].top_bar.button.clicked.disconnect()
|
||||
self.script_list["主调度台"].top_bar.button.setText("中止任务")
|
||||
self.script_list["主调度台"].top_bar.button.clicked.connect(
|
||||
lambda: Task_manager.stop_task(task.name)
|
||||
)
|
||||
task.create_task_list.connect(
|
||||
self.script_list["主调度台"].info.task.create_task
|
||||
)
|
||||
task.create_user_list.connect(
|
||||
self.script_list["主调度台"].info.user.create_user
|
||||
)
|
||||
task.update_task_list.connect(
|
||||
self.script_list["主调度台"].info.task.update_task
|
||||
)
|
||||
task.update_user_list.connect(
|
||||
self.script_list["主调度台"].info.user.update_user
|
||||
)
|
||||
task.update_log_text.connect(
|
||||
self.script_list["主调度台"].info.log_text.text.setText
|
||||
)
|
||||
task.accomplish.connect(lambda: self.disconnect_main_board(task.name))
|
||||
|
||||
def disconnect_main_board(self, name: str) -> None:
|
||||
"""断开主调度台"""
|
||||
|
||||
self.script_list["主调度台"].top_bar.button.clicked.disconnect()
|
||||
self.script_list["主调度台"].top_bar.button.setText("开始任务")
|
||||
self.script_list["主调度台"].top_bar.button.clicked.connect(
|
||||
self.script_list["主调度台"].top_bar.start_task
|
||||
)
|
||||
self.script_list["主调度台"].info.log_text.text.setText(
|
||||
Config.get_history(name)["History"]
|
||||
)
|
||||
|
||||
def update_top_bar(self):
|
||||
"""更新顶栏"""
|
||||
|
||||
list = []
|
||||
|
||||
if (self.config.app_path / "config/QueueConfig").exists():
|
||||
for json_file in (self.config.app_path / "config/QueueConfig").glob(
|
||||
"*.json"
|
||||
):
|
||||
if (Config.app_path / "config/QueueConfig").exists():
|
||||
for json_file in (Config.app_path / "config/QueueConfig").glob("*.json"):
|
||||
list.append(f"队列 - {json_file.stem}")
|
||||
|
||||
if (self.config.app_path / "config/MaaConfig").exists():
|
||||
for subdir in (self.config.app_path / "config/MaaConfig").iterdir():
|
||||
if (Config.app_path / "config/MaaConfig").exists():
|
||||
for subdir in (Config.app_path / "config/MaaConfig").iterdir():
|
||||
if subdir.is_dir():
|
||||
list.append(f"实例 - Maa - {subdir.name}")
|
||||
|
||||
@@ -150,13 +183,11 @@ class DispatchCenter(QWidget):
|
||||
|
||||
class DispatchBox(QWidget):
|
||||
|
||||
def __init__(self, config: AppConfig, name: str, parent=None):
|
||||
def __init__(self, name: str, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.setObjectName(name)
|
||||
|
||||
self.config = config
|
||||
|
||||
layout = QVBoxLayout()
|
||||
|
||||
scrollArea = ScrollArea()
|
||||
@@ -195,6 +226,7 @@ class DispatchBox(QWidget):
|
||||
self.mode.setPlaceholderText("请选择调度模式")
|
||||
|
||||
self.button = PushButton("开始任务")
|
||||
self.button.clicked.connect(self.start_task)
|
||||
|
||||
Layout.addWidget(self.object)
|
||||
Layout.addWidget(self.mode)
|
||||
@@ -210,6 +242,40 @@ class DispatchBox(QWidget):
|
||||
Layout.addStretch(1)
|
||||
Layout.addWidget(self.button)
|
||||
|
||||
def start_task(self):
|
||||
"""开始任务"""
|
||||
|
||||
if self.object.currentIndex() == -1:
|
||||
logger.warning("未选择调度对象")
|
||||
MainInfoBar.push_info_bar(
|
||||
"warning", "未选择调度对象", "请选择后再开始任务", 5000
|
||||
)
|
||||
return None
|
||||
|
||||
if self.mode.currentIndex() == -1:
|
||||
logger.warning("未选择调度模式")
|
||||
MainInfoBar.push_info_bar(
|
||||
"warning", "未选择调度模式", "请选择后再开始任务", 5000
|
||||
)
|
||||
return None
|
||||
|
||||
name = self.object.currentText().split(" - ")[1]
|
||||
|
||||
if name in Config.running_list:
|
||||
logger.warning(f"任务已存在:{name}")
|
||||
MainInfoBar.push_info_bar("warning", "任务已存在", name, 5000)
|
||||
return None
|
||||
|
||||
if self.object.currentText().split(" - ")[0] == "队列":
|
||||
|
||||
with (Config.app_path / f"config/QueueConfig/{name}.json").open(
|
||||
mode="r", encoding="utf-8"
|
||||
) as f:
|
||||
info = json.load(f)
|
||||
|
||||
logger.info(f"用户添加任务:{name}")
|
||||
Task_manager.add_task("主窗口", name, info)
|
||||
|
||||
class DispatchInfoCard(HeaderCardWidget):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
|
||||
138
app/ui/else.py
138
app/ui/else.py
@@ -6,9 +6,9 @@ class Main(QWidget):
|
||||
def __init__(self, config: AppConfig, notify: Notification, crypto: CryptoHandler):
|
||||
super().__init__()
|
||||
|
||||
self.config = config
|
||||
self.notify = notify
|
||||
self.crypto = crypto
|
||||
Config = config
|
||||
Notify = notify
|
||||
Crypto = crypto
|
||||
|
||||
|
||||
|
||||
@@ -23,9 +23,9 @@ class Main(QWidget):
|
||||
# uiLoader.registerCustomWidget(BodyLabel)
|
||||
|
||||
# # 导入ui配置
|
||||
# self.ui = uiLoader.load(self.config.app_path / "resources/gui/main.ui")
|
||||
# self.ui = uiLoader.load(Config.app_path / "resources/gui/main.ui")
|
||||
# self.ui.setWindowIcon(
|
||||
# QIcon(str(self.config.app_path / "resources/icons/AUTO_MAA.ico"))
|
||||
# QIcon(str(Config.app_path / "resources/icons/AUTO_MAA.ico"))
|
||||
# )
|
||||
|
||||
# # 初始化控件
|
||||
@@ -176,12 +176,12 @@ class Main(QWidget):
|
||||
# self.change_password.clicked.connect(self.change_PASSWORD)
|
||||
|
||||
# 初始化线程
|
||||
self.MaaManager = MaaManager(self.config)
|
||||
self.MaaManager = MaaManager(Config)
|
||||
self.MaaManager.question.connect(lambda: self.read("question_runner"))
|
||||
self.MaaManager.update_gui.connect(self.update_board)
|
||||
self.MaaManager.update_user_info.connect(self.change_user_info)
|
||||
self.MaaManager.push_notification.connect(self.notify.push_notification)
|
||||
self.MaaManager.send_mail.connect(self.notify.send_mail)
|
||||
self.MaaManager.push_notification.connect(Notify.push_notification)
|
||||
self.MaaManager.send_mail.connect(Notify.send_mail)
|
||||
self.MaaManager.accomplish.connect(lambda: self.maa_ender("自动代理_结束"))
|
||||
self.MaaManager.get_json.connect(self.get_maa_config)
|
||||
self.MaaManager.set_silence.connect(self.switch_silence)
|
||||
@@ -198,79 +198,79 @@ class Main(QWidget):
|
||||
# self.update_config()
|
||||
|
||||
# 启动后直接开始代理
|
||||
if self.config.content["Default"]["SelfSet.IfProxyDirectly"] == "True":
|
||||
if Config.content["Default"]["SelfSet.IfProxyDirectly"] == "True":
|
||||
self.maa_starter("自动代理")
|
||||
|
||||
|
||||
|
||||
# def update_config(self):
|
||||
# """将self.config中的程序配置同步至GUI界面"""
|
||||
# """将Config中的程序配置同步至GUI界面"""
|
||||
|
||||
# # 阻止GUI程序配置被立即读入程序形成死循环
|
||||
# self.if_update_config = False
|
||||
|
||||
# self.main_tab.setCurrentIndex(
|
||||
# self.config.content["Default"]["SelfSet.MainIndex"]
|
||||
# Config.content["Default"]["SelfSet.MainIndex"]
|
||||
# )
|
||||
|
||||
# self.maa_path.setText(str(Path(self.config.content["Default"]["MaaSet.path"])))
|
||||
# self.routine.setValue(self.config.content["Default"]["TimeLimit.routine"])
|
||||
# self.maa_path.setText(str(Path(Config.content["Default"]["MaaSet.path"])))
|
||||
# self.routine.setValue(Config.content["Default"]["TimeLimit.routine"])
|
||||
# self.annihilation.setValue(
|
||||
# self.config.content["Default"]["TimeLimit.annihilation"]
|
||||
# Config.content["Default"]["TimeLimit.annihilation"]
|
||||
# )
|
||||
# self.num.setValue(self.config.content["Default"]["TimesLimit.run"])
|
||||
# self.mail_address.setText(self.config.content["Default"]["SelfSet.MailAddress"])
|
||||
# self.boss_key.setText(self.config.content["Default"]["SelfSet.BossKey"])
|
||||
# self.num.setValue(Config.content["Default"]["TimesLimit.run"])
|
||||
# self.mail_address.setText(Config.content["Default"]["SelfSet.MailAddress"])
|
||||
# self.boss_key.setText(Config.content["Default"]["SelfSet.BossKey"])
|
||||
|
||||
# self.if_self_start.setChecked(
|
||||
# bool(self.config.content["Default"]["SelfSet.IfSelfStart"] == "True")
|
||||
# bool(Config.content["Default"]["SelfSet.IfSelfStart"] == "True")
|
||||
# )
|
||||
|
||||
# self.if_sleep.setChecked(
|
||||
# bool(self.config.content["Default"]["SelfSet.IfAllowSleep"] == "True")
|
||||
# bool(Config.content["Default"]["SelfSet.IfAllowSleep"] == "True")
|
||||
# )
|
||||
|
||||
# self.if_proxy_directly.setChecked(
|
||||
# bool(self.config.content["Default"]["SelfSet.IfProxyDirectly"] == "True")
|
||||
# bool(Config.content["Default"]["SelfSet.IfProxyDirectly"] == "True")
|
||||
# )
|
||||
|
||||
# self.if_send_mail.setChecked(
|
||||
# bool(self.config.content["Default"]["SelfSet.IfSendMail"] == "True")
|
||||
# bool(Config.content["Default"]["SelfSet.IfSendMail"] == "True")
|
||||
# )
|
||||
|
||||
# self.mail_address.setVisible(
|
||||
# bool(self.config.content["Default"]["SelfSet.IfSendMail"] == "True")
|
||||
# bool(Config.content["Default"]["SelfSet.IfSendMail"] == "True")
|
||||
# )
|
||||
|
||||
# self.if_send_error_only.setChecked(
|
||||
# bool(
|
||||
# self.config.content["Default"]["SelfSet.IfSendMail.OnlyError"] == "True"
|
||||
# Config.content["Default"]["SelfSet.IfSendMail.OnlyError"] == "True"
|
||||
# )
|
||||
# )
|
||||
|
||||
# self.if_send_error_only.setVisible(
|
||||
# bool(self.config.content["Default"]["SelfSet.IfSendMail"] == "True")
|
||||
# bool(Config.content["Default"]["SelfSet.IfSendMail"] == "True")
|
||||
# )
|
||||
|
||||
# self.if_silence.setChecked(
|
||||
# bool(self.config.content["Default"]["SelfSet.IfSilence"] == "True")
|
||||
# bool(Config.content["Default"]["SelfSet.IfSilence"] == "True")
|
||||
# )
|
||||
|
||||
# self.boss_key.setVisible(
|
||||
# bool(self.config.content["Default"]["SelfSet.IfSilence"] == "True")
|
||||
# bool(Config.content["Default"]["SelfSet.IfSilence"] == "True")
|
||||
# )
|
||||
|
||||
# self.if_to_tray.setChecked(
|
||||
# bool(self.config.content["Default"]["SelfSet.IfToTray"] == "True")
|
||||
# bool(Config.content["Default"]["SelfSet.IfToTray"] == "True")
|
||||
# )
|
||||
|
||||
# for i in range(10):
|
||||
# self.start_time[i][0].setChecked(
|
||||
# bool(self.config.content["Default"][f"TimeSet.set{i + 1}"] == "True")
|
||||
# bool(Config.content["Default"][f"TimeSet.set{i + 1}"] == "True")
|
||||
# )
|
||||
# time = QtCore.QTime(
|
||||
# int(self.config.content["Default"][f"TimeSet.run{i + 1}"][:2]),
|
||||
# int(self.config.content["Default"][f"TimeSet.run{i + 1}"][3:]),
|
||||
# int(Config.content["Default"][f"TimeSet.run{i + 1}"][:2]),
|
||||
# int(Config.content["Default"][f"TimeSet.run{i + 1}"][3:]),
|
||||
# )
|
||||
# self.start_time[i][1].setTime(time)
|
||||
# self.if_update_config = True
|
||||
@@ -281,20 +281,20 @@ class Main(QWidget):
|
||||
self.update_user_info("normal")
|
||||
|
||||
def change_config(self):
|
||||
"""将GUI中发生修改的程序配置同步至self.config变量"""
|
||||
"""将GUI中发生修改的程序配置同步至Config变量"""
|
||||
|
||||
# 验证能否写入self.config变量
|
||||
# 验证能否写入Config变量
|
||||
if not self.if_update_config:
|
||||
return None
|
||||
|
||||
# 验证MAA路径
|
||||
if Path(self.config.content["Default"]["MaaSet.path"]) != Path(
|
||||
if Path(Config.content["Default"]["MaaSet.path"]) != Path(
|
||||
self.maa_path.text()
|
||||
):
|
||||
if (Path(self.maa_path.text()) / "MAA.exe").exists() and (
|
||||
Path(self.maa_path.text()) / "config/gui.json"
|
||||
).exists():
|
||||
self.config.content["Default"]["MaaSet.path"] = str(
|
||||
Config.content["Default"]["MaaSet.path"] = str(
|
||||
Path(self.maa_path.text())
|
||||
)
|
||||
self.get_maa_config(["Default"])
|
||||
@@ -307,62 +307,62 @@ class Main(QWidget):
|
||||
if choice.exec():
|
||||
pass
|
||||
|
||||
self.config.content["Default"][
|
||||
Config.content["Default"][
|
||||
"SelfSet.MainIndex"
|
||||
] = self.main_tab.currentIndex()
|
||||
self.config.content["Default"]["TimeLimit.routine"] = self.routine.value()
|
||||
self.config.content["Default"][
|
||||
Config.content["Default"]["TimeLimit.routine"] = self.routine.value()
|
||||
Config.content["Default"][
|
||||
"TimeLimit.annihilation"
|
||||
] = self.annihilation.value()
|
||||
self.config.content["Default"]["TimesLimit.run"] = self.num.value()
|
||||
self.config.content["Default"]["SelfSet.MailAddress"] = self.mail_address.text()
|
||||
self.config.content["Default"]["SelfSet.BossKey"] = self.boss_key.text()
|
||||
Config.content["Default"]["TimesLimit.run"] = self.num.value()
|
||||
Config.content["Default"]["SelfSet.MailAddress"] = self.mail_address.text()
|
||||
Config.content["Default"]["SelfSet.BossKey"] = self.boss_key.text()
|
||||
|
||||
if self.if_sleep.isChecked():
|
||||
self.config.content["Default"]["SelfSet.IfAllowSleep"] = "True"
|
||||
Config.content["Default"]["SelfSet.IfAllowSleep"] = "True"
|
||||
else:
|
||||
self.config.content["Default"]["SelfSet.IfAllowSleep"] = "False"
|
||||
Config.content["Default"]["SelfSet.IfAllowSleep"] = "False"
|
||||
|
||||
if self.if_self_start.isChecked():
|
||||
self.config.content["Default"]["SelfSet.IfSelfStart"] = "True"
|
||||
Config.content["Default"]["SelfSet.IfSelfStart"] = "True"
|
||||
else:
|
||||
self.config.content["Default"]["SelfSet.IfSelfStart"] = "False"
|
||||
Config.content["Default"]["SelfSet.IfSelfStart"] = "False"
|
||||
|
||||
if self.if_proxy_directly.isChecked():
|
||||
self.config.content["Default"]["SelfSet.IfProxyDirectly"] = "True"
|
||||
Config.content["Default"]["SelfSet.IfProxyDirectly"] = "True"
|
||||
else:
|
||||
self.config.content["Default"]["SelfSet.IfProxyDirectly"] = "False"
|
||||
Config.content["Default"]["SelfSet.IfProxyDirectly"] = "False"
|
||||
|
||||
if self.if_send_mail.isChecked():
|
||||
self.config.content["Default"]["SelfSet.IfSendMail"] = "True"
|
||||
Config.content["Default"]["SelfSet.IfSendMail"] = "True"
|
||||
else:
|
||||
self.config.content["Default"]["SelfSet.IfSendMail"] = "False"
|
||||
Config.content["Default"]["SelfSet.IfSendMail"] = "False"
|
||||
|
||||
if self.if_send_error_only.isChecked():
|
||||
self.config.content["Default"]["SelfSet.IfSendMail.OnlyError"] = "True"
|
||||
Config.content["Default"]["SelfSet.IfSendMail.OnlyError"] = "True"
|
||||
else:
|
||||
self.config.content["Default"]["SelfSet.IfSendMail.OnlyError"] = "False"
|
||||
Config.content["Default"]["SelfSet.IfSendMail.OnlyError"] = "False"
|
||||
|
||||
if self.if_silence.isChecked():
|
||||
self.config.content["Default"]["SelfSet.IfSilence"] = "True"
|
||||
Config.content["Default"]["SelfSet.IfSilence"] = "True"
|
||||
else:
|
||||
self.config.content["Default"]["SelfSet.IfSilence"] = "False"
|
||||
Config.content["Default"]["SelfSet.IfSilence"] = "False"
|
||||
|
||||
if self.if_to_tray.isChecked():
|
||||
self.config.content["Default"]["SelfSet.IfToTray"] = "True"
|
||||
Config.content["Default"]["SelfSet.IfToTray"] = "True"
|
||||
else:
|
||||
self.config.content["Default"]["SelfSet.IfToTray"] = "False"
|
||||
Config.content["Default"]["SelfSet.IfToTray"] = "False"
|
||||
|
||||
for i in range(10):
|
||||
if self.start_time[i][0].isChecked():
|
||||
self.config.content["Default"][f"TimeSet.set{i + 1}"] = "True"
|
||||
Config.content["Default"][f"TimeSet.set{i + 1}"] = "True"
|
||||
else:
|
||||
self.config.content["Default"][f"TimeSet.set{i + 1}"] = "False"
|
||||
Config.content["Default"][f"TimeSet.set{i + 1}"] = "False"
|
||||
time = self.start_time[i][1].getTime().toString("HH:mm")
|
||||
self.config.content["Default"][f"TimeSet.run{i + 1}"] = time
|
||||
Config.content["Default"][f"TimeSet.run{i + 1}"] = time
|
||||
|
||||
# 将配置信息同步至本地JSON文件
|
||||
self.config.save_config()
|
||||
Config.save_config()
|
||||
|
||||
# 同步程序配置至GUI
|
||||
self.update_config()
|
||||
@@ -374,22 +374,22 @@ class Main(QWidget):
|
||||
# 获取全局MAA配置文件
|
||||
if info == ["Default"]:
|
||||
shutil.copy(
|
||||
Path(self.config.content["Default"]["MaaSet.path"])
|
||||
Path(Config.content["Default"]["MaaSet.path"])
|
||||
/ "config/gui.json",
|
||||
self.config.app_path / "data/MAAconfig/Default",
|
||||
Config.app_path / "data/MAAconfig/Default",
|
||||
)
|
||||
# 获取基建配置文件
|
||||
|
||||
# 获取高级用户MAA配置文件
|
||||
elif info[2] in ["routine", "annihilation"]:
|
||||
(
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"data/MAAconfig/{self.user_mode_list[info[0]]}/{info[1]}/{info[2]}"
|
||||
).mkdir(parents=True, exist_ok=True)
|
||||
shutil.copy(
|
||||
Path(self.config.content["Default"]["MaaSet.path"])
|
||||
Path(Config.content["Default"]["MaaSet.path"])
|
||||
/ "config/gui.json",
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"data/MAAconfig/{self.user_mode_list[info[0]]}/{info[1]}/{info[2]}",
|
||||
)
|
||||
|
||||
@@ -425,10 +425,10 @@ class Main(QWidget):
|
||||
# 检查MAA路径是否可用
|
||||
if (
|
||||
not (
|
||||
Path(self.config.content["Default"]["MaaSet.path"]) / "MAA.exe"
|
||||
Path(Config.content["Default"]["MaaSet.path"]) / "MAA.exe"
|
||||
).exists()
|
||||
and (
|
||||
Path(self.config.content["Default"]["MaaSet.path"]) / "config/gui.json"
|
||||
Path(Config.content["Default"]["MaaSet.path"]) / "config/gui.json"
|
||||
).exists()
|
||||
):
|
||||
choice = MessageBox("错误", "您还未正确配置MAA路径!", self.ui)
|
||||
@@ -441,8 +441,8 @@ class Main(QWidget):
|
||||
|
||||
# 配置参数
|
||||
self.MaaManager.mode = mode
|
||||
self.config.cur.execute("SELECT * FROM adminx WHERE True")
|
||||
data = self.config.cur.fetchall()
|
||||
Config.cur.execute("SELECT * FROM adminx WHERE True")
|
||||
data = Config.cur.fetchall()
|
||||
self.MaaManager.data = [list(row) for row in data]
|
||||
|
||||
# 启动执行线程
|
||||
@@ -501,8 +501,8 @@ class Main(QWidget):
|
||||
elif "结束" in mode:
|
||||
|
||||
shutil.copy(
|
||||
self.config.app_path / "data/MAAconfig/Default/gui.json",
|
||||
Path(self.config.content["Default"]["MaaSet.path"]) / "config",
|
||||
Config.app_path / "data/MAAconfig/Default/gui.json",
|
||||
Path(Config.content["Default"]["MaaSet.path"]) / "config",
|
||||
)
|
||||
self.user_add.setEnabled(True)
|
||||
self.user_del.setEnabled(True)
|
||||
|
||||
@@ -47,8 +47,8 @@ from qfluentwidgets import (
|
||||
from PySide6.QtGui import QIcon, QCloseEvent
|
||||
from PySide6 import QtCore
|
||||
|
||||
from app.core import AppConfig, TaskManager, MainTimer, MainInfoBar
|
||||
from app.services import Notification, CryptoHandler, SystemHandler
|
||||
from app.core import Config, Task_manager, Main_timer, MainInfoBar
|
||||
from app.services import Notify, Crypto, System
|
||||
from .setting import Setting
|
||||
from .member_manager import MemberManager
|
||||
from .queue_manager import QueueManager
|
||||
@@ -57,23 +57,10 @@ from .dispatch_center import DispatchCenter
|
||||
|
||||
class AUTO_MAA(MSFluentWindow):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
config: AppConfig,
|
||||
notify: Notification,
|
||||
crypto: CryptoHandler,
|
||||
system: SystemHandler,
|
||||
):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
self.config = config
|
||||
self.notify = notify
|
||||
self.crypto = crypto
|
||||
self.system = system
|
||||
|
||||
self.setWindowIcon(
|
||||
QIcon(str(self.config.app_path / "resources/icons/AUTO_MAA.ico"))
|
||||
)
|
||||
self.setWindowIcon(QIcon(str(Config.app_path / "resources/icons/AUTO_MAA.ico")))
|
||||
self.setWindowTitle("AUTO_MAA")
|
||||
|
||||
setTheme(Theme.AUTO)
|
||||
@@ -83,14 +70,11 @@ class AUTO_MAA(MSFluentWindow):
|
||||
|
||||
MainInfoBar.parent = self
|
||||
|
||||
self.task_manager = TaskManager(self.config, self.notify)
|
||||
self.main_timer = MainTimer(self.config, self.system, self.task_manager, self)
|
||||
|
||||
# 创建主窗口
|
||||
self.setting = Setting(self.config, self.notify, self.crypto, self.system, self)
|
||||
self.member_manager = MemberManager(self.config, self.notify, self.crypto, self)
|
||||
self.queue_manager = QueueManager(self.config, self.notify, self)
|
||||
self.dispatch_center = DispatchCenter(self.config, self.task_manager, self)
|
||||
self.setting = Setting(self)
|
||||
self.member_manager = MemberManager(self)
|
||||
self.queue_manager = QueueManager(self)
|
||||
self.dispatch_center = DispatchCenter(self)
|
||||
|
||||
self.addSubInterface(
|
||||
self.setting,
|
||||
@@ -141,7 +125,7 @@ class AUTO_MAA(MSFluentWindow):
|
||||
|
||||
# 创建系统托盘及其菜单
|
||||
self.tray = QSystemTrayIcon(
|
||||
QIcon(str(self.config.app_path / "resources/icons/AUTO_MAA.ico")),
|
||||
QIcon(str(Config.app_path / "resources/icons/AUTO_MAA.ico")),
|
||||
self,
|
||||
)
|
||||
self.tray.setToolTip("AUTO_MAA")
|
||||
@@ -184,7 +168,8 @@ class AUTO_MAA(MSFluentWindow):
|
||||
self.tray.setContextMenu(self.tray_menu)
|
||||
self.tray.activated.connect(self.on_tray_activated)
|
||||
|
||||
self.task_manager.create_gui.connect(self.dispatch_center.add_board)
|
||||
Task_manager.create_gui.connect(self.dispatch_center.add_board)
|
||||
Task_manager.connect_gui.connect(self.dispatch_center.connect_main_board)
|
||||
self.setting.ui.card_IfShowTray.checkedChanged.connect(
|
||||
lambda: self.show_ui("配置托盘")
|
||||
)
|
||||
@@ -195,14 +180,16 @@ class AUTO_MAA(MSFluentWindow):
|
||||
def start_up_task(self) -> None:
|
||||
"""启动时任务"""
|
||||
|
||||
logger.debug(f"{Config.app_path}, {Config.app_path_sys}")
|
||||
|
||||
# 加载配置
|
||||
qconfig.load(self.config.config_path, self.config.global_config)
|
||||
qconfig.load(Config.config_path, Config.global_config)
|
||||
|
||||
# 检查密码
|
||||
self.setting.check_PASSWORD()
|
||||
|
||||
# 检查更新
|
||||
if self.config.global_config.get(self.config.global_config.update_IfAutoUpdate):
|
||||
if Config.global_config.get(Config.global_config.update_IfAutoUpdate):
|
||||
result = self.setting.get_update_info()
|
||||
if result == "已是最新版本~":
|
||||
MainInfoBar.push_info_bar("success", "更新检查", result, 3000)
|
||||
@@ -225,7 +212,7 @@ class AUTO_MAA(MSFluentWindow):
|
||||
def set_min_method(self) -> None:
|
||||
"""设置最小化方法"""
|
||||
|
||||
if self.config.global_config.get(self.config.global_config.ui_IfToTray):
|
||||
if Config.global_config.get(Config.global_config.ui_IfToTray):
|
||||
|
||||
self.titleBar.minBtn.clicked.disconnect()
|
||||
self.titleBar.minBtn.clicked.connect(lambda: self.show_ui("隐藏到托盘"))
|
||||
@@ -243,7 +230,7 @@ class AUTO_MAA(MSFluentWindow):
|
||||
# def start_task(self, mode):
|
||||
# """调起对应任务"""
|
||||
# if self.main.MaaManager.isRunning():
|
||||
# self.notify.push_notification(
|
||||
# Notify.push_notification(
|
||||
# f"无法运行{mode}!",
|
||||
# "当前已有任务正在运行,请在该任务结束后重试",
|
||||
# "当前已有任务正在运行,请在该任务结束后重试",
|
||||
@@ -261,14 +248,14 @@ class AUTO_MAA(MSFluentWindow):
|
||||
# ):
|
||||
# self.main.maa_ender(f"{self.main.MaaManager.mode}_结束")
|
||||
# elif "设置MAA" in self.main.MaaManager.mode:
|
||||
# self.notify.push_notification(
|
||||
# Notify.push_notification(
|
||||
# "正在设置MAA!",
|
||||
# "正在运行设置MAA任务,无法中止",
|
||||
# "正在运行设置MAA任务,无法中止",
|
||||
# 3,
|
||||
# )
|
||||
# else:
|
||||
# self.notify.push_notification(
|
||||
# Notify.push_notification(
|
||||
# "无任务运行!",
|
||||
# "当前无任务正在运行,无需中止",
|
||||
# "当前无任务正在运行,无需中止",
|
||||
@@ -289,32 +276,28 @@ class AUTO_MAA(MSFluentWindow):
|
||||
size = list(
|
||||
map(
|
||||
int,
|
||||
self.config.global_config.get(
|
||||
self.config.global_config.ui_size
|
||||
).split("x"),
|
||||
Config.global_config.get(Config.global_config.ui_size).split("x"),
|
||||
)
|
||||
)
|
||||
location = list(
|
||||
map(
|
||||
int,
|
||||
self.config.global_config.get(
|
||||
self.config.global_config.ui_location
|
||||
).split("x"),
|
||||
Config.global_config.get(Config.global_config.ui_location).split(
|
||||
"x"
|
||||
),
|
||||
)
|
||||
)
|
||||
self.setGeometry(location[0], location[1], size[0], size[1])
|
||||
self.show()
|
||||
if not if_quick:
|
||||
if self.config.global_config.get(
|
||||
self.config.global_config.ui_maximized
|
||||
):
|
||||
if Config.global_config.get(Config.global_config.ui_maximized):
|
||||
self.showMaximized()
|
||||
self.set_min_method()
|
||||
self.show_ui("配置托盘")
|
||||
|
||||
elif mode == "配置托盘":
|
||||
|
||||
if self.config.global_config.get(self.config.global_config.ui_IfShowTray):
|
||||
if Config.global_config.get(Config.global_config.ui_IfShowTray):
|
||||
self.tray.show()
|
||||
else:
|
||||
self.tray.hide()
|
||||
@@ -324,18 +307,18 @@ class AUTO_MAA(MSFluentWindow):
|
||||
# 保存窗口相关属性
|
||||
if not self.isMaximized():
|
||||
|
||||
self.config.global_config.set(
|
||||
self.config.global_config.ui_size,
|
||||
Config.global_config.set(
|
||||
Config.global_config.ui_size,
|
||||
f"{self.geometry().width()}x{self.geometry().height()}",
|
||||
)
|
||||
self.config.global_config.set(
|
||||
self.config.global_config.ui_location,
|
||||
Config.global_config.set(
|
||||
Config.global_config.ui_location,
|
||||
f"{self.geometry().x()}x{self.geometry().y()}",
|
||||
)
|
||||
self.config.global_config.set(
|
||||
self.config.global_config.ui_maximized, self.isMaximized()
|
||||
Config.global_config.set(
|
||||
Config.global_config.ui_maximized, self.isMaximized()
|
||||
)
|
||||
self.config.global_config.save()
|
||||
Config.global_config.save()
|
||||
|
||||
# 隐藏主窗口
|
||||
if not if_quick:
|
||||
@@ -356,6 +339,6 @@ class AUTO_MAA(MSFluentWindow):
|
||||
# self.main.MaaManager.wait()
|
||||
|
||||
# 关闭数据库连接
|
||||
self.config.close_database()
|
||||
Config.close_database()
|
||||
|
||||
event.accept()
|
||||
|
||||
@@ -57,8 +57,8 @@ import datetime
|
||||
import json
|
||||
import shutil
|
||||
|
||||
from app.core import AppConfig, MaaConfig, MainInfoBar
|
||||
from app.services import Notification, CryptoHandler
|
||||
from app.core import Config, MainInfoBar
|
||||
from app.services import Notify, Crypto
|
||||
from .Widget import (
|
||||
InputMessageBox,
|
||||
LineEditSettingCard,
|
||||
@@ -71,26 +71,19 @@ class MemberManager(QWidget):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
config: AppConfig,
|
||||
notify: Notification,
|
||||
crypto: CryptoHandler,
|
||||
parent=None,
|
||||
):
|
||||
super().__init__(parent)
|
||||
|
||||
self.setObjectName("脚本管理")
|
||||
|
||||
self.config = config
|
||||
self.notify = notify
|
||||
self.crypto = crypto
|
||||
|
||||
setTheme(Theme.AUTO)
|
||||
|
||||
layout = QVBoxLayout(self)
|
||||
|
||||
self.tools = CommandBar()
|
||||
|
||||
self.member_manager = MemberSettingBox(self.config, self.crypto, self)
|
||||
self.member_manager = MemberSettingBox(self)
|
||||
|
||||
# 逐个添加动作
|
||||
self.tools.addActions(
|
||||
@@ -147,14 +140,14 @@ class MemberManager(QWidget):
|
||||
index = len(self.member_manager.search_member()) + 1
|
||||
|
||||
qconfig.load(
|
||||
self.config.app_path / f"config/MaaConfig/脚本_{index}/config.json",
|
||||
self.config.maa_config,
|
||||
Config.app_path / f"config/MaaConfig/脚本_{index}/config.json",
|
||||
Config.maa_config,
|
||||
)
|
||||
self.config.clear_maa_config()
|
||||
self.config.maa_config.save()
|
||||
Config.clear_maa_config()
|
||||
Config.maa_config.save()
|
||||
|
||||
self.config.open_database("Maa", f"脚本_{index}")
|
||||
self.config.init_database("Maa")
|
||||
Config.open_database("Maa", f"脚本_{index}")
|
||||
Config.init_database("Maa")
|
||||
self.member_manager.add_MaaSettingBox(index)
|
||||
self.member_manager.switch_SettingBox(index)
|
||||
|
||||
@@ -181,16 +174,12 @@ class MemberManager(QWidget):
|
||||
|
||||
self.member_manager.clear_SettingBox()
|
||||
|
||||
shutil.rmtree(self.config.app_path / f"config/{type[0]}Config/{name}")
|
||||
shutil.rmtree(Config.app_path / f"config/{type[0]}Config/{name}")
|
||||
self.change_queue(name, "禁用")
|
||||
for member in move_list:
|
||||
if (
|
||||
self.config.app_path / f"config/{member[1]}Config/{member[0]}"
|
||||
).exists():
|
||||
(
|
||||
self.config.app_path / f"config/{member[1]}Config/{member[0]}"
|
||||
).rename(
|
||||
self.config.app_path
|
||||
if (Config.app_path / f"config/{member[1]}Config/{member[0]}").exists():
|
||||
(Config.app_path / f"config/{member[1]}Config/{member[0]}").rename(
|
||||
Config.app_path
|
||||
/ f"config/{member[1]}Config/脚本_{int(member[0][3:])-1}",
|
||||
)
|
||||
self.change_queue(member[0], f"脚本_{int(member[0][3:])-1}")
|
||||
@@ -216,16 +205,16 @@ class MemberManager(QWidget):
|
||||
|
||||
self.member_manager.clear_SettingBox()
|
||||
|
||||
(self.config.app_path / f"config/{type_right[0]}Config/脚本_{index}").rename(
|
||||
self.config.app_path / f"config/{type_right[0]}Config/脚本_0"
|
||||
(Config.app_path / f"config/{type_right[0]}Config/脚本_{index}").rename(
|
||||
Config.app_path / f"config/{type_right[0]}Config/脚本_0"
|
||||
)
|
||||
self.change_queue(f"脚本_{index}", "脚本_0")
|
||||
(self.config.app_path / f"config/{type_left[0]}Config/脚本_{index-1}").rename(
|
||||
self.config.app_path / f"config/{type_left[0]}Config/脚本_{index}"
|
||||
(Config.app_path / f"config/{type_left[0]}Config/脚本_{index-1}").rename(
|
||||
Config.app_path / f"config/{type_left[0]}Config/脚本_{index}"
|
||||
)
|
||||
self.change_queue(f"脚本_{index-1}", f"脚本_{index}")
|
||||
(self.config.app_path / f"config/{type_right[0]}Config/脚本_0").rename(
|
||||
self.config.app_path / f"config/{type_right[0]}Config/脚本_{index-1}"
|
||||
(Config.app_path / f"config/{type_right[0]}Config/脚本_0").rename(
|
||||
Config.app_path / f"config/{type_right[0]}Config/脚本_{index-1}"
|
||||
)
|
||||
self.change_queue("脚本_0", f"脚本_{index-1}")
|
||||
|
||||
@@ -250,16 +239,16 @@ class MemberManager(QWidget):
|
||||
|
||||
self.member_manager.clear_SettingBox()
|
||||
|
||||
(self.config.app_path / f"config/{type_left[0]}Config/脚本_{index}").rename(
|
||||
self.config.app_path / f"config/{type_left[0]}Config/脚本_0",
|
||||
(Config.app_path / f"config/{type_left[0]}Config/脚本_{index}").rename(
|
||||
Config.app_path / f"config/{type_left[0]}Config/脚本_0",
|
||||
)
|
||||
self.change_queue(f"脚本_{index}", "脚本_0")
|
||||
(self.config.app_path / f"config/{type_right[0]}Config/脚本_{index+1}").rename(
|
||||
self.config.app_path / f"config/{type_right[0]}Config/脚本_{index}",
|
||||
(Config.app_path / f"config/{type_right[0]}Config/脚本_{index+1}").rename(
|
||||
Config.app_path / f"config/{type_right[0]}Config/脚本_{index}",
|
||||
)
|
||||
self.change_queue(f"脚本_{index+1}", f"脚本_{index}")
|
||||
(self.config.app_path / f"config/{type_left[0]}Config/脚本_0").rename(
|
||||
self.config.app_path / f"config/{type_left[0]}Config/脚本_{index+1}",
|
||||
(Config.app_path / f"config/{type_left[0]}Config/脚本_0").rename(
|
||||
Config.app_path / f"config/{type_left[0]}Config/脚本_{index+1}",
|
||||
)
|
||||
self.change_queue("脚本_0", f"脚本_{index+1}")
|
||||
|
||||
@@ -267,7 +256,7 @@ class MemberManager(QWidget):
|
||||
|
||||
def show_password(self):
|
||||
|
||||
if self.config.PASSWORD == "":
|
||||
if Config.PASSWORD == "":
|
||||
choice = InputMessageBox(
|
||||
self,
|
||||
"请输入管理密钥",
|
||||
@@ -275,21 +264,21 @@ class MemberManager(QWidget):
|
||||
"密码",
|
||||
)
|
||||
if choice.exec() and choice.input.text() != "":
|
||||
self.config.PASSWORD = choice.input.text()
|
||||
Config.PASSWORD = choice.input.text()
|
||||
self.member_manager.script_list[
|
||||
int(self.member_manager.pivot.currentRouteKey()[3:]) - 1
|
||||
].user_setting.user_list.update_user_info("normal")
|
||||
self.key.setIcon(FluentIcon.VIEW)
|
||||
self.key.setChecked(True)
|
||||
else:
|
||||
self.config.PASSWORD = ""
|
||||
Config.PASSWORD = ""
|
||||
self.member_manager.script_list[
|
||||
int(self.member_manager.pivot.currentRouteKey()[3:]) - 1
|
||||
].user_setting.user_list.update_user_info("normal")
|
||||
self.key.setIcon(FluentIcon.HIDE)
|
||||
self.key.setChecked(False)
|
||||
else:
|
||||
self.config.PASSWORD = ""
|
||||
Config.PASSWORD = ""
|
||||
self.member_manager.script_list[
|
||||
int(self.member_manager.pivot.currentRouteKey()[3:]) - 1
|
||||
].user_setting.user_list.update_user_info("normal")
|
||||
@@ -299,10 +288,8 @@ class MemberManager(QWidget):
|
||||
def change_queue(self, old: str, new: str) -> None:
|
||||
"""修改调度队列配置文件的队列参数"""
|
||||
|
||||
if (self.config.app_path / "config/QueueConfig").exists():
|
||||
for json_file in (self.config.app_path / "config/QueueConfig").glob(
|
||||
"*.json"
|
||||
):
|
||||
if (Config.app_path / "config/QueueConfig").exists():
|
||||
for json_file in (Config.app_path / "config/QueueConfig").glob("*.json"):
|
||||
with json_file.open("r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
|
||||
@@ -325,12 +312,10 @@ class MemberManager(QWidget):
|
||||
|
||||
class MemberSettingBox(QWidget):
|
||||
|
||||
def __init__(self, config: AppConfig, crypto: CryptoHandler, parent=None):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.setObjectName("脚本管理")
|
||||
self.config = config
|
||||
self.crypto = crypto
|
||||
|
||||
self.pivot = Pivot(self)
|
||||
self.stackedWidget = QStackedWidget(self)
|
||||
@@ -354,16 +339,16 @@ class MemberSettingBox(QWidget):
|
||||
member_list = self.search_member()
|
||||
|
||||
qconfig.load(
|
||||
self.config.app_path / "config/临时.json",
|
||||
self.config.maa_config,
|
||||
Config.app_path / "config/临时.json",
|
||||
Config.maa_config,
|
||||
)
|
||||
self.config.clear_maa_config()
|
||||
Config.clear_maa_config()
|
||||
for member in member_list:
|
||||
if member[1] == "Maa":
|
||||
self.config.open_database(member[1], member[0])
|
||||
Config.open_database(member[1], member[0])
|
||||
self.add_MaaSettingBox(int(member[0][3:]))
|
||||
if (self.config.app_path / "config/临时.json").exists():
|
||||
(self.config.app_path / "config/临时.json").unlink()
|
||||
if (Config.app_path / "config/临时.json").exists():
|
||||
(Config.app_path / "config/临时.json").unlink()
|
||||
|
||||
self.switch_SettingBox(index)
|
||||
|
||||
@@ -381,11 +366,11 @@ class MemberSettingBox(QWidget):
|
||||
type = [_[1] for _ in member_list if _[0] == f"脚本_{index}"]
|
||||
|
||||
qconfig.load(
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/{type[0]}Config/{self.script_list[index-1].objectName()}/config.json",
|
||||
self.config.maa_config,
|
||||
Config.maa_config,
|
||||
)
|
||||
self.config.open_database(type[0], self.script_list[index - 1].objectName())
|
||||
Config.open_database(type[0], self.script_list[index - 1].objectName())
|
||||
self.script_list[index - 1].user_setting.user_list.update_user_info("normal")
|
||||
|
||||
if if_chang_pivot:
|
||||
@@ -401,18 +386,18 @@ class MemberSettingBox(QWidget):
|
||||
self.script_list.clear()
|
||||
self.pivot.clear()
|
||||
qconfig.load(
|
||||
self.config.app_path / "config/临时.json",
|
||||
self.config.maa_config,
|
||||
Config.app_path / "config/临时.json",
|
||||
Config.maa_config,
|
||||
)
|
||||
self.config.clear_maa_config()
|
||||
if (self.config.app_path / "config/临时.json").exists():
|
||||
(self.config.app_path / "config/临时.json").unlink()
|
||||
self.config.close_database()
|
||||
Config.clear_maa_config()
|
||||
if (Config.app_path / "config/临时.json").exists():
|
||||
(Config.app_path / "config/临时.json").unlink()
|
||||
Config.close_database()
|
||||
|
||||
def add_MaaSettingBox(self, uid: int) -> None:
|
||||
"""添加一个MAA设置界面"""
|
||||
|
||||
maa_setting_box = MaaSettingBox(self.config, self.crypto, uid, self)
|
||||
maa_setting_box = MaaSettingBox(uid, self)
|
||||
|
||||
self.script_list.append(maa_setting_box)
|
||||
|
||||
@@ -425,8 +410,8 @@ class MemberSettingBox(QWidget):
|
||||
|
||||
member_list = []
|
||||
|
||||
if (self.config.app_path / "config/MaaConfig").exists():
|
||||
for subdir in (self.config.app_path / "config/MaaConfig").iterdir():
|
||||
if (Config.app_path / "config/MaaConfig").exists():
|
||||
for subdir in (Config.app_path / "config/MaaConfig").iterdir():
|
||||
if subdir.is_dir():
|
||||
member_list.append([subdir.name, "Maa"])
|
||||
|
||||
@@ -435,14 +420,11 @@ class MemberSettingBox(QWidget):
|
||||
|
||||
class MaaSettingBox(QWidget):
|
||||
|
||||
def __init__(self, config: AppConfig, crypto: CryptoHandler, uid: int, parent=None):
|
||||
def __init__(self, uid: int, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.setObjectName(f"脚本_{uid}")
|
||||
|
||||
self.config = config
|
||||
self.crypto = crypto
|
||||
|
||||
layout = QVBoxLayout()
|
||||
|
||||
scrollArea = ScrollArea()
|
||||
@@ -451,10 +433,8 @@ class MaaSettingBox(QWidget):
|
||||
content_widget = QWidget()
|
||||
content_layout = QVBoxLayout(content_widget)
|
||||
|
||||
self.app_setting = self.AppSettingCard(self, self.config, uid)
|
||||
self.user_setting = self.UserSettingCard(
|
||||
self, self.objectName(), self.config, self.crypto
|
||||
)
|
||||
self.app_setting = self.AppSettingCard(self, uid)
|
||||
self.user_setting = self.UserSettingCard(self, self.objectName())
|
||||
|
||||
content_layout.addWidget(self.app_setting)
|
||||
content_layout.addWidget(self.user_setting)
|
||||
@@ -468,12 +448,11 @@ class MaaSettingBox(QWidget):
|
||||
|
||||
class AppSettingCard(HeaderCardWidget):
|
||||
|
||||
def __init__(self, parent=None, config: AppConfig = None, uid: int = None):
|
||||
def __init__(self, parent=None, uid: int = None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.setTitle("MAA实例")
|
||||
|
||||
self.config = config
|
||||
self.uid = uid
|
||||
|
||||
Layout = QVBoxLayout()
|
||||
@@ -483,13 +462,13 @@ class MaaSettingBox(QWidget):
|
||||
FluentIcon.EDIT,
|
||||
"实例名称",
|
||||
"用于标识MAA实例的名称",
|
||||
self.config.maa_config.MaaSet_Name,
|
||||
Config.maa_config.MaaSet_Name,
|
||||
)
|
||||
self.card_Path = PushSettingCard(
|
||||
"选择文件夹",
|
||||
FluentIcon.FOLDER,
|
||||
"MAA目录",
|
||||
self.config.maa_config.get(self.config.maa_config.MaaSet_Path),
|
||||
Config.maa_config.get(Config.maa_config.MaaSet_Path),
|
||||
)
|
||||
self.card_Set = PushSettingCard(
|
||||
"设置",
|
||||
@@ -497,12 +476,12 @@ class MaaSettingBox(QWidget):
|
||||
"MAA全局配置",
|
||||
"简洁模式下MAA将继承全局配置",
|
||||
)
|
||||
self.RunSet = self.RunSetSettingCard(self, self.config.maa_config)
|
||||
self.RunSet = self.RunSetSettingCard(self)
|
||||
|
||||
self.card_Path.clicked.connect(self.PathClicked)
|
||||
self.config.maa_config.MaaSet_Path.valueChanged.connect(
|
||||
Config.maa_config.MaaSet_Path.valueChanged.connect(
|
||||
lambda: self.card_Path.setContent(
|
||||
self.config.maa_config.get(self.config.maa_config.MaaSet_Path)
|
||||
Config.maa_config.get(Config.maa_config.MaaSet_Path)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -518,8 +497,7 @@ class MaaSettingBox(QWidget):
|
||||
folder = QFileDialog.getExistingDirectory(self, "选择MAA目录", "./")
|
||||
if (
|
||||
not folder
|
||||
or self.config.maa_config.get(self.config.maa_config.MaaSet_Path)
|
||||
== folder
|
||||
or Config.maa_config.get(Config.maa_config.MaaSet_Path) == folder
|
||||
):
|
||||
logger.warning("选择MAA目录时未选择文件夹或未更改文件夹")
|
||||
MainInfoBar.push_info_bar(
|
||||
@@ -536,20 +514,19 @@ class MaaSettingBox(QWidget):
|
||||
)
|
||||
return None
|
||||
|
||||
(self.config.app_path / f"config/MaaConfig/脚本_{self.uid}/Default").mkdir(
|
||||
(Config.app_path / f"config/MaaConfig/脚本_{self.uid}/Default").mkdir(
|
||||
parents=True, exist_ok=True
|
||||
)
|
||||
shutil.copy(
|
||||
Path(folder) / "config/gui.json",
|
||||
self.config.app_path
|
||||
/ f"config/MaaConfig/脚本_{self.uid}/Default/gui.json",
|
||||
Config.app_path / f"config/MaaConfig/脚本_{self.uid}/Default/gui.json",
|
||||
)
|
||||
self.config.maa_config.set(self.config.maa_config.MaaSet_Path, folder)
|
||||
Config.maa_config.set(Config.maa_config.MaaSet_Path, folder)
|
||||
self.card_Path.setContent(folder)
|
||||
|
||||
class RunSetSettingCard(ExpandGroupSettingCard):
|
||||
|
||||
def __init__(self, parent=None, maa_config: MaaConfig = None):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(
|
||||
FluentIcon.SETTING,
|
||||
"运行",
|
||||
@@ -557,8 +534,6 @@ class MaaSettingBox(QWidget):
|
||||
parent,
|
||||
)
|
||||
|
||||
self.maa_config = maa_config
|
||||
|
||||
widget = QWidget()
|
||||
Layout = QVBoxLayout(widget)
|
||||
|
||||
@@ -567,7 +542,7 @@ class MaaSettingBox(QWidget):
|
||||
FluentIcon.PAGE_RIGHT,
|
||||
"剿灭代理超时限制",
|
||||
"MAA日志无变化时间超过该阈值视为超时,单位为分钟",
|
||||
self.maa_config.RunSet_AnnihilationTimeLimit,
|
||||
Config.maa_config.RunSet_AnnihilationTimeLimit,
|
||||
)
|
||||
|
||||
self.RoutineTimeLimit = SpinBoxSettingCard(
|
||||
@@ -575,7 +550,7 @@ class MaaSettingBox(QWidget):
|
||||
FluentIcon.PAGE_RIGHT,
|
||||
"自动代理超时限制",
|
||||
"MAA日志无变化时间超过该阈值视为超时,单位为分钟",
|
||||
self.maa_config.RunSet_RoutineTimeLimit,
|
||||
Config.maa_config.RunSet_RoutineTimeLimit,
|
||||
)
|
||||
|
||||
self.RunTimesLimit = SpinBoxSettingCard(
|
||||
@@ -583,7 +558,7 @@ class MaaSettingBox(QWidget):
|
||||
FluentIcon.PAGE_RIGHT,
|
||||
"代理重试次数限制",
|
||||
"若超过该次数限制仍未完成代理,视为代理失败",
|
||||
self.maa_config.RunSet_RunTimesLimit,
|
||||
Config.maa_config.RunSet_RunTimesLimit,
|
||||
)
|
||||
|
||||
Layout.addWidget(self.AnnihilationTimeLimit)
|
||||
@@ -601,20 +576,16 @@ class MaaSettingBox(QWidget):
|
||||
self,
|
||||
parent=None,
|
||||
name: str = None,
|
||||
config: AppConfig = None,
|
||||
crypto: CryptoHandler = None,
|
||||
):
|
||||
super().__init__(parent)
|
||||
|
||||
self.setTitle("用户列表")
|
||||
|
||||
self.config = config
|
||||
self.crypto = crypto
|
||||
self.name = name
|
||||
|
||||
Layout = QVBoxLayout()
|
||||
|
||||
self.user_list = self.UserListBox(self.name, self.config, self.crypto, self)
|
||||
self.user_list = self.UserListBox(self.name, self)
|
||||
|
||||
self.tools = CommandBar()
|
||||
self.tools.addActions(
|
||||
@@ -656,8 +627,8 @@ class MaaSettingBox(QWidget):
|
||||
|
||||
def set_more(self):
|
||||
|
||||
self.config.cur.execute("SELECT * FROM adminx WHERE True")
|
||||
data = self.config.cur.fetchall()
|
||||
Config.cur.execute("SELECT * FROM adminx WHERE True")
|
||||
data = Config.cur.fetchall()
|
||||
|
||||
if self.user_list.pivot.currentRouteKey() == f"{self.name}_简洁用户列表":
|
||||
|
||||
@@ -685,12 +656,12 @@ class MaaSettingBox(QWidget):
|
||||
)
|
||||
if file_path != "":
|
||||
(
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/simple/{choice.input[0].currentIndex()}/infrastructure"
|
||||
).mkdir(parents=True, exist_ok=True)
|
||||
shutil.copy(
|
||||
file_path,
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/simple/{choice.input[0].currentIndex()}/infrastructure",
|
||||
)
|
||||
else:
|
||||
@@ -712,13 +683,9 @@ class MaaSettingBox(QWidget):
|
||||
|
||||
class UserListBox(QWidget):
|
||||
|
||||
def __init__(
|
||||
self, name: str, config: AppConfig, crypto: CryptoHandler, parent=None
|
||||
):
|
||||
def __init__(self, name: str, parent=None):
|
||||
super().__init__(parent)
|
||||
self.setObjectName(f"{name}_用户列表")
|
||||
self.config = config
|
||||
self.crypto = crypto
|
||||
|
||||
self.name = name
|
||||
|
||||
@@ -874,8 +841,8 @@ class MaaSettingBox(QWidget):
|
||||
"""将本地数据库中的用户配置同步至GUI的用户管理界面"""
|
||||
|
||||
# 读入本地数据库
|
||||
self.config.cur.execute("SELECT * FROM adminx WHERE True")
|
||||
data = self.config.cur.fetchall()
|
||||
Config.cur.execute("SELECT * FROM adminx WHERE True")
|
||||
data = Config.cur.fetchall()
|
||||
|
||||
# 处理部分模式调整
|
||||
if operation == "read_only":
|
||||
@@ -946,15 +913,13 @@ class MaaSettingBox(QWidget):
|
||||
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled
|
||||
)
|
||||
elif j == 12:
|
||||
if self.config.PASSWORD == "":
|
||||
if Config.PASSWORD == "":
|
||||
item = QTableWidgetItem("******")
|
||||
item.setFlags(
|
||||
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled
|
||||
)
|
||||
else:
|
||||
result = self.crypto.decryptx(
|
||||
value, self.config.PASSWORD
|
||||
)
|
||||
result = Crypto.decryptx(value, Config.PASSWORD)
|
||||
item = QTableWidgetItem(result)
|
||||
if result == "管理密钥错误":
|
||||
item.setFlags(
|
||||
@@ -1022,15 +987,13 @@ class MaaSettingBox(QWidget):
|
||||
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled
|
||||
)
|
||||
elif j == 12:
|
||||
if self.config.PASSWORD == "":
|
||||
if Config.PASSWORD == "":
|
||||
item = QTableWidgetItem("******")
|
||||
item.setFlags(
|
||||
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled
|
||||
)
|
||||
else:
|
||||
result = self.crypto.decryptx(
|
||||
value, self.config.PASSWORD
|
||||
)
|
||||
result = Crypto.decryptx(value, Config.PASSWORD)
|
||||
item = QTableWidgetItem(result)
|
||||
if result == "管理密钥错误":
|
||||
item.setFlags(
|
||||
@@ -1094,9 +1057,7 @@ class MaaSettingBox(QWidget):
|
||||
if item.column() in [6, 7, 8]: # 关卡号
|
||||
# 导入与应用特殊关卡规则
|
||||
games = {}
|
||||
with self.config.gameid_path.open(
|
||||
mode="r", encoding="utf-8"
|
||||
) as f:
|
||||
with Config.gameid_path.open(mode="r", encoding="utf-8") as f:
|
||||
gameids = f.readlines()
|
||||
for line in gameids:
|
||||
if ":" in line:
|
||||
@@ -1104,11 +1065,11 @@ class MaaSettingBox(QWidget):
|
||||
games[game_in.strip()] = game_out.strip()
|
||||
text = games.get(text, text)
|
||||
if item.column() == 11: # 密码
|
||||
text = self.crypto.encryptx(text)
|
||||
text = Crypto.encryptx(text)
|
||||
|
||||
# 保存至本地数据库
|
||||
if text != "":
|
||||
self.config.cur.execute(
|
||||
Config.cur.execute(
|
||||
f"UPDATE adminx SET {self.user_column[self.userlist_simple_index.index(item.column())]} = ? WHERE mode = 'simple' AND uid = ?",
|
||||
(text, item.row()),
|
||||
)
|
||||
@@ -1122,15 +1083,15 @@ class MaaSettingBox(QWidget):
|
||||
self.update_user_info("normal")
|
||||
return None
|
||||
if item.column() == 6: # 密码
|
||||
text = self.crypto.encryptx(text)
|
||||
text = Crypto.encryptx(text)
|
||||
|
||||
# 保存至本地数据库
|
||||
if text != "":
|
||||
self.config.cur.execute(
|
||||
Config.cur.execute(
|
||||
f"UPDATE adminx SET {self.user_column[self.userlist_beta_index.index(item.column())]} = ? WHERE mode = 'beta' AND uid = ?",
|
||||
(text, item.row()),
|
||||
)
|
||||
self.config.db.commit()
|
||||
Config.db.commit()
|
||||
|
||||
# 同步一般用户信息更改到GUI
|
||||
self.update_user_info("normal")
|
||||
@@ -1156,7 +1117,7 @@ class MaaSettingBox(QWidget):
|
||||
# or (
|
||||
# index == 0
|
||||
# and not (
|
||||
# self.config.app_path
|
||||
# Config.app_path
|
||||
# / f"data/MAAconfig/{self.user_mode_list[index]}/{row}/{column}/gui.json"
|
||||
# ).exists()
|
||||
# )
|
||||
@@ -1173,14 +1134,14 @@ class MaaSettingBox(QWidget):
|
||||
# 服务器
|
||||
if mode == 0 and column == "server":
|
||||
server_list = ["Official", "Bilibili"]
|
||||
self.config.cur.execute(
|
||||
Config.cur.execute(
|
||||
f"UPDATE adminx SET server = ? WHERE mode = 'simple' AND uid = ?",
|
||||
(server_list[index], row),
|
||||
)
|
||||
# 其它(启用/禁用)
|
||||
elif index in [0, 1]:
|
||||
index_list = ["y", "n"]
|
||||
self.config.cur.execute(
|
||||
Config.cur.execute(
|
||||
f"UPDATE adminx SET {column} = ? WHERE mode = ? AND uid = ?",
|
||||
(
|
||||
index_list[index],
|
||||
@@ -1188,7 +1149,7 @@ class MaaSettingBox(QWidget):
|
||||
row,
|
||||
),
|
||||
)
|
||||
self.config.db.commit()
|
||||
Config.db.commit()
|
||||
|
||||
# 同步用户组件信息修改到GUI
|
||||
self.update_user_info("normal")
|
||||
@@ -1201,15 +1162,15 @@ class MaaSettingBox(QWidget):
|
||||
set_book = ["simple", self.user_list_simple.rowCount()]
|
||||
elif "高级用户列表" in self.pivot.currentRouteKey():
|
||||
set_book = ["beta", self.user_list_beta.rowCount()]
|
||||
self.config.cur.execute(
|
||||
Config.cur.execute(
|
||||
"INSERT INTO adminx VALUES('新用户','手机号码(官服)/B站ID(B服)','Official',-1,'y','2000-01-01','1-7','-','-','n','n','n',?,'无',0,?,?)",
|
||||
(
|
||||
self.crypto.encryptx("未设置"),
|
||||
Crypto.encryptx("未设置"),
|
||||
set_book[0],
|
||||
set_book[1],
|
||||
),
|
||||
)
|
||||
self.config.db.commit(),
|
||||
Config.db.commit(),
|
||||
|
||||
# 同步新用户至GUI
|
||||
self.update_user_info("normal")
|
||||
@@ -1248,14 +1209,14 @@ class MaaSettingBox(QWidget):
|
||||
return None
|
||||
|
||||
# 确认待删除用户信息
|
||||
self.config.cur.execute(
|
||||
Config.cur.execute(
|
||||
"SELECT * FROM adminx WHERE mode = ? AND uid = ?",
|
||||
(
|
||||
self.user_mode_list[mode],
|
||||
row,
|
||||
),
|
||||
)
|
||||
data = self.config.cur.fetchall()
|
||||
data = Config.cur.fetchall()
|
||||
choice = MessageBox(
|
||||
"确认",
|
||||
f"确定要删除用户 {data[0][0]} 吗?",
|
||||
@@ -1273,26 +1234,26 @@ class MaaSettingBox(QWidget):
|
||||
# 删除用户
|
||||
if choice.exec():
|
||||
# 删除所选用户
|
||||
self.config.cur.execute(
|
||||
Config.cur.execute(
|
||||
"DELETE FROM adminx WHERE mode = ? AND uid = ?",
|
||||
(
|
||||
self.user_mode_list[mode],
|
||||
row,
|
||||
),
|
||||
)
|
||||
self.config.db.commit()
|
||||
Config.db.commit()
|
||||
|
||||
if (
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{row}"
|
||||
).exists():
|
||||
shutil.rmtree(
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{row}"
|
||||
)
|
||||
# 后续用户补位
|
||||
for i in range(row + 1, current_numb):
|
||||
self.config.cur.execute(
|
||||
Config.cur.execute(
|
||||
"UPDATE adminx SET uid = ? WHERE mode = ? AND uid = ?",
|
||||
(
|
||||
i - 1,
|
||||
@@ -1300,16 +1261,16 @@ class MaaSettingBox(QWidget):
|
||||
i,
|
||||
),
|
||||
)
|
||||
self.config.db.commit()
|
||||
Config.db.commit()
|
||||
if (
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{i}"
|
||||
).exists():
|
||||
(
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{i}"
|
||||
).rename(
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{i}"
|
||||
)
|
||||
|
||||
@@ -1350,7 +1311,7 @@ class MaaSettingBox(QWidget):
|
||||
if row == 0:
|
||||
return None
|
||||
|
||||
self.config.cur.execute(
|
||||
Config.cur.execute(
|
||||
"UPDATE adminx SET uid = ? WHERE mode = ? AND uid = ?",
|
||||
(
|
||||
-1,
|
||||
@@ -1358,7 +1319,7 @@ class MaaSettingBox(QWidget):
|
||||
row,
|
||||
),
|
||||
)
|
||||
self.config.cur.execute(
|
||||
Config.cur.execute(
|
||||
"UPDATE adminx SET uid = ? WHERE mode = ? AND uid = ?",
|
||||
(
|
||||
row,
|
||||
@@ -1366,7 +1327,7 @@ class MaaSettingBox(QWidget):
|
||||
row - 1,
|
||||
),
|
||||
)
|
||||
self.config.cur.execute(
|
||||
Config.cur.execute(
|
||||
"UPDATE adminx SET uid = ? WHERE mode = ? AND uid = ?",
|
||||
(
|
||||
row - 1,
|
||||
@@ -1374,39 +1335,39 @@ class MaaSettingBox(QWidget):
|
||||
-1,
|
||||
),
|
||||
)
|
||||
self.config.db.commit()
|
||||
Config.db.commit()
|
||||
|
||||
if (
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{row}"
|
||||
).exists():
|
||||
(
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{row}"
|
||||
).rename(
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{-1}"
|
||||
)
|
||||
if (
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{row - 1}"
|
||||
).exists():
|
||||
(
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{row - 1}"
|
||||
).rename(
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{row}"
|
||||
)
|
||||
if (
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{-1}"
|
||||
).exists():
|
||||
(
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{-1}"
|
||||
).rename(
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{row - 1}"
|
||||
)
|
||||
|
||||
@@ -1452,7 +1413,7 @@ class MaaSettingBox(QWidget):
|
||||
if row == current_numb - 1:
|
||||
return None
|
||||
|
||||
self.config.cur.execute(
|
||||
Config.cur.execute(
|
||||
"UPDATE adminx SET uid = ? WHERE mode = ? AND uid = ?",
|
||||
(
|
||||
-1,
|
||||
@@ -1460,7 +1421,7 @@ class MaaSettingBox(QWidget):
|
||||
row,
|
||||
),
|
||||
)
|
||||
self.config.cur.execute(
|
||||
Config.cur.execute(
|
||||
"UPDATE adminx SET uid = ? WHERE mode = ? AND uid = ?",
|
||||
(
|
||||
row,
|
||||
@@ -1468,7 +1429,7 @@ class MaaSettingBox(QWidget):
|
||||
row + 1,
|
||||
),
|
||||
)
|
||||
self.config.cur.execute(
|
||||
Config.cur.execute(
|
||||
"UPDATE adminx SET uid = ? WHERE mode = ? AND uid = ?",
|
||||
(
|
||||
row + 1,
|
||||
@@ -1476,39 +1437,39 @@ class MaaSettingBox(QWidget):
|
||||
-1,
|
||||
),
|
||||
)
|
||||
self.config.db.commit()
|
||||
Config.db.commit()
|
||||
|
||||
if (
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{row}"
|
||||
).exists():
|
||||
(
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{row}"
|
||||
).rename(
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{-1}"
|
||||
)
|
||||
if (
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{row + 1}"
|
||||
).exists():
|
||||
(
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{row + 1}"
|
||||
).rename(
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{row}"
|
||||
)
|
||||
if (
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{-1}"
|
||||
).exists():
|
||||
(
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{-1}"
|
||||
).rename(
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{row + 1}"
|
||||
)
|
||||
|
||||
@@ -1550,14 +1511,14 @@ class MaaSettingBox(QWidget):
|
||||
return None
|
||||
|
||||
# 确认待切换用户信息
|
||||
self.config.cur.execute(
|
||||
Config.cur.execute(
|
||||
"SELECT * FROM adminx WHERE mode = ? AND uid = ?",
|
||||
(
|
||||
self.user_mode_list[mode],
|
||||
row,
|
||||
),
|
||||
)
|
||||
data = self.config.cur.fetchall()
|
||||
data = Config.cur.fetchall()
|
||||
|
||||
mode_list = ["简洁", "高级"]
|
||||
choice = MessageBox(
|
||||
@@ -1576,15 +1537,15 @@ class MaaSettingBox(QWidget):
|
||||
|
||||
# 切换用户
|
||||
if choice.exec():
|
||||
self.config.cur.execute("SELECT * FROM adminx WHERE True")
|
||||
data = self.config.cur.fetchall()
|
||||
Config.cur.execute("SELECT * FROM adminx WHERE True")
|
||||
data = Config.cur.fetchall()
|
||||
if mode == 0:
|
||||
current_numb = self.user_list_simple.rowCount()
|
||||
elif mode == 1:
|
||||
current_numb = self.user_list_beta.rowCount()
|
||||
# 切换所选用户
|
||||
other_numb = len(data) - current_numb
|
||||
self.config.cur.execute(
|
||||
Config.cur.execute(
|
||||
"UPDATE adminx SET mode = ?, uid = ? WHERE mode = ? AND uid = ?",
|
||||
(
|
||||
self.user_mode_list[1 - mode],
|
||||
@@ -1593,20 +1554,20 @@ class MaaSettingBox(QWidget):
|
||||
row,
|
||||
),
|
||||
)
|
||||
self.config.db.commit()
|
||||
Config.db.commit()
|
||||
if (
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{row}"
|
||||
).exists():
|
||||
shutil.move(
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{row}",
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[1 - mode]}/{other_numb}",
|
||||
)
|
||||
# 后续用户补位
|
||||
for i in range(row + 1, current_numb):
|
||||
self.config.cur.execute(
|
||||
Config.cur.execute(
|
||||
"UPDATE adminx SET uid = ? WHERE mode = ? AND uid = ?",
|
||||
(
|
||||
i - 1,
|
||||
@@ -1614,16 +1575,16 @@ class MaaSettingBox(QWidget):
|
||||
i,
|
||||
),
|
||||
)
|
||||
self.config.db.commit(),
|
||||
Config.db.commit(),
|
||||
if (
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{i}"
|
||||
).exists():
|
||||
(
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{i}"
|
||||
).rename(
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/MaaConfig/{self.name}/{self.user_mode_list[mode]}/{i - 1}"
|
||||
)
|
||||
|
||||
|
||||
@@ -53,8 +53,8 @@ import shutil
|
||||
|
||||
uiLoader = QUiLoader()
|
||||
|
||||
from app.core import AppConfig, QueueConfig
|
||||
from app.services import Notification
|
||||
from app.core import Config
|
||||
from app.services import Notify
|
||||
from .Widget import (
|
||||
LineEditSettingCard,
|
||||
TimeEditSettingCard,
|
||||
@@ -66,24 +66,19 @@ class QueueManager(QWidget):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
config: AppConfig,
|
||||
notify: Notification,
|
||||
parent=None,
|
||||
):
|
||||
super().__init__(parent)
|
||||
|
||||
self.setObjectName("调度队列")
|
||||
|
||||
self.config = config
|
||||
self.notify = notify
|
||||
|
||||
setTheme(Theme.AUTO)
|
||||
|
||||
layout = QVBoxLayout(self)
|
||||
|
||||
self.tools = CommandBar()
|
||||
|
||||
self.queue_manager = QueueSettingBox(self.config, self)
|
||||
self.queue_manager = QueueSettingBox(self)
|
||||
|
||||
# 逐个添加动作
|
||||
self.tools.addActions(
|
||||
@@ -119,11 +114,11 @@ class QueueManager(QWidget):
|
||||
index = len(self.queue_manager.search_queue()) + 1
|
||||
|
||||
qconfig.load(
|
||||
self.config.app_path / f"config/QueueConfig/调度队列_{index}.json",
|
||||
self.config.queue_config,
|
||||
Config.app_path / f"config/QueueConfig/调度队列_{index}.json",
|
||||
Config.queue_config,
|
||||
)
|
||||
self.config.clear_queue_config()
|
||||
self.config.queue_config.save()
|
||||
Config.clear_queue_config()
|
||||
Config.queue_config.save()
|
||||
|
||||
self.queue_manager.add_QueueSettingBox(index)
|
||||
self.queue_manager.switch_SettingBox(index)
|
||||
@@ -150,15 +145,11 @@ class QueueManager(QWidget):
|
||||
|
||||
self.queue_manager.clear_SettingBox()
|
||||
|
||||
(self.config.app_path / f"config/QueueConfig/{name}.json").unlink()
|
||||
(Config.app_path / f"config/QueueConfig/{name}.json").unlink()
|
||||
for queue in move_list:
|
||||
if (
|
||||
self.config.app_path / f"config/QueueConfig/{queue[0]}.json"
|
||||
).exists():
|
||||
(
|
||||
self.config.app_path / f"config/QueueConfig/{queue[0]}.json"
|
||||
).rename(
|
||||
self.config.app_path
|
||||
if (Config.app_path / f"config/QueueConfig/{queue[0]}.json").exists():
|
||||
(Config.app_path / f"config/QueueConfig/{queue[0]}.json").rename(
|
||||
Config.app_path
|
||||
/ f"config/QueueConfig/调度队列_{int(queue[0][5:])-1}.json",
|
||||
)
|
||||
|
||||
@@ -179,15 +170,15 @@ class QueueManager(QWidget):
|
||||
|
||||
self.queue_manager.clear_SettingBox()
|
||||
|
||||
(self.config.app_path / f"config/QueueConfig/调度队列_{index}.json").rename(
|
||||
self.config.app_path / f"config/QueueConfig/调度队列_0.json",
|
||||
(Config.app_path / f"config/QueueConfig/调度队列_{index}.json").rename(
|
||||
Config.app_path / f"config/QueueConfig/调度队列_0.json",
|
||||
)
|
||||
shutil.move(
|
||||
str(self.config.app_path / f"config/QueueConfig/调度队列_{index-1}.json"),
|
||||
str(self.config.app_path / f"config/QueueConfig/调度队列_{index}.json"),
|
||||
str(Config.app_path / f"config/QueueConfig/调度队列_{index-1}.json"),
|
||||
str(Config.app_path / f"config/QueueConfig/调度队列_{index}.json"),
|
||||
)
|
||||
(self.config.app_path / f"config/QueueConfig/调度队列_0.json").rename(
|
||||
self.config.app_path / f"config/QueueConfig/调度队列_{index-1}.json",
|
||||
(Config.app_path / f"config/QueueConfig/调度队列_0.json").rename(
|
||||
Config.app_path / f"config/QueueConfig/调度队列_{index-1}.json",
|
||||
)
|
||||
|
||||
self.queue_manager.show_SettingBox(index - 1)
|
||||
@@ -208,14 +199,14 @@ class QueueManager(QWidget):
|
||||
|
||||
self.queue_manager.clear_SettingBox()
|
||||
|
||||
(self.config.app_path / f"config/QueueConfig/调度队列_{index}.json").rename(
|
||||
self.config.app_path / f"config/QueueConfig/调度队列_0.json",
|
||||
(Config.app_path / f"config/QueueConfig/调度队列_{index}.json").rename(
|
||||
Config.app_path / f"config/QueueConfig/调度队列_0.json",
|
||||
)
|
||||
(self.config.app_path / f"config/QueueConfig/调度队列_{index+1}.json").rename(
|
||||
self.config.app_path / f"config/QueueConfig/调度队列_{index}.json",
|
||||
(Config.app_path / f"config/QueueConfig/调度队列_{index+1}.json").rename(
|
||||
Config.app_path / f"config/QueueConfig/调度队列_{index}.json",
|
||||
)
|
||||
(self.config.app_path / f"config/QueueConfig/调度队列_0.json").rename(
|
||||
self.config.app_path / f"config/QueueConfig/调度队列_{index+1}.json",
|
||||
(Config.app_path / f"config/QueueConfig/调度队列_0.json").rename(
|
||||
Config.app_path / f"config/QueueConfig/调度队列_{index+1}.json",
|
||||
)
|
||||
|
||||
self.queue_manager.show_SettingBox(index + 1)
|
||||
@@ -233,11 +224,10 @@ class QueueManager(QWidget):
|
||||
|
||||
class QueueSettingBox(QWidget):
|
||||
|
||||
def __init__(self, config: AppConfig, parent=None):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.setObjectName("调度队列管理")
|
||||
self.config = config
|
||||
|
||||
self.pivot = Pivot(self)
|
||||
self.stackedWidget = QStackedWidget(self)
|
||||
@@ -261,14 +251,14 @@ class QueueSettingBox(QWidget):
|
||||
queue_list = self.search_queue()
|
||||
|
||||
qconfig.load(
|
||||
self.config.app_path / "config/临时.json",
|
||||
self.config.queue_config,
|
||||
Config.app_path / "config/临时.json",
|
||||
Config.queue_config,
|
||||
)
|
||||
self.config.clear_queue_config()
|
||||
Config.clear_queue_config()
|
||||
for queue in queue_list:
|
||||
self.add_QueueSettingBox(int(queue[0][5:]))
|
||||
if (self.config.app_path / "config/临时.json").exists():
|
||||
(self.config.app_path / "config/临时.json").unlink()
|
||||
if (Config.app_path / "config/临时.json").exists():
|
||||
(Config.app_path / "config/临时.json").unlink()
|
||||
|
||||
self.switch_SettingBox(index)
|
||||
|
||||
@@ -284,9 +274,9 @@ class QueueSettingBox(QWidget):
|
||||
return None
|
||||
|
||||
qconfig.load(
|
||||
self.config.app_path
|
||||
Config.app_path
|
||||
/ f"config/QueueConfig/{self.script_list[index-1].objectName()}.json",
|
||||
self.config.queue_config,
|
||||
Config.queue_config,
|
||||
)
|
||||
|
||||
if if_change_pivot:
|
||||
@@ -302,17 +292,17 @@ class QueueSettingBox(QWidget):
|
||||
self.script_list.clear()
|
||||
self.pivot.clear()
|
||||
qconfig.load(
|
||||
self.config.app_path / "config/临时.json",
|
||||
self.config.queue_config,
|
||||
Config.app_path / "config/临时.json",
|
||||
Config.queue_config,
|
||||
)
|
||||
self.config.clear_queue_config()
|
||||
if (self.config.app_path / "config/临时.json").exists():
|
||||
(self.config.app_path / "config/临时.json").unlink()
|
||||
Config.clear_queue_config()
|
||||
if (Config.app_path / "config/临时.json").exists():
|
||||
(Config.app_path / "config/临时.json").unlink()
|
||||
|
||||
def add_QueueSettingBox(self, uid: int) -> None:
|
||||
"""添加一个调度队列设置界面"""
|
||||
|
||||
maa_setting_box = QueueMemberSettingBox(self.config, uid, self)
|
||||
maa_setting_box = QueueMemberSettingBox(uid, self)
|
||||
|
||||
self.script_list.append(maa_setting_box)
|
||||
|
||||
@@ -325,10 +315,8 @@ class QueueSettingBox(QWidget):
|
||||
|
||||
queue_list = []
|
||||
|
||||
if (self.config.app_path / "config/QueueConfig").exists():
|
||||
for json_file in (self.config.app_path / "config/QueueConfig").glob(
|
||||
"*.json"
|
||||
):
|
||||
if (Config.app_path / "config/QueueConfig").exists():
|
||||
for json_file in (Config.app_path / "config/QueueConfig").glob("*.json"):
|
||||
with json_file.open("r", encoding="utf-8") as f:
|
||||
info = json.load(f)
|
||||
queue_list.append([json_file.stem, info["QueueSet"]["Name"]])
|
||||
@@ -338,13 +326,11 @@ class QueueSettingBox(QWidget):
|
||||
|
||||
class QueueMemberSettingBox(QWidget):
|
||||
|
||||
def __init__(self, config: AppConfig, uid: int, parent=None):
|
||||
def __init__(self, uid: int, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.setObjectName(f"调度队列_{uid}")
|
||||
|
||||
self.config = config
|
||||
|
||||
layout = QVBoxLayout()
|
||||
|
||||
scrollArea = ScrollArea()
|
||||
@@ -353,10 +339,10 @@ class QueueMemberSettingBox(QWidget):
|
||||
content_widget = QWidget()
|
||||
content_layout = QVBoxLayout(content_widget)
|
||||
|
||||
self.queue_set = self.QueueSetSettingCard(self, self.config.queue_config)
|
||||
self.time = self.TimeSettingCard(self, self.config.queue_config)
|
||||
self.task = self.TaskSettingCard(self, self.config)
|
||||
self.history = self.HistoryCard(self, self.config, f"调度队列_{uid}")
|
||||
self.queue_set = self.QueueSetSettingCard(self)
|
||||
self.time = self.TimeSettingCard(self)
|
||||
self.task = self.TaskSettingCard(self)
|
||||
self.history = self.HistoryCard(self, f"调度队列_{uid}")
|
||||
|
||||
content_layout.addWidget(self.queue_set)
|
||||
content_layout.addWidget(self.time)
|
||||
@@ -372,13 +358,11 @@ class QueueMemberSettingBox(QWidget):
|
||||
|
||||
class QueueSetSettingCard(HeaderCardWidget):
|
||||
|
||||
def __init__(self, parent=None, queue_config: QueueConfig = None):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.setTitle("队列设置")
|
||||
|
||||
self.queue_config = queue_config
|
||||
|
||||
Layout = QVBoxLayout()
|
||||
|
||||
self.card_Name = LineEditSettingCard(
|
||||
@@ -386,13 +370,13 @@ class QueueMemberSettingBox(QWidget):
|
||||
FluentIcon.EDIT,
|
||||
"调度队列名称",
|
||||
"用于标识调度队列的名称",
|
||||
self.queue_config.queueSet_Name,
|
||||
Config.queue_config.queueSet_Name,
|
||||
)
|
||||
self.card_Enable = SwitchSettingCard(
|
||||
FluentIcon.HOME,
|
||||
"状态",
|
||||
"调度队列状态",
|
||||
self.queue_config.queueSet_Enabled,
|
||||
Config.queue_config.queueSet_Enabled,
|
||||
)
|
||||
|
||||
Layout.addWidget(self.card_Name)
|
||||
@@ -402,13 +386,11 @@ class QueueMemberSettingBox(QWidget):
|
||||
|
||||
class TimeSettingCard(HeaderCardWidget):
|
||||
|
||||
def __init__(self, parent=None, queue_config: QueueConfig = None):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.setTitle("定时设置")
|
||||
|
||||
self.queue_config = queue_config
|
||||
|
||||
widget_1 = QWidget()
|
||||
Layout_1 = QVBoxLayout(widget_1)
|
||||
widget_2 = QWidget()
|
||||
@@ -419,71 +401,71 @@ class QueueMemberSettingBox(QWidget):
|
||||
FluentIcon.STOP_WATCH,
|
||||
"定时 1",
|
||||
"",
|
||||
self.queue_config.time_TimeEnabled_0,
|
||||
self.queue_config.time_TimeSet_0,
|
||||
Config.queue_config.time_TimeEnabled_0,
|
||||
Config.queue_config.time_TimeSet_0,
|
||||
)
|
||||
self.card_Time_1 = TimeEditSettingCard(
|
||||
FluentIcon.STOP_WATCH,
|
||||
"定时 2",
|
||||
"",
|
||||
self.queue_config.time_TimeEnabled_1,
|
||||
self.queue_config.time_TimeSet_1,
|
||||
Config.queue_config.time_TimeEnabled_1,
|
||||
Config.queue_config.time_TimeSet_1,
|
||||
)
|
||||
self.card_Time_2 = TimeEditSettingCard(
|
||||
FluentIcon.STOP_WATCH,
|
||||
"定时 3",
|
||||
"",
|
||||
self.queue_config.time_TimeEnabled_2,
|
||||
self.queue_config.time_TimeSet_2,
|
||||
Config.queue_config.time_TimeEnabled_2,
|
||||
Config.queue_config.time_TimeSet_2,
|
||||
)
|
||||
self.card_Time_3 = TimeEditSettingCard(
|
||||
FluentIcon.STOP_WATCH,
|
||||
"定时 4",
|
||||
"",
|
||||
self.queue_config.time_TimeEnabled_3,
|
||||
self.queue_config.time_TimeSet_3,
|
||||
Config.queue_config.time_TimeEnabled_3,
|
||||
Config.queue_config.time_TimeSet_3,
|
||||
)
|
||||
self.card_Time_4 = TimeEditSettingCard(
|
||||
FluentIcon.STOP_WATCH,
|
||||
"定时 5",
|
||||
"",
|
||||
self.queue_config.time_TimeEnabled_4,
|
||||
self.queue_config.time_TimeSet_4,
|
||||
Config.queue_config.time_TimeEnabled_4,
|
||||
Config.queue_config.time_TimeSet_4,
|
||||
)
|
||||
self.card_Time_5 = TimeEditSettingCard(
|
||||
FluentIcon.STOP_WATCH,
|
||||
"定时 6",
|
||||
"",
|
||||
self.queue_config.time_TimeEnabled_5,
|
||||
self.queue_config.time_TimeSet_5,
|
||||
Config.queue_config.time_TimeEnabled_5,
|
||||
Config.queue_config.time_TimeSet_5,
|
||||
)
|
||||
self.card_Time_6 = TimeEditSettingCard(
|
||||
FluentIcon.STOP_WATCH,
|
||||
"定时 7",
|
||||
"",
|
||||
self.queue_config.time_TimeEnabled_6,
|
||||
self.queue_config.time_TimeSet_6,
|
||||
Config.queue_config.time_TimeEnabled_6,
|
||||
Config.queue_config.time_TimeSet_6,
|
||||
)
|
||||
self.card_Time_7 = TimeEditSettingCard(
|
||||
FluentIcon.STOP_WATCH,
|
||||
"定时 8",
|
||||
"",
|
||||
self.queue_config.time_TimeEnabled_7,
|
||||
self.queue_config.time_TimeSet_7,
|
||||
Config.queue_config.time_TimeEnabled_7,
|
||||
Config.queue_config.time_TimeSet_7,
|
||||
)
|
||||
self.card_Time_8 = TimeEditSettingCard(
|
||||
FluentIcon.STOP_WATCH,
|
||||
"定时 9",
|
||||
"",
|
||||
self.queue_config.time_TimeEnabled_8,
|
||||
self.queue_config.time_TimeSet_8,
|
||||
Config.queue_config.time_TimeEnabled_8,
|
||||
Config.queue_config.time_TimeSet_8,
|
||||
)
|
||||
self.card_Time_9 = TimeEditSettingCard(
|
||||
FluentIcon.STOP_WATCH,
|
||||
"定时 10",
|
||||
"",
|
||||
self.queue_config.time_TimeEnabled_9,
|
||||
self.queue_config.time_TimeSet_9,
|
||||
Config.queue_config.time_TimeEnabled_9,
|
||||
Config.queue_config.time_TimeSet_9,
|
||||
)
|
||||
|
||||
Layout_1.addWidget(self.card_Time_0)
|
||||
@@ -503,20 +485,17 @@ class QueueMemberSettingBox(QWidget):
|
||||
|
||||
class TaskSettingCard(HeaderCardWidget):
|
||||
|
||||
def __init__(self, parent=None, config: AppConfig = None):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.setTitle("任务队列")
|
||||
|
||||
self.config = config
|
||||
self.queue_config = config.queue_config
|
||||
|
||||
Layout = QVBoxLayout()
|
||||
|
||||
member_list = self.search_member()
|
||||
|
||||
self.card_Member_1 = NoOptionComboBoxSettingCard(
|
||||
self.queue_config.queue_Member_1,
|
||||
Config.queue_config.queue_Member_1,
|
||||
FluentIcon.APPLICATION,
|
||||
"任务实例 1",
|
||||
"第一个调起的脚本任务实例",
|
||||
@@ -524,7 +503,7 @@ class QueueMemberSettingBox(QWidget):
|
||||
member_list[1],
|
||||
)
|
||||
self.card_Member_2 = NoOptionComboBoxSettingCard(
|
||||
self.queue_config.queue_Member_2,
|
||||
Config.queue_config.queue_Member_2,
|
||||
FluentIcon.APPLICATION,
|
||||
"任务实例 2",
|
||||
"第二个调起的脚本任务实例",
|
||||
@@ -532,7 +511,7 @@ class QueueMemberSettingBox(QWidget):
|
||||
member_list[1],
|
||||
)
|
||||
self.card_Member_3 = NoOptionComboBoxSettingCard(
|
||||
self.queue_config.queue_Member_3,
|
||||
Config.queue_config.queue_Member_3,
|
||||
FluentIcon.APPLICATION,
|
||||
"任务实例 3",
|
||||
"第三个调起的脚本任务实例",
|
||||
@@ -540,7 +519,7 @@ class QueueMemberSettingBox(QWidget):
|
||||
member_list[1],
|
||||
)
|
||||
self.card_Member_4 = NoOptionComboBoxSettingCard(
|
||||
self.queue_config.queue_Member_4,
|
||||
Config.queue_config.queue_Member_4,
|
||||
FluentIcon.APPLICATION,
|
||||
"任务实例 4",
|
||||
"第四个调起的脚本任务实例",
|
||||
@@ -548,7 +527,7 @@ class QueueMemberSettingBox(QWidget):
|
||||
member_list[1],
|
||||
)
|
||||
self.card_Member_5 = NoOptionComboBoxSettingCard(
|
||||
self.queue_config.queue_Member_5,
|
||||
Config.queue_config.queue_Member_5,
|
||||
FluentIcon.APPLICATION,
|
||||
"任务实例 5",
|
||||
"第五个调起的脚本任务实例",
|
||||
@@ -556,7 +535,7 @@ class QueueMemberSettingBox(QWidget):
|
||||
member_list[1],
|
||||
)
|
||||
self.card_Member_6 = NoOptionComboBoxSettingCard(
|
||||
self.queue_config.queue_Member_6,
|
||||
Config.queue_config.queue_Member_6,
|
||||
FluentIcon.APPLICATION,
|
||||
"任务实例 6",
|
||||
"第六个调起的脚本任务实例",
|
||||
@@ -564,7 +543,7 @@ class QueueMemberSettingBox(QWidget):
|
||||
member_list[1],
|
||||
)
|
||||
self.card_Member_7 = NoOptionComboBoxSettingCard(
|
||||
self.queue_config.queue_Member_7,
|
||||
Config.queue_config.queue_Member_7,
|
||||
FluentIcon.APPLICATION,
|
||||
"任务实例 7",
|
||||
"第七个调起的脚本任务实例",
|
||||
@@ -572,7 +551,7 @@ class QueueMemberSettingBox(QWidget):
|
||||
member_list[1],
|
||||
)
|
||||
self.card_Member_8 = NoOptionComboBoxSettingCard(
|
||||
self.queue_config.queue_Member_8,
|
||||
Config.queue_config.queue_Member_8,
|
||||
FluentIcon.APPLICATION,
|
||||
"任务实例 8",
|
||||
"第八个调起的脚本任务实例",
|
||||
@@ -580,7 +559,7 @@ class QueueMemberSettingBox(QWidget):
|
||||
member_list[1],
|
||||
)
|
||||
self.card_Member_9 = NoOptionComboBoxSettingCard(
|
||||
self.queue_config.queue_Member_9,
|
||||
Config.queue_config.queue_Member_9,
|
||||
FluentIcon.APPLICATION,
|
||||
"任务实例 9",
|
||||
"第九个调起的脚本任务实例",
|
||||
@@ -588,7 +567,7 @@ class QueueMemberSettingBox(QWidget):
|
||||
member_list[1],
|
||||
)
|
||||
self.card_Member_10 = NoOptionComboBoxSettingCard(
|
||||
self.queue_config.queue_Member_10,
|
||||
Config.queue_config.queue_Member_10,
|
||||
FluentIcon.APPLICATION,
|
||||
"任务实例 10",
|
||||
"第十个调起的脚本任务实例",
|
||||
@@ -615,8 +594,8 @@ class QueueMemberSettingBox(QWidget):
|
||||
member_list_name = ["禁用"]
|
||||
member_list_text = ["未启用"]
|
||||
|
||||
if (self.config.app_path / "config/MaaConfig").exists():
|
||||
for subdir in (self.config.app_path / "config/MaaConfig").iterdir():
|
||||
if (Config.app_path / "config/MaaConfig").exists():
|
||||
for subdir in (Config.app_path / "config/MaaConfig").iterdir():
|
||||
if subdir.is_dir():
|
||||
member_list_name.append(subdir.name)
|
||||
with (subdir / "config.json").open("r", encoding="utf-8") as f:
|
||||
@@ -632,15 +611,13 @@ class QueueMemberSettingBox(QWidget):
|
||||
|
||||
class HistoryCard(HeaderCardWidget):
|
||||
|
||||
def __init__(self, parent=None, config: AppConfig = None, name: str = None):
|
||||
def __init__(self, parent=None, name: str = None):
|
||||
super().__init__(parent)
|
||||
self.setTitle("历史运行记录")
|
||||
|
||||
self.config = config
|
||||
|
||||
self.text = TextBrowser()
|
||||
self.text.setMinimumHeight(300)
|
||||
history = self.config.get_history(name)
|
||||
history = Config.get_history(name)
|
||||
self.text.setPlainText(history["History"])
|
||||
|
||||
self.viewLayout.addWidget(self.text)
|
||||
|
||||
@@ -51,8 +51,8 @@ import requests
|
||||
|
||||
uiLoader = QUiLoader()
|
||||
|
||||
from app.core import AppConfig, MainInfoBar
|
||||
from app.services import Notification, CryptoHandler, SystemHandler
|
||||
from app.core import Config, MainInfoBar
|
||||
from app.services import Notify, Crypto, System
|
||||
from app.utils import Updater, version_text
|
||||
from .Widget import InputMessageBox, LineEditSettingCard
|
||||
|
||||
@@ -61,21 +61,12 @@ class Setting(QWidget):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
config: AppConfig,
|
||||
notify: Notification,
|
||||
crypto: CryptoHandler,
|
||||
system: SystemHandler,
|
||||
parent=None,
|
||||
):
|
||||
super().__init__(parent)
|
||||
|
||||
self.setObjectName("设置")
|
||||
|
||||
self.config = config
|
||||
self.notify = notify
|
||||
self.crypto = crypto
|
||||
self.system = system
|
||||
|
||||
setTheme(Theme.AUTO)
|
||||
|
||||
layout = QVBoxLayout()
|
||||
@@ -86,16 +77,16 @@ class Setting(QWidget):
|
||||
content_widget = QWidget()
|
||||
content_layout = QVBoxLayout(content_widget)
|
||||
|
||||
self.function = FunctionSettingCard(self, self.config)
|
||||
self.start = StartSettingCard(self, self.config)
|
||||
self.ui = UiSettingCard(self, self.config)
|
||||
self.notification = NotifySettingCard(self, self.config)
|
||||
self.function = FunctionSettingCard(self)
|
||||
self.start = StartSettingCard(self)
|
||||
self.ui = UiSettingCard(self)
|
||||
self.notification = NotifySettingCard(self)
|
||||
self.security = SecuritySettingCard(self)
|
||||
self.updater = UpdaterSettingCard(self, self.config)
|
||||
self.other = OtherSettingCard(self, self.config)
|
||||
self.updater = UpdaterSettingCard(self)
|
||||
self.other = OtherSettingCard(self)
|
||||
|
||||
self.function.card_IfAllowSleep.checkedChanged.connect(self.system.set_Sleep)
|
||||
self.start.card_IfSelfStart.checkedChanged.connect(self.system.set_SelfStart)
|
||||
self.function.card_IfAllowSleep.checkedChanged.connect(System.set_Sleep)
|
||||
self.start.card_IfSelfStart.checkedChanged.connect(System.set_SelfStart)
|
||||
self.security.card_changePASSWORD.clicked.connect(self.change_PASSWORD)
|
||||
self.updater.card_CheckUpdate.clicked.connect(self.get_update)
|
||||
self.other.card_Tips.clicked.connect(self.show_tips)
|
||||
@@ -117,7 +108,7 @@ class Setting(QWidget):
|
||||
def check_PASSWORD(self) -> None:
|
||||
"""检查并配置管理密钥"""
|
||||
|
||||
if self.config.key_path.exists():
|
||||
if Config.key_path.exists():
|
||||
return None
|
||||
|
||||
while True:
|
||||
@@ -129,7 +120,7 @@ class Setting(QWidget):
|
||||
"密码",
|
||||
)
|
||||
if choice.exec() and choice.input.text() != "":
|
||||
self.crypto.get_PASSWORD(choice.input.text())
|
||||
Crypto.get_PASSWORD(choice.input.text())
|
||||
break
|
||||
else:
|
||||
choice = MessageBox(
|
||||
@@ -146,8 +137,8 @@ class Setting(QWidget):
|
||||
"""修改管理密钥"""
|
||||
|
||||
# 获取用户信息
|
||||
self.config.cur.execute("SELECT * FROM adminx WHERE True")
|
||||
data = self.config.cur.fetchall()
|
||||
Config.cur.execute("SELECT * FROM adminx WHERE True")
|
||||
data = Config.cur.fetchall()
|
||||
|
||||
if len(data) == 0:
|
||||
|
||||
@@ -168,7 +159,7 @@ class Setting(QWidget):
|
||||
)
|
||||
if choice.exec() and choice.input.text() != "":
|
||||
# 修改管理密钥
|
||||
self.crypto.get_PASSWORD(choice.input.text())
|
||||
Crypto.get_PASSWORD(choice.input.text())
|
||||
choice = MessageBox(
|
||||
"操作成功",
|
||||
"管理密钥修改成功",
|
||||
@@ -202,7 +193,7 @@ class Setting(QWidget):
|
||||
if choice.exec() and choice.input.text() != "":
|
||||
|
||||
# 验证旧管理密钥
|
||||
if self.crypto.check_PASSWORD(choice.input.text()):
|
||||
if Crypto.check_PASSWORD(choice.input.text()):
|
||||
|
||||
PASSWORD_old = choice.input.text()
|
||||
# 获取新的管理密钥
|
||||
@@ -217,7 +208,7 @@ class Setting(QWidget):
|
||||
if choice.exec() and choice.input.text() != "":
|
||||
|
||||
# 修改管理密钥
|
||||
self.crypto.change_PASSWORD(
|
||||
Crypto.change_PASSWORD(
|
||||
data, PASSWORD_old, choice.input.text()
|
||||
)
|
||||
choice = MessageBox(
|
||||
@@ -261,7 +252,7 @@ class Setting(QWidget):
|
||||
"""检查主程序版本更新,返回更新信息"""
|
||||
|
||||
# 从本地版本信息文件获取当前版本信息
|
||||
with self.config.version_path.open(mode="r", encoding="utf-8") as f:
|
||||
with Config.version_path.open(mode="r", encoding="utf-8") as f:
|
||||
version_current = json.load(f)
|
||||
main_version_current = list(
|
||||
map(int, version_current["main_version"].split("."))
|
||||
@@ -297,7 +288,7 @@ class Setting(QWidget):
|
||||
"""检查版本更新,调起文件下载进程"""
|
||||
|
||||
# 从本地版本信息文件获取当前版本信息
|
||||
with self.config.version_path.open(mode="r", encoding="utf-8") as f:
|
||||
with Config.version_path.open(mode="r", encoding="utf-8") as f:
|
||||
version_current = json.load(f)
|
||||
main_version_current = list(
|
||||
map(int, version_current["main_version"].split("."))
|
||||
@@ -306,7 +297,7 @@ class Setting(QWidget):
|
||||
map(int, version_current["updater_version"].split("."))
|
||||
)
|
||||
# 检查更新器是否存在
|
||||
if not (self.config.app_path / "Updater.exe").exists():
|
||||
if not (Config.app_path / "Updater.exe").exists():
|
||||
updater_version_current = [0, 0, 0, 0]
|
||||
|
||||
# 从远程服务器获取最新版本信息
|
||||
@@ -369,7 +360,7 @@ class Setting(QWidget):
|
||||
if updater_version_remote > updater_version_current:
|
||||
# 创建更新进程
|
||||
self.updater = Updater(
|
||||
self.config.app_path,
|
||||
Config.app_path,
|
||||
"AUTO_MAA更新器",
|
||||
main_version_remote,
|
||||
updater_version_remote,
|
||||
@@ -392,7 +383,7 @@ class Setting(QWidget):
|
||||
"""更新主程序"""
|
||||
|
||||
subprocess.Popen(
|
||||
str(self.config.app_path / "Updater.exe"),
|
||||
str(Config.app_path / "Updater.exe"),
|
||||
shell=True,
|
||||
creationflags=subprocess.CREATE_NO_WINDOW,
|
||||
)
|
||||
@@ -411,27 +402,25 @@ class Setting(QWidget):
|
||||
|
||||
class FunctionSettingCard(HeaderCardWidget):
|
||||
|
||||
def __init__(self, parent=None, config: AppConfig = None):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.setTitle("功能")
|
||||
|
||||
self.config = config.global_config
|
||||
|
||||
Layout = QVBoxLayout()
|
||||
|
||||
self.card_IfAllowSleep = SwitchSettingCard(
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="启动时阻止系统休眠",
|
||||
content="仅阻止电脑自动休眠,不会影响屏幕是否熄灭",
|
||||
configItem=self.config.function_IfAllowSleep,
|
||||
configItem=Config.global_config.function_IfAllowSleep,
|
||||
)
|
||||
|
||||
self.card_IfSilence = SwitchSettingCard(
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="静默模式",
|
||||
content="将各代理窗口置于后台运行,减少对前台的干扰",
|
||||
configItem=self.config.function_IfSilence,
|
||||
configItem=Config.global_config.function_IfSilence,
|
||||
)
|
||||
|
||||
# 添加各组到设置卡中
|
||||
@@ -443,27 +432,25 @@ class FunctionSettingCard(HeaderCardWidget):
|
||||
|
||||
class StartSettingCard(HeaderCardWidget):
|
||||
|
||||
def __init__(self, parent=None, config: AppConfig = None):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.setTitle("启动")
|
||||
|
||||
self.config = config.global_config
|
||||
|
||||
Layout = QVBoxLayout()
|
||||
|
||||
self.card_IfSelfStart = SwitchSettingCard(
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="开机时自动启动",
|
||||
content="将AUTO_MAA添加到开机启动项",
|
||||
configItem=self.config.start_IfSelfStart,
|
||||
configItem=Config.global_config.start_IfSelfStart,
|
||||
)
|
||||
|
||||
self.card_IfRunDirectly = SwitchSettingCard(
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="启动后直接运行",
|
||||
content="启动AUTO_MAA后自动运行任务",
|
||||
configItem=self.config.start_IfRunDirectly,
|
||||
configItem=Config.global_config.start_IfRunDirectly,
|
||||
)
|
||||
|
||||
# 添加各组到设置卡中
|
||||
@@ -477,27 +464,25 @@ class StartSettingCard(HeaderCardWidget):
|
||||
|
||||
class UiSettingCard(HeaderCardWidget):
|
||||
|
||||
def __init__(self, parent=None, config: AppConfig = None):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.setTitle("界面")
|
||||
|
||||
self.config = config.global_config
|
||||
|
||||
Layout = QVBoxLayout()
|
||||
|
||||
self.card_IfShowTray = SwitchSettingCard(
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="显示托盘图标",
|
||||
content="常态显示托盘图标",
|
||||
configItem=self.config.ui_IfShowTray,
|
||||
configItem=Config.global_config.ui_IfShowTray,
|
||||
)
|
||||
|
||||
self.card_IfToTray = SwitchSettingCard(
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="最小化到托盘",
|
||||
content="最小化时隐藏到托盘",
|
||||
configItem=self.config.ui_IfToTray,
|
||||
configItem=Config.global_config.ui_IfToTray,
|
||||
)
|
||||
|
||||
# 添加各组到设置卡中
|
||||
@@ -509,23 +494,21 @@ class UiSettingCard(HeaderCardWidget):
|
||||
|
||||
class NotifySettingCard(HeaderCardWidget):
|
||||
|
||||
def __init__(self, parent=None, config: AppConfig = None):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.setTitle("通知")
|
||||
|
||||
self.config = config
|
||||
|
||||
Layout = QVBoxLayout()
|
||||
|
||||
self.card_IfPushPlyer = SwitchSettingCard(
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="推送系统通知",
|
||||
content="推送系统级通知,不会在通知中心停留",
|
||||
configItem=self.config.global_config.notify_IfPushPlyer,
|
||||
configItem=Config.global_config.notify_IfPushPlyer,
|
||||
)
|
||||
|
||||
self.card_SendMail = self.SendMailSettingCard(self, self.config)
|
||||
self.card_SendMail = self.SendMailSettingCard(self)
|
||||
|
||||
Layout.addWidget(self.card_IfPushPlyer)
|
||||
Layout.addWidget(self.card_SendMail)
|
||||
@@ -534,7 +517,7 @@ class NotifySettingCard(HeaderCardWidget):
|
||||
|
||||
class SendMailSettingCard(ExpandGroupSettingCard):
|
||||
|
||||
def __init__(self, parent=None, config: AppConfig = None):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(
|
||||
FluentIcon.SETTING,
|
||||
"推送邮件通知",
|
||||
@@ -542,8 +525,6 @@ class NotifySettingCard(HeaderCardWidget):
|
||||
parent,
|
||||
)
|
||||
|
||||
self.config = config.global_config
|
||||
|
||||
widget = QWidget()
|
||||
Layout = QVBoxLayout(widget)
|
||||
|
||||
@@ -551,7 +532,7 @@ class NotifySettingCard(HeaderCardWidget):
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="推送邮件通知",
|
||||
content="是否启用邮件通知功能",
|
||||
configItem=self.config.notify_IfSendMail,
|
||||
configItem=Config.global_config.notify_IfSendMail,
|
||||
)
|
||||
|
||||
self.MailAddress = LineEditSettingCard(
|
||||
@@ -559,14 +540,14 @@ class NotifySettingCard(HeaderCardWidget):
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="邮箱地址",
|
||||
content="接收通知的邮箱地址",
|
||||
configItem=self.config.notify_MailAddress,
|
||||
configItem=Config.global_config.notify_MailAddress,
|
||||
)
|
||||
|
||||
self.card_IfSendErrorOnly = SwitchSettingCard(
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="仅推送异常信息",
|
||||
content="仅在任务出现异常时推送通知",
|
||||
configItem=self.config.notify_IfSendErrorOnly,
|
||||
configItem=Config.global_config.notify_IfSendErrorOnly,
|
||||
)
|
||||
|
||||
Layout.addWidget(self.card_IfSendMail)
|
||||
@@ -603,20 +584,18 @@ class SecuritySettingCard(HeaderCardWidget):
|
||||
|
||||
class UpdaterSettingCard(HeaderCardWidget):
|
||||
|
||||
def __init__(self, parent=None, config: AppConfig = None):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.setTitle("更新")
|
||||
|
||||
self.config = config.global_config
|
||||
|
||||
Layout = QVBoxLayout()
|
||||
|
||||
self.card_IfAutoUpdate = SwitchSettingCard(
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="自动检查更新",
|
||||
content="将在启动时自动检查AUTO_MAA是否有新版本",
|
||||
configItem=self.config.update_IfAutoUpdate,
|
||||
configItem=Config.global_config.update_IfAutoUpdate,
|
||||
)
|
||||
|
||||
self.card_CheckUpdate = PushSettingCard(
|
||||
@@ -634,13 +613,11 @@ class UpdaterSettingCard(HeaderCardWidget):
|
||||
|
||||
class OtherSettingCard(HeaderCardWidget):
|
||||
|
||||
def __init__(self, parent=None, config: AppConfig = None):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.setTitle("其他")
|
||||
|
||||
self.config = config.global_config
|
||||
|
||||
Layout = QVBoxLayout()
|
||||
|
||||
self.card_Tips = PushSettingCard(
|
||||
|
||||
@@ -176,7 +176,7 @@ class UpdateProcess(QThread):
|
||||
elif self.name == "AUTO_MAA主程序":
|
||||
version_info["main_version"] = ".".join(map(str, self.main_version))
|
||||
with open(self.version_path, "w", encoding="utf-8") as f:
|
||||
json.dump(version_info, f, indent=4)
|
||||
json.dump(version_info, f, ensure_ascii=False, indent=4)
|
||||
|
||||
# 主程序更新完成后打开AUTO_MAA
|
||||
if self.name == "AUTO_MAA主程序":
|
||||
|
||||
Binary file not shown.
@@ -23,8 +23,8 @@
|
||||
"Connect.AdbLiteEnabled": "False",
|
||||
"Connect.AdbPath": "C:\\Program Files\\Netease\\MuMu Player 12\\shell\\adb.exe",
|
||||
"Connect.AdbReplaced": "False",
|
||||
"Connect.Address": "127.0.0.1:16448",
|
||||
"Connect.AddressHistory": "[\"127.0.0.1:16448\",\"127.0.0.1:16416\",\"127.0.0.1:16384\"]",
|
||||
"Connect.Address": "127.0.0.1:16416",
|
||||
"Connect.AddressHistory": "[\"127.0.0.1:16416\",\"127.0.0.1:16448\",\"127.0.0.1:16384\"]",
|
||||
"Connect.AllowADBHardRestart": "True",
|
||||
"Connect.AllowADBRestart": "True",
|
||||
"Connect.AlwaysAutoDetect": "False",
|
||||
@@ -78,13 +78,14 @@
|
||||
"GUI.Placement": "{\"Length\":44,\"Flags\":0,\"ShowCmd\":1,\"MinPosition\":{\"X\":-1,\"Y\":-1},\"MaxPosition\":{\"X\":-1,\"Y\":-1},\"NormalPosition\":{\"Left\":680,\"Top\":314,\"Right\":1880,\"Bottom\":1214}}",
|
||||
"GUI.Placement.Load": "True",
|
||||
"GUI.Placement.SaveOnClosing": "True",
|
||||
"GUI.UseAlternateStage": "True",
|
||||
"GUI.UseAlternateStage": "False",
|
||||
"GUI.UseLogItemDateFormat": "False",
|
||||
"GUI.UseTray": "True",
|
||||
"GUI.WindowTitlePrefix": "",
|
||||
"Guide.StepIndex": "4",
|
||||
"Infrast.ContinueTraining": "True",
|
||||
"Infrast.Control.IsChecked": "True",
|
||||
"Infrast.CustomInfrastEnabled": "True",
|
||||
"Infrast.CustomInfrastEnabled": "False",
|
||||
"Infrast.CustomInfrastFile": "D:\\AUTO\\MAA\\合成玉排班.json",
|
||||
"Infrast.CustomInfrastPlanIndex": "2",
|
||||
"Infrast.CustomInfrastPlanShowInFightSettings": "False",
|
||||
@@ -118,10 +119,10 @@
|
||||
"MainFunction.Drops.ItemName": "不选择",
|
||||
"MainFunction.Drops.Quantity": "5",
|
||||
"MainFunction.InverseMode": "False",
|
||||
"MainFunction.PostActions": "0",
|
||||
"MainFunction.PostActions": "12",
|
||||
"MainFunction.Series.Quantity": "6",
|
||||
"MainFunction.Stage1": "SK-5",
|
||||
"MainFunction.Stage2": "1-7",
|
||||
"MainFunction.Stage1": "1-7",
|
||||
"MainFunction.Stage2": "",
|
||||
"MainFunction.Stage3": "",
|
||||
"MainFunction.TimesLimited": "False",
|
||||
"MainFunction.TimesLimited.Quantity": "5",
|
||||
@@ -137,7 +138,7 @@
|
||||
"Mall.CreditVisitFriendsEnabled": "True",
|
||||
"Mall.CreditVisitOnceADay": "True",
|
||||
"Mall.CreidtReserveMaxCredit": "False",
|
||||
"Mall.LastCreditVisitFriendsTime": "2024/10/23 00:00:00",
|
||||
"Mall.LastCreditVisitFriendsTime": "2025/01/01 00:00:00",
|
||||
"Mission.ReceiveAward": "True",
|
||||
"Mission.ReceiveFreeRecruit": "True",
|
||||
"Mission.ReceiveMail": "True",
|
||||
@@ -177,7 +178,7 @@
|
||||
"Roguelike.CoreChar": "",
|
||||
"Roguelike.DeepExplorationAutoIterate": "False",
|
||||
"Roguelike.DeploymentWithPause": "False",
|
||||
"Roguelike.Difficulty": "0",
|
||||
"Roguelike.Difficulty": "2",
|
||||
"Roguelike.ExitAtFinalBoss": "False",
|
||||
"Roguelike.InvestmentEnabled": "True",
|
||||
"Roguelike.InvestmentEnterSecondFloor": "True",
|
||||
@@ -195,7 +196,7 @@
|
||||
"Roguelike.RoguelikeExpectedCollapsalParadigms": "",
|
||||
"Roguelike.RoguelikeOnlyStartWithEliteTwo": "False",
|
||||
"Roguelike.RoguelikeStartWithEliteTwo": "False",
|
||||
"Roguelike.RoguelikeTheme": "Phantom",
|
||||
"Roguelike.RoguelikeTheme": "Sarkaz",
|
||||
"Roguelike.RoguelikeUseSupportUnit": "False",
|
||||
"Roguelike.Roles": "",
|
||||
"Roguelike.Squad": "",
|
||||
@@ -209,7 +210,7 @@
|
||||
"Start.BlockSleepWithScreenOn": "True",
|
||||
"Start.ClientType": "Official",
|
||||
"Start.CopilotWithScript": "False",
|
||||
"Start.EmulatorAddCommand": "-v 2",
|
||||
"Start.EmulatorAddCommand": "-v 1",
|
||||
"Start.EmulatorPath": "C:\\Program Files\\Netease\\MuMu Player 12\\shell\\MuMuPlayer.exe",
|
||||
"Start.EmulatorWaitSeconds": "30",
|
||||
"Start.EndsWithScript": "",
|
||||
@@ -221,10 +222,10 @@
|
||||
"Start.StartEmulator": "True",
|
||||
"Start.StartsWithScript": "",
|
||||
"TaskQueue.AutoRoguelike.IsChecked": "False",
|
||||
"TaskQueue.Base.IsChecked": "False",
|
||||
"TaskQueue.Combat.IsChecked": "False",
|
||||
"TaskQueue.Mall.IsChecked": "False",
|
||||
"TaskQueue.Mission.IsChecked": "False",
|
||||
"TaskQueue.Base.IsChecked": "True",
|
||||
"TaskQueue.Combat.IsChecked": "True",
|
||||
"TaskQueue.Mall.IsChecked": "True",
|
||||
"TaskQueue.Mission.IsChecked": "True",
|
||||
"TaskQueue.Order.AutoRoguelike": "6",
|
||||
"TaskQueue.Order.Base": "2",
|
||||
"TaskQueue.Order.Combat": "3",
|
||||
@@ -236,8 +237,8 @@
|
||||
"TaskQueue.Order.WakeUp": "0",
|
||||
"TaskQueue.Reclamation.IsChecked": "False",
|
||||
"TaskQueue.ReclamationAlgorithm2.IsChecked": "False",
|
||||
"TaskQueue.Recruiting.IsChecked": "False",
|
||||
"TaskQueue.WakeUp.IsChecked": "False",
|
||||
"TaskQueue.Recruiting.IsChecked": "True",
|
||||
"TaskQueue.WakeUp.IsChecked": "True",
|
||||
"VersionUpdate.AutoDownloadUpdatePackage": "True",
|
||||
"VersionUpdate.AutoInstallUpdatePackage": "True",
|
||||
"VersionUpdate.body": "## v5.6.0-beta.2\n\n### 新增 | New\n\n* 外部通知支持多选 (#10395) @ABA2396\n* add Qmsg notification (#10358) @octopusYan\n* 允许手动指定WPFGUI中干员名称显示语言 (#10310) @ABA2396 @Manicsteiner\n* GetLocalizedNames for Infrast and Copilot output (#10335) @Constrat\n* Reclamation for YostarJP (#10414) @Manicsteiner\n* 生息演算添加沙中之火选择项 @ABA2396\n* 适配「词祭」界面主题 (#10331) @Constrat @ManicSteiner @HX3N @SherkeyXD\n\n### 改进 | Improved\n\n* 全肉鸽招募适配娜仁图亚、艾拉 (#10385) @Daydreamer114\n* Mumu截图增强路径清空时不再检查路径是否存在 @status102\n* duplicates templates from I.S. (#10376) @Constrat\n* 优化外部通知界面显示 (#10363) @ABA2396\n* 更新 bug issue 模板 (#10357) @Rbqwow\n* 重构 OperBox 输出与显示 (#10320) @ABA2396\n* 重构定时器和重启询问 (#10078) @ABA2396\n* Win10以上系统在退出时Wpf不再清除Toast (#10307) @status102\n* 第一次启动时默认不勾选肉鸽和生息演算 @ABA2396\n* 优化动编队日志输出 @ABA2396\n* 优化生息演算 (#10411) @Alan-Charred @status102 @ABA2396\n\n### 修复 | Fix\n\n* FC rerun navigation fix EN @Constrat\n* 生息演算主题读取配置错误 @ABA2396\n* 萨卡兹肉鸽多选招募券模板错误 @ABA2396\n* 肉鸽编队检测在未触底时返回 true (#10396) @Alan-Charred\n* DoDragDrop 拖动操作已在进行中 (#10368) @ABA2396\n* insert delay after SquadConfirm @Constrat\n* 使用匹配后偏移代替每日任务 @status102\n* add ocrReplace for JP \"Reclamation2CopiousCoppice\" (#10362) @Daydreamer114\n* 勾选启动MAA后直接最小化后点击隐藏托盘图标后无法显示MAA @ABA2396\n* add delay after selecting clue @Constrat\n* SL 导航错误 @ABA2396\n* 修复调试版本判断条件 @SherkeyXD\n* 多配置下公告和更新日志显示异常 @ABA2396\n* 修复保全战斗在core干员重复时只会放1次bug (#10306) @status102\n* ProxyType 重启不生效 @ABA2396\n* EN needs templates for clue exchange the number font is different, score too low @Constrat\n* sarkaz 仓库识别错误 @ABA2396\n\n### 文档 | Docs\n\n* 贡献者头像添加 105 上限 (#10351) @MistEO\n\n### 其他 | Other\n\n* `std::ranges::views::join` with LLVM clang 16 on darwin (#10309) @Cryolitia\n* impossiblity of fetch-depth modification. reverting + generic perfs @Constrat\n* rev-list instead of rev-parse @Constrat\n* revert to simple if @Constrat\n* fetching depth 0 @Constrat\n* roi 错误 @ABA2396\n* remove \"\" in nightly fix #10308 @Constrat\n* 生息演算2刷开局清空编队干员 (#10359) @Daydreamer114\n* 重构 FightSettingsUserControl (#10407) @ABA2396\n* CopilotViewModel (#10099) @Manicsteiner\n* git blame ignore @Constrat\n* 优化界面显示 @ABA2396\n* smoking-test中肉鸽参数更新 @SherkeyXD\n* 使用变换后的图像进行技能按钮识别 (#10293) @horror-proton\n* OTA打包时对跳过的版本做删除处理 (#10020) @SherkeyXD\n* 公招错误时保存截图 @zzyyyl\n* 调用PowerManagement.Shutdown();后再次调用Bootstrapper.Shutdown(); @ABA2396\n* 关机前尝试保存配置 @ABA2396\n* 调整令牌关闭强度 @ABA2396\n* 迁移公告相关配置 (#10399) @status102\n* bump maa-cli to 0.4.12 (#10390) @wangl-cc\n* 调整 check link 提示样式 @ABA2396\n* 对comment中的未知链接进行提醒 (#10379) @IzakyL @ABA2396\n* update ignore templates @Constrat\n* 获取任务端口无效时不进行轮询 (#10321) @ABA2396\n* use CsWin32 source generator instead of random pinvoke library (#10361) @dantmnf\n* 删除子模块 @ABA2396\n* remove MaaDeps submodule (#10354) @dantmnf\n* RoguelikeRoutingTaskPlugin.h missing VS22 filter @Constrat\n* bump zzyyyl/issue-checker from 1.8 to 1.9 @zzyyyl\n* 公招识别拥有全干员时不显示未拥有干员数量 @ABA2396\n* YostarJP ocr fix @Manicsteiner\n* JP ZH-TW GPU option & reclamation translation @Manicsteiner\n* KR GpuDeprecated translation @HX3N\n* fix WPF Warning @SherkeyXD\n* 修改过时的Binding方法 @SherkeyXD\n* YostarJP FC navigation (#10316) @Manicsteiner\n* 整理 tasks.json 中记录的肉鸽插件参数 (#10290) @Alan-Charred\n* clearout git blame @Constrat\n* MuMu12EmulatorPath Placeholder 添加示例提示 @ABA2396\n* remove last checked commit @Constrat\n* auto blame ignore @github-actions[bot]\n* git blame added styling commits (#10283) @Constrat\n* smoking-test添加领取奖励的测试 @SherkeyXD\n* 移除tasks中的默认值 @SherkeyXD\n\n**Full Changelog**: [v5.6.0-beta.1 -> v5.6.0-beta.2](https://github.com/MaaAssistantArknights/MaaAssistantArknights/compare/v5.6.0-beta.1...v5.6.0-beta.2)\n",
|
||||
@@ -266,9 +267,9 @@
|
||||
"GUI.LastBuyWineTime": "2024/04/15 00:00:00",
|
||||
"GUI.Localization": "zh-cn",
|
||||
"GUI.LogItemDateFormatString": "HH:mm:ss",
|
||||
"GUI.MinimizeToTray": "False",
|
||||
"GUI.MinimizeToTray": "True",
|
||||
"GUI.OperNameLanguage": "OperNameLanguageMAA",
|
||||
"GUI.Placement": "{\"Length\":44,\"Flags\":0,\"ShowCmd\":1,\"MinPosition\":{\"X\":-1,\"Y\":-1},\"MaxPosition\":{\"X\":-1,\"Y\":-1},\"NormalPosition\":{\"Left\":512,\"Top\":296,\"Right\":1712,\"Bottom\":1196}}",
|
||||
"GUI.Placement": "{\"Length\":44,\"Flags\":0,\"ShowCmd\":1,\"MinPosition\":{\"X\":-1,\"Y\":-1},\"MaxPosition\":{\"X\":-1,\"Y\":-1},\"NormalPosition\":{\"Left\":934,\"Top\":297,\"Right\":2134,\"Bottom\":1197}}",
|
||||
"GUI.Placement.Load": "True",
|
||||
"GUI.Placement.SaveOnClosing": "True",
|
||||
"GUI.SoberLanguage": "zh-cn",
|
||||
@@ -278,8 +279,8 @@
|
||||
"HotKeys": "{\"ShowGui\":{\"Key\":56,\"Modifiers\":7}}",
|
||||
"Roguelike.RoguelikeStartWithSelectList": "Roguelike@LastReward Roguelike@LastReward4 Sarkaz@Roguelike@LastReward5",
|
||||
"Start.MinimizeDirectly": "False",
|
||||
"Start.OpenEmulatorAfterLaunch": "False",
|
||||
"Start.RunDirectly": "False",
|
||||
"Start.OpenEmulatorAfterLaunch": "True",
|
||||
"Start.RunDirectly": "True",
|
||||
"Timer.CustomConfig": "False",
|
||||
"Timer.ForceScheduledStart": "False",
|
||||
"Timer.ShowWindowBeforeForceScheduledStart": "False",
|
||||
@@ -318,12 +319,12 @@
|
||||
"VersionUpdate.AllowNightlyUpdates": "False",
|
||||
"VersionUpdate.AutoDownloadUpdatePackage": "True",
|
||||
"VersionUpdate.AutoInstallUpdatePackage": "True",
|
||||
"VersionUpdate.body": "## v5.12.3\n\n### 停不下来了 | Highlight\n\n* Base navigation fixes for the overseas clients\n\n### 新增 | New\n\n* 繁中服更新活動導航\"懷黍離\" (#11592) @XuQingTW\n\n### 修复 | Fix\n\n* 繁中服-生息演算中,完成生存週期畫面、大地圖畫面卡住 (#11649) @momomochi987\n* 繁中服 生息演算讀檔畫面卡住 (#11646) @momomochi987\n* 基建修复4 识别不到缩小状态下的后两个宿舍 @ABA2396\n* 38c8dd8 68357b9 modified base tasks in Official. Global needs custom ROI to work @Constrat\n* 380bf68 modified Base Infrast Siege for all clients. Reverting for global and co. @Constrat\n\n### 文档 | Docs\n\n* README 移除 MaaX,更换前端仓库地址 (#11636) @Rbqwow\n\n### 其他 | Other\n\n* 補上繁中服的加工站、訓練室相關內容 (#11648) @momomochi987\n* 调整基建宿舍阈值 @ABA2396\n* 调整基建发电站阈值 @ABA2396\n\n**Full Changelog**: [v5.12.2 -> v5.12.3](https://github.com/MaaAssistantArknights/MaaAssistantArknights/compare/v5.12.2...v5.12.3)\n",
|
||||
"VersionUpdate.body": "## v5.12.0-beta.1\n\n### 真的没有摸鱼吗 | Highlight\n\n* 添加了种子存钱的功能,在选择 **萨卡兹** 主题,**刷源石锭** 模式,**点刺成锭分队** or **后勤分队** 时,高级设置中会出现 **启用种子刷钱(美愿)** 选项。\n* 种子固定为存钱种,若使用后勤存钱,请确保解锁美愿。种子难度为 6 难,由于难度设置仍然生效,可设为 “当前” 或 16 难(若有需要)。\n* 公招选择 **手动确认 1/5/6 星** 后,若出现 1/5/6 星,将不会计数,继续在下一个招募格内招募。\n\n#### 其他\n\n* 【**萨卡兹的无终奇语**】 【**内容拓展·二**】的资源内容暂时没有更新,在新增关卡中会出现 “关卡识别错误” 的情况,可能会尽快修复。\n* 新增了部分导航,改进了肉鸽流程\n* 修复博朗台模式等待异常\n* 修复了一些已知问题\n\n### 新增 | New\n\n* 繁中服「源石塵行動」復刻活動導航 @momomochi987\n* 点刺、后勤种子存钱 (#11521) @Daydreamer114 @ABA2396\n* 肉鸽满级自动停止选项 (#11466) @BxFS @Constrat @momomochi987 @status102\n* 为肉鸽开始探索添加 cd 识别 (#11443) @Daydreamer114\n* 萨卡兹肉鸽冰川期作战策略 @Daydreamer114\n* 萨卡兹内容拓展II点刺进入商店获得构想 (#11509) @Daydreamer114\n* 不自动招募1/5/6星干员时,不计入最大确认招募次数 (#11380) @Roland125 @horror-proton\n* 干员识别排除当前客户端未出干员 @ABA2396\n* 肉鸽开局干员列表排除当前客户端未出干员 @ABA2396\n\n### 改进 | Improved\n\n* 新增投掷手干员组并调整优先级 @Daydreamer114\n* 优化傀影肉鸽雪山上的来客ew部署 (#11195) @Daydreamer114\n\n### 修复 | Fix\n\n* 肉鸽烧热水没烧出来会从预设难度开始,而不是返回n0 @ABA2396\n* 删除傀影肉鸽远方来客意义不明的撤退 (#11194) @Daydreamer114\n* 博朗台计算等待时间失败数据处理 @status102\n* 修正nothing to select情况下的判断逻辑 @Roland125\n* update Collect Rewards template for EN fix #11485 @Constrat\n* tw OcrReplace 肉鸽招募助战 (#11487) @Saratoga-Official\n* 繁中服作戰失敗畫面卡住 (#11479) @momomochi987\n* InitialDrop.png更新 @Constrat @BxFS\n* txwy duplicates in tasks.json @Constrat\n* 更新 \"视相\" 主题后未关闭退出基建弹窗时无法回到主界面 @ABA2396\n* `手动输入关卡名` 与 `使用剩余理智` 选项无法保存 @ABA2396\n\n### 文档 | Docs\n\n* 肉鸽辅助协议文档翻译 (#11360) @Windsland52\n* 为肉鸽参数 start_with_seed 添加文档 (#11531) @Daydreamer114\n\n### 其他 | Other\n\n* manual recursion + robocopy for smoke-testing (#11458) @Constrat\n* implement cache for smoke-test (#11457) @Constrat\n* Release 模式下,如文件夹中包含 DEBUG.txt 也会输出 DBG 日志 (#11496) @ABA2396\n* ProcessTask的Action 新增 Input (#11521) @Daydreamer114 @ABA2396\n* increase fetch depth for release nightly-ota to generate tags (might need successive increases) @Constrat\n* delay and retry downloads on resource updater (#11504) @Constrat\n* use read/write secret to delete cache on pr merge @Constrat\n* checkout depth for nightly ota @Constrat\n* 移动企鹅物流及一图流上报设置 至 运行设置 @status102\n* Translations update from MAA Weblate (#11524) @AlisaAkiron\n* ignore blame for e3d63894b28b2ef5e2405e144a32a6981de5e1b2 oxipng optimization @Constrat\n* disable link checker in issues and PRs (#11506) @Constrat\n* use API for cache-deletion @Constrat\n* 移除不再使用的代码 for 最小化启动模拟器 @status102\n* move `push tag` later in the workflow in case or errors (#11480) @Constrat\n* 上报添加 User-Agent @ABA2396\n* 修改上报抬头 @ABA2396\n* Use %B to consider header for skip changelog @Constrat\n* try setup dotnet cache @Constrat\n* EN duplicates in tasks.json + SSS Buffs @Constrat\n* YostarJP phantom roguelike game pass, SSS#6 (#11473) @Manicsteiner\n* battle_data 未实装干员添加字段提示 @ABA2396\n* 别用 1234567890ABCDEF 去连模拟器了 @ABA2396\n* Revert \"refactor: move resource copy to test script\" @Constrat\n* `启动 MAA 后直接运行` 和 `启动 MAA 后自动开启模拟器` 改为独立配置 @ABA2396\n* 只有一个配置的时候不显示 `此选项页为全局配置` @ABA2396\n* 当前配置不存在时尝试读取全局配置 @ABA2396\n* Config序列化参数不转义中文 @status102\n\n**Full Changelog**: [v5.11.1 -> v5.12.0-beta.1](https://github.com/MaaAssistantArknights/MaaAssistantArknights/compare/v5.11.1...v5.12.0-beta.1)\n",
|
||||
"VersionUpdate.doNotShowUpdate": "False",
|
||||
"VersionUpdate.HasAcknowledgedNightlyWarning": "False",
|
||||
"VersionUpdate.isfirstboot": "False",
|
||||
"VersionUpdate.name": "v5.12.3",
|
||||
"VersionUpdate.package": "MAAComponent-OTA-v5.12.2_v5.12.3-win-x64.zip",
|
||||
"VersionUpdate.name": "v5.12.0-beta.1",
|
||||
"VersionUpdate.package": "",
|
||||
"VersionUpdate.Proxy": "127.0.0.1:26561",
|
||||
"VersionUpdate.ProxyType": "http",
|
||||
"VersionUpdate.ResourceApi": "https://maa-ota.annangela.cn/MaaAssistantArknights/MaaAssistantArknights/",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"MaaSet": {
|
||||
"Name": "12332",
|
||||
"Path": "D:/AUTO/MAA_for_AUTO"
|
||||
"Path": "D:/AUTO/MAA"
|
||||
},
|
||||
"RunSet": {
|
||||
"AnnihilationTimeLimit": 40,
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
"TimeEnabled_7": false,
|
||||
"TimeEnabled_8": false,
|
||||
"TimeEnabled_9": false,
|
||||
"TimeSet_0": "17:54",
|
||||
"TimeSet_0": "20:33",
|
||||
"TimeSet_1": "01:00",
|
||||
"TimeSet_2": "00:00",
|
||||
"TimeSet_3": "01:00",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"Function": {
|
||||
"BossKey": "",
|
||||
"IfAllowSleep": true,
|
||||
"IfAllowSleep": false,
|
||||
"IfSilence": false
|
||||
},
|
||||
"Notify": {
|
||||
@@ -22,7 +22,7 @@
|
||||
"IfShowTray": false,
|
||||
"IfToTray": false,
|
||||
"MainIndex": 0,
|
||||
"location": "207x195",
|
||||
"location": "100x100",
|
||||
"maximized": false,
|
||||
"size": "1200x700"
|
||||
},
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
{
|
||||
"\u811a\u672c_1": {
|
||||
"History": "\u4efb\u52a1\u5f00\u59cb\u65f6\u95f4\uff1a2025-01-25 17:49:28\uff0c\u7ed3\u675f\u65f6\u95f4\uff1a2025-01-25 17:50:50\n\u5df2\u5b8c\u6210\u6570\uff1a0\uff0c\u672a\u5b8c\u6210\u6570\uff1a1\n\n\u4ee3\u7406\u672a\u6210\u529f\u7684\u7528\u6237\uff1a\n\u65b0\u7528\u6237\n",
|
||||
"脚本_1": {
|
||||
"History": "任务开始时间:2025-01-25 17:49:28,结束时间:2025-01-25 17:50:50\n已完成数:0,未完成数:1\n\n代理未成功的用户:\n新用户\n",
|
||||
"Time": "2025-01-25 17:49:28"
|
||||
},
|
||||
"\u8c03\u5ea6\u961f\u5217_2": {
|
||||
"调度队列_2": {
|
||||
"Time": "2025-01-24 19:35:19",
|
||||
"History": "\u4efb\u52a1\u540d\u79f0\uff1a\u811a\u672c_1\uff0c\u4efb\u52a1\u5f00\u59cb\u65f6\u95f4\uff1a2025-01-24 19:35:19\uff0c\u7ed3\u675f\u65f6\u95f4\uff1a2025-01-24 19:36:21\n\u5df2\u5b8c\u6210\u6570\uff1a0\uff0c\u672a\u5b8c\u6210\u6570\uff1a1\n\n\u4ee3\u7406\u672a\u6210\u529f\u7684\u7528\u6237\uff1a\n\u65b0\u7528\u6237\n\n"
|
||||
"History": "任务名称:脚本_1,任务开始时间:2025-01-24 19:35:19,结束时间:2025-01-24 19:36:21\n已完成数:0,未完成数:1\n\n代理未成功的用户:\n新用户\n\n"
|
||||
},
|
||||
"\u811a\u672c_2": {
|
||||
"History": "\u4efb\u52a1\u5f00\u59cb\u65f6\u95f4\uff1a2025-01-25 17:54:26\uff0c\u7ed3\u675f\u65f6\u95f4\uff1a2025-01-25 17:54:37\n\u5df2\u5b8c\u6210\u6570\uff1a0\uff0c\u672a\u5b8c\u6210\u6570\uff1a1\n\n\u4ee3\u7406\u672a\u6210\u529f\u7684\u7528\u6237\uff1a\n\u65b0\u7528\u6237\n",
|
||||
"Time": "2025-01-25 17:54:26"
|
||||
"脚本_2": {
|
||||
"History": "任务开始时间:2025-01-26 07:56:52,结束时间:2025-01-26 07:56:56\n已完成数:0,未完成数:1\n\n代理未成功的用户:\n新用户\n",
|
||||
"Time": "2025-01-26 07:56:52"
|
||||
},
|
||||
"\u8c03\u5ea6\u961f\u5217_1": {
|
||||
"Time": "2025-01-25 17:54:26",
|
||||
"History": "\u4efb\u52a1\u540d\u79f0\uff1a\u811a\u672c_2\uff0c\u4efb\u52a1\u5f00\u59cb\u65f6\u95f4\uff1a2025-01-25 17:54:26\uff0c\u7ed3\u675f\u65f6\u95f4\uff1a2025-01-25 17:54:37\n \u5df2\u5b8c\u6210\u6570\uff1a0\uff0c\u672a\u5b8c\u6210\u6570\uff1a1\n \n \u4ee3\u7406\u672a\u6210\u529f\u7684\u7528\u6237\uff1a\n \u65b0\u7528\u6237\n \n"
|
||||
"调度队列_1": {
|
||||
"Time": "2025-01-26 07:56:52",
|
||||
"History": "任务名称:脚本_2,任务开始时间:2025-01-26 07:56:52,结束时间:2025-01-26 07:56:56\n 已完成数:0,未完成数:1\n \n 代理未成功的用户:\n 新用户\n \n"
|
||||
}
|
||||
}
|
||||
1019
debug/AUTO_MAA.log
1019
debug/AUTO_MAA.log
File diff suppressed because it is too large
Load Diff
21
main.py
21
main.py
@@ -31,31 +31,18 @@ from PySide6.QtCore import Qt
|
||||
from qfluentwidgets import FluentTranslator
|
||||
import sys
|
||||
|
||||
from app.core import AppConfig
|
||||
from app.services.notification import Notification
|
||||
from app.services.security import CryptoHandler
|
||||
from app.services.system import SystemHandler
|
||||
from app.ui.main_window import AUTO_MAA
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
config = AppConfig()
|
||||
notify = Notification(config)
|
||||
crypto = CryptoHandler(config)
|
||||
system = SystemHandler(config)
|
||||
|
||||
QApplication.setAttribute(Qt.AA_DontCreateNativeWidgetSiblings)
|
||||
application = QApplication(sys.argv)
|
||||
QApplication.setAttribute(Qt.AA_DontCreateNativeWidgetSiblings)
|
||||
|
||||
translator = FluentTranslator()
|
||||
application.installTranslator(translator)
|
||||
|
||||
window = AUTO_MAA(
|
||||
config=config,
|
||||
notify=notify,
|
||||
crypto=crypto,
|
||||
system=system,
|
||||
)
|
||||
from app.ui.main_window import AUTO_MAA
|
||||
|
||||
window = AUTO_MAA()
|
||||
window.show_ui("显示主窗口")
|
||||
window.start_up_task()
|
||||
sys.exit(application.exec())
|
||||
|
||||
Reference in New Issue
Block a user