优化日志显示

This commit is contained in:
xinzhu.yin
2026-04-21 15:31:48 +08:00
parent 6cc3e55ebb
commit e27312d0a3
22 changed files with 684 additions and 553 deletions

View File

@@ -1,4 +1,4 @@
"""自定义模板结果面板Step 6 重构)。"""
"""自定义模板结果面板Step 6 重构)。"""
import threading
import time
@@ -274,7 +274,7 @@ def _run_custom_row_single_step(self, item_id, row_no):
"""后台执行客户模板单步测试"""
try:
self._dispatch_ui(self.status_var.set, f"单步测试第 {row_no} 行...")
self.log_gui.log(f"开始单步测试第 {row_no}")
self.log_gui.log(f"开始单步测试第 {row_no}", level="info")
self.config.set_current_pattern("custom")
@@ -295,7 +295,7 @@ def _run_custom_row_single_step(self, item_id, row_no):
)
if row_no > len(converted_params):
self.log_gui.log(f" 行号超出 pattern 范围: {row_no}/{len(converted_params)}")
self.log_gui.log(f"[Error] 行号超出 pattern 范围: {row_no}/{len(converted_params)}", level="error")
self._dispatch_ui(self.status_var.set, "单步测试失败:行号超范围")
return
@@ -335,11 +335,11 @@ def _run_custom_row_single_step(self, item_id, row_no):
self._update_custom_result_row, item_id, row_no, row_data
)
self.log_gui.log(f"{row_no} 行单步测试完成并已覆盖")
self.log_gui.log(f"{row_no} 行单步测试完成并已覆盖", level="success")
self._dispatch_ui(self.status_var.set, f"{row_no} 行单步测试完成")
except Exception as e:
self.log_gui.log(f" 单步测试失败: {str(e)}")
self.log_gui.log(f"[Error] 单步测试失败: {str(e)}", level="error")
self._dispatch_ui(self.status_var.set, "单步测试失败")
@@ -423,7 +423,7 @@ def copy_custom_result_table(self):
if hasattr(self, "status_var"):
self.status_var.set(f"已复制 {len(items)} 行客户模板数据到剪贴板")
if hasattr(self, "log_gui"):
self.log_gui.log(f"已复制客户模板表格数据({len(items)} 行)")
self.log_gui.log(f"已复制客户模板表格数据({len(items)} 行)", level="success")
def fill_custom_result_test_data(self):
@@ -465,7 +465,7 @@ def fill_custom_result_test_data(self):
if hasattr(self, "status_var"):
self.status_var.set("已填充 147 行客户模板测试数据")
if hasattr(self, "log_gui"):
self.log_gui.log("已填充 147 行客户模板测试数据")
self.log_gui.log("已填充 147 行客户模板测试数据", level="success")
def clear_custom_template_results(self):
@@ -511,7 +511,7 @@ def auto_expand_custom_result_view(self):
self.root.update_idletasks()
except Exception as e:
if hasattr(self, "log_gui"):
self.log_gui.log(f"⚠️ 自动扩展客户模板窗口失败: {str(e)}")
self.log_gui.log(f"自动扩展客户模板窗口失败: {str(e)}", level="error")
def append_custom_template_result(self, row_no, result_data):