feat: refine settings sections

This commit is contained in:
chengma
2026-07-02 10:59:21 +08:00
parent 820612c3ab
commit 86b931b26d
5 changed files with 65 additions and 30 deletions
+37 -16
View File
@@ -4870,6 +4870,7 @@ if QT_IMPORT_ERROR is None:
self.current_model_name = None
self.test_worker = None
self.test_thread = None
self._compat_test_item_id = ""
self.model_combo = QComboBox()
self.model_combo.setObjectName("aiModelCombo")
@@ -4944,9 +4945,6 @@ if QT_IMPORT_ERROR is None:
self.cdp_ready_timeout_spin.setObjectName("cdpReadyTimeoutSpin")
self.cdp_ready_timeout_spin.setRange(1, 3600)
self.save_config_button = QPushButton("保存设置")
self.test_item_id_edit = QLineEdit()
self.test_item_id_edit.setObjectName("testItemIdEdit")
self.test_item_id_edit.setVisible(False)
self.allow_real_submit_checkbox = QCheckBox("允许真实提交线上商品")
self.allow_real_submit_checkbox.setObjectName("allowRealSubmitCheckbox")
self.allow_cover_update_checkbox = QCheckBox("允许更新封面")
@@ -4957,9 +4955,6 @@ if QT_IMPORT_ERROR is None:
self.max_items_per_run_spin.setToolTip("作为每批最大更新条数;正式更新会分批处理当前筛选全部可更新记录。")
self.close_success_tab_checkbox = QCheckBox("成功后关闭本次新开编辑页")
self.close_success_tab_checkbox.setObjectName("closeSuccessTabCheckbox")
self.dry_run_checkbox = QCheckBox("检查本轮更新")
self.dry_run_checkbox.setObjectName("dryRunCheckbox")
self.dry_run_checkbox.setVisible(False)
self.parallel_accounts_checkbox = QCheckBox("多账号并行更新")
self.parallel_accounts_checkbox.setObjectName("parallelAccountsCheckbox")
self.max_parallel_accounts_spin = QSpinBox()
@@ -5045,23 +5040,44 @@ if QT_IMPORT_ERROR is None:
panel = QWidget()
panel.setMaximumWidth(1800)
panel_layout = QVBoxLayout(panel)
self.settings_panel_layout = panel_layout
panel_layout.setContentsMargins(13, 18, 13, 18)
panel_layout.addWidget(QLabel("AI 模型"))
self.ai_model_section_title = self._section_title(
"AI 模型",
"settingsAiModelSectionTitle",
)
self.model_detail_section_title = self._section_title(
"模型详情",
"settingsModelDetailSectionTitle",
)
self.generation_section_title = self._section_title(
"角色与生成参数",
"settingsGenerationSectionTitle",
)
self.shopee_update_section_title = self._section_title(
"Shopee 更新安全 / 执行模式",
"settingsShopeeUpdateSectionTitle",
)
self.infrastructure_section_title = self._section_title(
"基础设施(路径与端口)",
"settingsInfrastructureSectionTitle",
)
panel_layout.addWidget(self.ai_model_section_title)
panel_layout.addLayout(model_picker_layout)
panel_layout.addSpacing(14)
panel_layout.addWidget(QLabel("模型详情"))
panel_layout.addWidget(self.model_detail_section_title)
panel_layout.addLayout(form)
panel_layout.addLayout(action_layout)
panel_layout.addWidget(self.test_result_label)
panel_layout.addSpacing(18)
panel_layout.addWidget(QLabel("角色与生成参数"))
panel_layout.addWidget(self.generation_section_title)
panel_layout.addLayout(ai_form)
panel_layout.addSpacing(18)
panel_layout.addWidget(QLabel("路径与端口"))
panel_layout.addLayout(path_form)
panel_layout.addSpacing(18)
panel_layout.addWidget(QLabel("Shopee 更新安全"))
panel_layout.addWidget(self.shopee_update_section_title)
panel_layout.addLayout(self.shopee_update_form_layout)
panel_layout.addSpacing(18)
panel_layout.addWidget(self.infrastructure_section_title)
panel_layout.addLayout(path_form)
panel_layout.addWidget(self.save_config_button)
panel_layout.addStretch(1)
@@ -5130,6 +5146,12 @@ if QT_IMPORT_ERROR is None:
else:
layout.addWidget(widget, row, column, 1, span_pairs * 2)
def _section_title(self, text, object_name):
label = QLabel(text)
label.setObjectName(object_name)
label.setStyleSheet("color: #24292f; font-weight: 600; padding-top: 4px;")
return label
def _set_status(self, message):
if self.status_callback is not None:
self.status_callback(message)
@@ -5322,7 +5344,7 @@ if QT_IMPORT_ERROR is None:
"cdp_ready_timeout": self.cdp_ready_timeout_spin.value(),
"ai": ai_cfg,
"shopee_update": {
"test_item_id": self.test_item_id_edit.text().strip(),
"test_item_id": str(self._compat_test_item_id or ""),
"allow_real_submit": self.allow_real_submit_checkbox.isChecked(),
"allow_cover_update": self.allow_cover_update_checkbox.isChecked(),
"max_items_per_run": self.max_items_per_run_spin.value(),
@@ -5382,7 +5404,7 @@ if QT_IMPORT_ERROR is None:
int(appconfig.cdp_ready_timeout(self.config))
)
update_cfg = self._shopee_update_config()
self.test_item_id_edit.setText(str(update_cfg.get("test_item_id", "")))
self._compat_test_item_id = str(update_cfg.get("test_item_id", ""))
self.allow_real_submit_checkbox.setChecked(
bool(update_cfg.get("allow_real_submit", False))
)
@@ -5395,7 +5417,6 @@ if QT_IMPORT_ERROR is None:
self.close_success_tab_checkbox.setChecked(
bool(update_cfg.get("close_success_tab", False))
)
self.dry_run_checkbox.setChecked(False)
self.parallel_accounts_checkbox.setChecked(
bool(update_cfg.get("parallel_accounts", False))
)