feat(core): 启动时支持直接运行复数调度队列
This commit is contained in:
9
.github/workflows/build-app.yml
vendored
9
.github/workflows/build-app.yml
vendored
@@ -60,7 +60,6 @@ jobs:
|
||||
shell: pwsh
|
||||
run: |
|
||||
cd Go_Updater
|
||||
go mod init
|
||||
go install github.com/akavel/rsrc@latest
|
||||
.\build.ps1
|
||||
|
||||
@@ -72,16 +71,8 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install flake8 pytest
|
||||
pip install -r requirements.txt
|
||||
|
||||
- name: Lint with flake8
|
||||
run: |
|
||||
# stop the build if there are Python syntax errors or undefined names
|
||||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||
|
||||
- name: Get version
|
||||
id: get_version
|
||||
run: |
|
||||
|
||||
@@ -205,9 +205,6 @@ class GlobalConfig(LQConfig):
|
||||
self.start_IfSelfStart = ConfigItem(
|
||||
"Start", "IfSelfStart", False, BoolValidator()
|
||||
)
|
||||
self.start_IfRunDirectly = ConfigItem(
|
||||
"Start", "IfRunDirectly", False, BoolValidator()
|
||||
)
|
||||
self.start_IfMinimizeDirectly = ConfigItem(
|
||||
"Start", "IfMinimizeDirectly", False, BoolValidator()
|
||||
)
|
||||
@@ -279,6 +276,9 @@ class QueueConfig(LQConfig):
|
||||
self.QueueSet_TimeEnabled = ConfigItem(
|
||||
"QueueSet", "TimeEnabled", False, BoolValidator()
|
||||
)
|
||||
self.QueueSet_StartUpEnabled = ConfigItem(
|
||||
"QueueSet", "StartUpEnabled", False, BoolValidator()
|
||||
)
|
||||
self.QueueSet_AfterAccomplish = OptionsConfigItem(
|
||||
"QueueSet",
|
||||
"AfterAccomplish",
|
||||
@@ -697,7 +697,7 @@ class GeneralSubConfig(LQConfig):
|
||||
|
||||
class AppConfig(GlobalConfig):
|
||||
|
||||
VERSION = "4.4.1.5"
|
||||
VERSION = "4.4.1.6"
|
||||
|
||||
stage_refreshed = Signal()
|
||||
PASSWORD_refreshed = Signal()
|
||||
|
||||
@@ -161,7 +161,7 @@ class AUTO_MAA(MSFluentWindow):
|
||||
# 开始任务菜单项
|
||||
self.tray_menu.addActions(
|
||||
[
|
||||
Action(FluentIcon.PLAY, "运行自动代理", triggered=self.start_main_task),
|
||||
Action(FluentIcon.PLAY, "运行启动时队列", triggered=self.start_up_task),
|
||||
Action(
|
||||
FluentIcon.PAUSE,
|
||||
"中止所有任务",
|
||||
@@ -385,11 +385,6 @@ class AUTO_MAA(MSFluentWindow):
|
||||
if Config.get(Config.function_HomeImageMode) == "主题图像":
|
||||
self.home.get_home_image()
|
||||
|
||||
# 直接运行主任务
|
||||
if Config.get(Config.start_IfRunDirectly):
|
||||
|
||||
self.start_main_task()
|
||||
|
||||
# 启动定时器
|
||||
MainTimer.start()
|
||||
|
||||
@@ -440,39 +435,27 @@ class AUTO_MAA(MSFluentWindow):
|
||||
)
|
||||
System.set_power("KillSelf")
|
||||
|
||||
elif Config.args.mode == "gui":
|
||||
|
||||
self.start_up_queue()
|
||||
|
||||
logger.success("启动时任务执行完成", module="主窗口")
|
||||
|
||||
def start_main_task(self) -> None:
|
||||
"""启动主任务"""
|
||||
def start_up_queue(self) -> None:
|
||||
"""启动时运行的调度队列"""
|
||||
|
||||
logger.info("正在启动主任务", module="主窗口")
|
||||
logger.info("开始调度启动时运行的调度队列", module="主窗口")
|
||||
|
||||
if "调度队列_1" in Config.queue_dict:
|
||||
for name, queue in Config.queue_dict.items():
|
||||
|
||||
logger.info("自动添加任务:调度队列_1", module="主窗口")
|
||||
TaskManager.add_task(
|
||||
"自动代理_主调度台",
|
||||
"调度队列_1",
|
||||
Config.queue_dict["调度队列_1"]["Config"].toDict(),
|
||||
)
|
||||
if queue["Config"].get(queue["Config"].QueueSet_StartUpEnabled):
|
||||
|
||||
elif "脚本_1" in Config.script_dict:
|
||||
logger.info(f"自动添加任务:{name}", module="主窗口")
|
||||
TaskManager.add_task(
|
||||
"自动代理_新调度台", name, queue["Config"].toDict()
|
||||
)
|
||||
|
||||
logger.info("自动添加任务:脚本_1", module="主窗口")
|
||||
TaskManager.add_task(
|
||||
"自动代理_主调度台", "自定义队列", {"Queue": {"Script_0": "脚本_1"}}
|
||||
)
|
||||
|
||||
else:
|
||||
|
||||
logger.warning(
|
||||
"启动主任务失败:未找到有效的主任务配置文件", module="主窗口"
|
||||
)
|
||||
MainInfoBar.push_info_bar(
|
||||
"warning", "启动主任务失败", "「调度队列_1」与「脚本_1」均不存在", -1
|
||||
)
|
||||
|
||||
logger.success("主任务启动完成", module="主窗口")
|
||||
logger.success("开始调度启动时运行的调度队列启动完成", module="主窗口")
|
||||
|
||||
def __currentChanged(self, index: int) -> None:
|
||||
"""切换界面时任务"""
|
||||
|
||||
@@ -402,10 +402,18 @@ class QueueManager(QWidget):
|
||||
configItem=self.config.QueueSet_Name,
|
||||
parent=self,
|
||||
)
|
||||
self.card_Enable = SwitchSettingCard(
|
||||
self.card_StartUpEnabled = SwitchSettingCard(
|
||||
icon=FluentIcon.CHECKBOX,
|
||||
title="启动时运行状态",
|
||||
content="调度队列启动时运行状态,启用后将在软件启动时自动运行本队列",
|
||||
qconfig=self.config,
|
||||
configItem=self.config.QueueSet_StartUpEnabled,
|
||||
parent=self,
|
||||
)
|
||||
self.card_TimeEnable = SwitchSettingCard(
|
||||
icon=FluentIcon.CHECKBOX,
|
||||
title="定时运行状态",
|
||||
content="调度队列定时运行状态,仅启用时会执行定时任务",
|
||||
content="调度队列定时运行状态,启用时会执行定时任务",
|
||||
qconfig=self.config,
|
||||
configItem=self.config.QueueSet_TimeEnabled,
|
||||
parent=self,
|
||||
@@ -429,7 +437,8 @@ class QueueManager(QWidget):
|
||||
|
||||
Layout = QVBoxLayout()
|
||||
Layout.addWidget(self.card_Name)
|
||||
Layout.addWidget(self.card_Enable)
|
||||
Layout.addWidget(self.card_StartUpEnabled)
|
||||
Layout.addWidget(self.card_TimeEnable)
|
||||
Layout.addWidget(self.card_AfterAccomplish)
|
||||
|
||||
self.viewLayout.addLayout(Layout)
|
||||
|
||||
@@ -806,14 +806,6 @@ class StartSettingCard(HeaderCardWidget):
|
||||
configItem=Config.start_IfSelfStart,
|
||||
parent=self,
|
||||
)
|
||||
self.card_IfRunDirectly = SwitchSettingCard(
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="启动后直接运行主任务",
|
||||
content="启动AUTO_MAA后自动运行自动代理任务,优先级:调度队列 1 > 脚本 1",
|
||||
qconfig=Config,
|
||||
configItem=Config.start_IfRunDirectly,
|
||||
parent=self,
|
||||
)
|
||||
self.card_IfMinimizeDirectly = SwitchSettingCard(
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="启动后直接最小化",
|
||||
@@ -825,7 +817,6 @@ class StartSettingCard(HeaderCardWidget):
|
||||
|
||||
Layout = QVBoxLayout()
|
||||
Layout.addWidget(self.card_IfSelfStart)
|
||||
Layout.addWidget(self.card_IfRunDirectly)
|
||||
Layout.addWidget(self.card_IfMinimizeDirectly)
|
||||
self.viewLayout.addLayout(Layout)
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
{
|
||||
"main_version": "4.4.1.5",
|
||||
"main_version": "4.4.1.6",
|
||||
"version_info": {
|
||||
"4.4.1.6": {
|
||||
"新增功能": [
|
||||
"启动时支持直接运行复数调度队列"
|
||||
]
|
||||
},
|
||||
"4.4.1.5": {
|
||||
"新增功能": [
|
||||
"适配 MAA 长期开放剿灭关卡",
|
||||
|
||||
Reference in New Issue
Block a user