Unify strategy controls and refresh logged-in accounts automatically

This commit is contained in:
AttilaNet
2026-11-08 12:23:34 +08:00
parent 1eef0f80d1
commit 3c1b3d6af2
19 changed files with 235 additions and 185 deletions
+5 -37
View File
@@ -44,14 +44,9 @@ class ActivityPages:
line.addWidget(self.map_keep_ti)
line.addWidget(W.QLabel("使用战队"))
line.addWidget(self.map_team)
start = W.QPushButton("开始扫荡")
start.clicked.connect(lambda: self.start_activities("maps"))
stop = W.QPushButton("停止扫荡")
stop.clicked.connect(lambda: self.map_enabled.setChecked(False))
reset = W.QPushButton("处理未完成记录…")
reset.clicked.connect(self.clear_sweep_pending)
for button in (start, stop, reset):
line.addWidget(button)
line.addWidget(reset)
line.addStretch()
layout.addLayout(line)
self.maps_summary = W.QLabel("登录后读取实际解锁状态")
@@ -223,7 +218,7 @@ class ActivityPages:
pending = self.engine.sweeper.state.get("pending")
self.maps_summary.setText(f"已解锁 {sum(s.unlocked for s in all_rows)} 个难度;显示 {len(visible)} 关;勾选 {sum(bool(r.get('enabled')) for r in self.map_rules.values())} 关。" +
(f" 待处理:{pending['stage']} / {pending['phase']}" if pending else "") +
(" 正在执行扫荡计划。" if self.map_enabled.isChecked() and self.execute.isChecked() and self.monitoring else " 扫荡已停止。"))
(" 扫荡策略运行中。" if self.map_enabled.isChecked() and self.strategy_toggle.isChecked() else " 开启顶部策略开关后运行已勾选关卡。"))
def clear_sweep_pending(self):
if self.busy:
@@ -242,7 +237,7 @@ class ActivityPages:
self.daily_page = W.QWidget()
layout = W.QVBoxLayout(self.daily_page)
line = W.QHBoxLayout()
self.daily_enabled = W.QCheckBox("监控时自动领取勾选奖励")
self.daily_enabled = W.QCheckBox("启用每日奖励领取")
line.addWidget(self.daily_enabled)
self.daily_checks = {}
for key, label in (("gift", "每日签到礼包"), ("check", "七日签到"), ("loop", "累计奖励"), ("vip", "VIP日奖"), ("mail", "邮件附件")):
@@ -254,8 +249,7 @@ class ActivityPages:
line.addStretch()
layout.addLayout(line)
line = W.QHBoxLayout()
for label, function in (("刷新状态", self.refresh), ("领取勾选项目", self.claim_daily),
("开始每日事务", lambda: self.start_activities("daily")), ("停止每日事务", lambda: self.daily_enabled.setChecked(False))):
for label, function in (("刷新状态", self.refresh), ("领取勾选项目", self.claim_daily)):
button = W.QPushButton(label)
button.clicked.connect(function)
line.addWidget(button)
@@ -269,7 +263,7 @@ class ActivityPages:
self.daily_table.setColumnWidth(0, 280)
self.daily_table.setColumnWidth(1, 230)
layout.addWidget(self.daily_table, 1)
note = W.QLabel("刷新只读取状态。“领取勾选项目”立即处理当前可领奖励;自动领取还需开启监控和“自动执行已启用策略”。邮件仅领取附件。")
note = W.QLabel("刷新只更新状态。“领取勾选项目”立即处理当前可领奖励;勾选此页功能并开启顶部策略开关后,将自动领取。邮件仅领取附件。")
note.setWordWrap(True)
layout.addWidget(note)
self.tabs.addTab(self.daily_page, "每日事务")
@@ -296,29 +290,3 @@ class ActivityPages:
self.stop_workflow()
self.engine.daily_policy = self.read_daily_policy()
self.submit("daily_claim", self.engine.claim_daily)
def start_activities(self, page):
if page == "maps":
if self.engine.demo:
self.report("请先登录账号,再开始扫荡")
return
if not any(r.get("enabled") for r in self.map_rules.values()):
self.report("请先勾选关卡,并设置难度和本日次数上限")
return
if not self.busy and self.engine.snapshot and not self.engine.sweeper.next(self.engine.snapshot, self.read_sweep_policy()):
self.report("勾选关卡当前均不可扫荡;请查看每行扫荡状态、本日上限和已开始次数")
return
self.map_enabled.setChecked(True)
else:
if not any(c.isChecked() for c in self.daily_checks.values()):
self.report("请先勾选需要领取的奖励")
return
self.daily_enabled.setChecked(True)
self.save_config(quiet=True)
self.start_monitor.setChecked(True)
self.execute.setChecked(True)
self.next_poll = 0
if self.busy:
self.pending_execute = True
else:
self.refresh(automated=True)