feat(gui): improve status scope dialogs

This commit is contained in:
chengma
2026-07-18 17:23:22 +08:00
parent 89f1b085dc
commit 7538009f94
8 changed files with 218 additions and 62 deletions
+24 -29
View File
@@ -1828,37 +1828,32 @@ class GenerateTab(QWidget):
total = len(plan.get("base_candidates") or [])
non_normal_count = total - normal_count
box = QMessageBox(self)
box.setIcon(QMessageBox.Question)
box.setWindowTitle("选择生成范围")
box.setText("请选择本轮要生成的商品范围。")
box.setInformativeText(
"真实候选共{total}条:正常{normal},未上架{unlisted},审核中{reviewing},状态未知{unknown}。\n"
"生成所有状态的商品会让非正常状态商品也调用 AI,可能额外消耗点数。"
"状态未知商品请优先回到①重新采集确认。".format(
total=total,
normal=normal_count,
unlisted=unlisted_count,
reviewing=reviewing_count,
unknown=unknown_count,
)
box = ProductStatusScopeDialog(
title="选择生成范围",
text="请选择本轮要生成的商品范围。",
informative_text=(
"真实候选共{total}条:正常{normal},未上架{unlisted},审核中{reviewing},状态未知{unknown}。\n"
"生成所有状态的商品会让非正常状态商品也调用 AI,可能额外消耗点数。"
"状态未知商品请优先回到①重新采集确认。".format(
total=total,
normal=normal_count,
unlisted=unlisted_count,
reviewing=reviewing_count,
unknown=unknown_count,
)
),
normal_text="只生成状态正常的商品",
all_text="生成所有状态的商品",
normal_value=product_status.SCOPE_NORMAL_ONLY,
all_value=product_status.SCOPE_ALL,
normal_object_name="generateNormalOnlyButton",
all_object_name="generateAllStatusesButton",
cancel_object_name="generateScopeCancelButton",
all_enabled=non_normal_count > 0,
parent=self,
)
normal_button = box.addButton("只生成状态正常的商品", QMessageBox.AcceptRole)
normal_button.setObjectName("generateNormalOnlyButton")
all_button = box.addButton("生成所有状态的商品", QMessageBox.DestructiveRole)
all_button.setObjectName("generateAllStatusesButton")
all_button.setStyleSheet("color: #cf222e; font-weight: 600;")
all_button.setEnabled(non_normal_count > 0)
cancel_button = box.addButton("取消", QMessageBox.RejectRole)
cancel_button.setObjectName("generateScopeCancelButton")
box.setDefaultButton(normal_button)
box.setEscapeButton(cancel_button)
box.exec()
if box.clickedButton() is normal_button:
return product_status.SCOPE_NORMAL_ONLY
if all_button.isEnabled() and box.clickedButton() is all_button:
return product_status.SCOPE_ALL
return None
return box.choice()
def stop_generate(self, checked=False):
if self.generate_worker is not None: