feat: add delete execution feature with progress tracking and dryrun mode
- Add ExecutionConfig for dryrun settings in config schema - Create DeleteProgressWindow widget for real-time progress display - Integrate delete execution flow in MaterialValidationTab with threading - Add dryrun checkbox for admin users in settings - Add progress callback support to DiscreteMaterialPlanCleaner - Add markdown report generation with statistics - Include tkinterweb and markdown2 dependencies for report rendering Co-Authored-By: Claude (glm-5) <noreply@anthropic.com>
This commit is contained in:
@@ -63,12 +63,18 @@ class SettingsTab(ttk.Frame):
|
||||
self._create_validation_group(scrollable_frame)
|
||||
self._create_ui_group(scrollable_frame)
|
||||
else:
|
||||
# User 用户:只显示路径配置
|
||||
# User 用户:显示路径配置和执行设置
|
||||
self._create_paths_group(scrollable_frame)
|
||||
self._create_user_execution_group(scrollable_frame)
|
||||
|
||||
# 按钮区域 - 根据用户类型显示不同按钮
|
||||
button_frame = ttk.Frame(scrollable_frame)
|
||||
button_frame.grid(row=7, column=0, columnspan=2, pady=20, sticky="ew")
|
||||
if is_user_only:
|
||||
# User 用户:显示测试按钮和保存设置按钮(row=4 因为有执行设置组)
|
||||
button_frame.grid(row=4, column=0, columnspan=2, pady=20, sticky="ew")
|
||||
else:
|
||||
# 管理员显示所有按钮
|
||||
button_frame.grid(row=7, column=0, columnspan=2, pady=20, sticky="ew")
|
||||
|
||||
if is_user_only:
|
||||
# User 用户:显示测试按钮和保存设置按钮
|
||||
@@ -225,8 +231,14 @@ class SettingsTab(ttk.Frame):
|
||||
|
||||
def _create_paths_group(self, parent):
|
||||
"""创建路径配置组"""
|
||||
# 根据用户类型调整 grid 位置
|
||||
is_user_only = self.session_manager and self.session_manager.get_user_type() == 'User'
|
||||
|
||||
group = ttk.LabelFrame(parent, text="路径设置", padding=10)
|
||||
group.grid(row=2, column=1, pady=10, padx=10, sticky="nsew")
|
||||
if is_user_only:
|
||||
group.grid(row=2, column=1, pady=10, padx=10, sticky="nsew")
|
||||
else:
|
||||
group.grid(row=2, column=1, pady=10, padx=10, sticky="nsew")
|
||||
|
||||
from gui.widgets import FileSelector
|
||||
|
||||
@@ -255,6 +267,27 @@ class SettingsTab(ttk.Frame):
|
||||
|
||||
group.columnconfigure(0, weight=1)
|
||||
|
||||
def _create_user_execution_group(self, parent):
|
||||
"""创建 User 用户的执行设置组"""
|
||||
group = ttk.LabelFrame(parent, text="执行设置", padding=10)
|
||||
group.grid(row=3, column=0, columnspan=2, pady=10, padx=10, sticky="ew")
|
||||
|
||||
# dryrun 模式设置
|
||||
self.user_dryrun_var = tk.BooleanVar(value=False)
|
||||
ttk.Checkbutton(
|
||||
group,
|
||||
text="预览模式 (执行删除时不保存更改)",
|
||||
variable=self.user_dryrun_var
|
||||
).grid(row=0, column=0, sticky="w", pady=5)
|
||||
|
||||
# 说明文字
|
||||
hint_label = ttk.Label(
|
||||
group,
|
||||
text="提示:勾选后,执行删除操作时将只预览不实际保存,用于测试流程。",
|
||||
foreground="gray"
|
||||
)
|
||||
hint_label.grid(row=1, column=0, sticky="w", pady=(0, 5))
|
||||
|
||||
def _create_extraction_group(self, parent):
|
||||
"""创建处理配置组"""
|
||||
group = ttk.LabelFrame(parent, text="数据提取设置", padding=10)
|
||||
@@ -398,6 +431,8 @@ class SettingsTab(ttk.Frame):
|
||||
self.data_dir_selector.set(self.config.get("paths.data_dir", ""))
|
||||
self.default_output_var.set(self.config.get("paths.default_output", ""))
|
||||
self.validation_output_filename_var.set(self.config.get("paths.validation_output", ""))
|
||||
# 执行设置
|
||||
self.user_dryrun_var.set(self.config.get("execution.dryrun", False))
|
||||
return
|
||||
|
||||
# 管理员模式 - 加载所有配置
|
||||
@@ -462,10 +497,12 @@ class SettingsTab(ttk.Frame):
|
||||
is_user_only = self.session_manager and self.session_manager.get_user_type() == 'User'
|
||||
|
||||
if is_user_only:
|
||||
# User 用户模式 - 只保存路径设置
|
||||
# User 用户模式 - 只保存路径设置和执行设置
|
||||
self.config.set("paths.data_dir", self.data_dir_selector.get())
|
||||
self.config.set("paths.default_output", self.default_output_var.get())
|
||||
self.config.set("paths.validation_output", self.validation_output_filename_var.get())
|
||||
# 保存执行设置
|
||||
self.config.set("execution.dryrun", self.user_dryrun_var.get())
|
||||
|
||||
# 保存到文件
|
||||
if self.config.save():
|
||||
|
||||
Reference in New Issue
Block a user