T-580 精简设置页更新执行配置

This commit is contained in:
chengma
2026-07-10 10:12:15 +08:00
parent c078e68e98
commit e70e831afa
12 changed files with 259 additions and 287 deletions
+15 -50
View File
@@ -161,9 +161,6 @@ class SettingsTab(QWidget):
for resolution in self.RESOLUTION_ITEMS:
self.resolution_combo.addItem(resolution, resolution)
self.response_timeout_label = QLabel("")
self.jpg_quality_spin = QSpinBox()
self.jpg_quality_spin.setObjectName("jpgQualitySpin")
self.jpg_quality_spin.setRange(1, 100)
self.chrome_path_edit = QLineEdit()
self.chrome_path_edit.setObjectName("chromePathEdit")
self.chrome_path_browse_button = QPushButton("选择...")
@@ -204,32 +201,17 @@ class SettingsTab(QWidget):
self.unsaved_changes_label.setObjectName("settingsUnsavedChangesLabel")
self.unsaved_changes_label.setStyleSheet("color: #bc4c00; font-weight: 600;")
self.unsaved_changes_label.setVisible(False)
self.allow_real_submit_checkbox = QCheckBox("允许真实提交线上商品")
self.allow_real_submit_checkbox.setObjectName("allowRealSubmitCheckbox")
self.allow_cover_update_checkbox = QCheckBox("允许更新封面")
self.allow_cover_update_checkbox.setObjectName("allowCoverUpdateCheckbox")
self.allow_cover_update_checkbox.setVisible(False)
self.max_items_per_run_spin = QSpinBox()
self.max_items_per_run_spin.setObjectName("maxItemsPerRunSpin")
self.max_items_per_run_spin.setRange(1, 9999)
self.max_items_per_run_spin.setToolTip("作为每批最大更新条数;正式更新会分批处理当前筛选全部可更新记录。")
self.close_success_tab_checkbox = QCheckBox("成功后关闭本次新开编辑页")
self.close_success_tab_checkbox.setObjectName("closeSuccessTabCheckbox")
self.parallel_accounts_checkbox = QCheckBox("多账号并行更新")
self.parallel_accounts_checkbox.setObjectName("parallelAccountsCheckbox")
self.max_parallel_accounts_spin = QSpinBox()
self.max_parallel_accounts_spin.setObjectName("maxParallelAccountsSpin")
self.max_parallel_accounts_spin.setRange(1, 16)
self.max_parallel_accounts_label = QLabel("最大并行账号数")
self.parallel_accounts_group = QWidget()
self.parallel_accounts_group.setObjectName("parallelAccountsGroup")
parallel_accounts_layout = QHBoxLayout(self.parallel_accounts_group)
parallel_accounts_layout.setContentsMargins(0, 0, 0, 0)
parallel_accounts_layout.setSpacing(12)
parallel_accounts_layout.addWidget(self.parallel_accounts_checkbox)
parallel_accounts_layout.addWidget(self.max_parallel_accounts_label)
parallel_accounts_layout.addWidget(self.max_parallel_accounts_spin)
parallel_accounts_layout.addStretch(1)
self.max_parallel_accounts_spin.setRange(
appconfig.SHOPEE_PARALLEL_ACCOUNTS_MIN,
appconfig.SHOPEE_PARALLEL_ACCOUNTS_MAX,
)
self.max_parallel_accounts_spin.setToolTip("1=逐个更新,不并行;大于1时按账号并行更新,最多同时5个账号。")
model_picker_layout = QHBoxLayout()
model_picker_layout.addWidget(self.model_combo, 1)
@@ -268,7 +250,6 @@ class SettingsTab(QWidget):
("失败重试次数", self.retry_spin),
("分辨率", self.resolution_combo),
("返回超时", self.response_timeout_label),
("jpg质量", self.jpg_quality_spin),
]
)
@@ -285,7 +266,7 @@ class SettingsTab(QWidget):
("Chrome路径", self.chrome_path_widget, True),
("默认调试端口", self.default_debug_port_spin),
("调试端口范围", port_range_widget),
("CDP就绪超时(秒)", self.cdp_ready_timeout_spin),
("Chrome 就绪超时(秒)", self.cdp_ready_timeout_spin),
]
)
self.infrastructure_form_layout = path_form
@@ -293,9 +274,7 @@ class SettingsTab(QWidget):
self.shopee_update_form_layout = self._three_column_form(
[
("每批最大更新条数", self.max_items_per_run_spin),
("", self.allow_real_submit_checkbox),
("", self.close_success_tab_checkbox),
("", self.parallel_accounts_group, 2),
("同时更新蝦皮账号", self.max_parallel_accounts_spin),
]
)
@@ -357,7 +336,7 @@ class SettingsTab(QWidget):
"settingsGenerationSectionTitle",
)
self.shopee_update_section_title = self._section_title(
"蝦皮更新安全 / 执行模式",
"蝦皮更新执行",
"settingsShopeeUpdateSectionTitle",
)
self.infrastructure_section_title = self._section_title(
@@ -507,7 +486,6 @@ class SettingsTab(QWidget):
self.title_concurrency_spin,
self.image_concurrency_spin,
self.retry_spin,
self.jpg_quality_spin,
self.default_debug_port_spin,
self.debug_port_start_spin,
self.debug_port_end_spin,
@@ -518,9 +496,6 @@ class SettingsTab(QWidget):
checkboxes = (
self.cmhub_check_balance_checkbox,
self.enabled_checkbox,
self.allow_real_submit_checkbox,
self.close_success_tab_checkbox,
self.parallel_accounts_checkbox,
)
for widget in line_edits:
widget.textChanged.connect(self._mark_dirty)
@@ -768,7 +743,6 @@ class SettingsTab(QWidget):
"title_concurrency": self.title_concurrency_spin.value(),
"image_concurrency": self.image_concurrency_spin.value(),
"retry": self.retry_spin.value(),
"jpg_quality": self.jpg_quality_spin.value(),
"resolution": self.resolution_combo.currentData() or "1k",
"resolution_timeouts": dict(ai_cfg.get("resolution_timeouts", {})),
}
@@ -802,13 +776,9 @@ class SettingsTab(QWidget):
"ai": ai_cfg,
"shopee_update": {
"test_item_id": str(self._compat_test_item_id or ""),
"allow_real_submit": self.allow_real_submit_checkbox.isChecked(),
"allow_cover_update": appconfig.update_mode_includes_cover(update_mode),
"update_mode": update_mode,
"max_items_per_run": self.max_items_per_run_spin.value(),
"close_success_tab": self.close_success_tab_checkbox.isChecked(),
"dry_run": False,
"parallel_accounts": self.parallel_accounts_checkbox.isChecked(),
"max_parallel_accounts": self.max_parallel_accounts_spin.value(),
},
}
@@ -899,7 +869,6 @@ class SettingsTab(QWidget):
self.resolution_combo,
str(ai_cfg.get("resolution", "1k")),
)
self.jpg_quality_spin.setValue(int(ai_cfg.get("jpg_quality", 90) or 90))
self.chrome_path_edit.setText(appconfig.chrome_path(self.config))
self.user_data_root_edit.setText(
str(self.config.get("user_data_root", "chrome_user_data_dir") or "")
@@ -917,21 +886,17 @@ class SettingsTab(QWidget):
)
update_cfg = self._shopee_update_config()
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))
)
self.allow_cover_update_checkbox.setChecked(bool(update_cfg.get("allow_cover_update", False)))
self.max_items_per_run_spin.setValue(
max(1, int(update_cfg.get("max_items_per_run", 1) or 1))
)
self.close_success_tab_checkbox.setChecked(
bool(update_cfg.get("close_success_tab", False))
)
self.parallel_accounts_checkbox.setChecked(
bool(update_cfg.get("parallel_accounts", False))
)
self.max_parallel_accounts_spin.setValue(
max(1, int(update_cfg.get("max_parallel_accounts", 2) or 2))
max(
appconfig.SHOPEE_PARALLEL_ACCOUNTS_MIN,
min(
appconfig.SHOPEE_PARALLEL_ACCOUNTS_MAX,
int(update_cfg.get("max_parallel_accounts", 1) or 1),
),
)
)
self._update_response_timeout_label()
self._on_backend_changed()