修改日志/细节问题
This commit is contained in:
@@ -11,7 +11,7 @@ import matplotlib.pyplot as plt
|
||||
from app_version import APP_NAME, APP_VERSION, get_app_title
|
||||
from drivers.UCD323_Function import UCDController
|
||||
from app.pq.pq_config import PQConfig
|
||||
from app.pq.pq_result import PQResult
|
||||
from app.pq.pq_result import PQResult, PQResultStore
|
||||
from app.views.pq_debug_panel import PQDebugPanel
|
||||
from app.export import (
|
||||
save_result_images as _save_result_images_impl,
|
||||
@@ -113,6 +113,7 @@ class PQAutomationApp:
|
||||
self.root.title(get_app_title())
|
||||
self.root.geometry("900x650")
|
||||
self.root.minsize(900, 650)
|
||||
self.root.state("zoomed")
|
||||
self.root.protocol("WM_DELETE_WINDOW", self.on_closing)
|
||||
self.app_name = APP_NAME
|
||||
self.app_version = APP_VERSION
|
||||
@@ -137,7 +138,8 @@ class PQAutomationApp:
|
||||
|
||||
# 创建配置对象
|
||||
self.config = PQConfig()
|
||||
self.results = None
|
||||
# 结果管理器:按 test_type 保留每次测试结果,始终存在,避免未初始化错误
|
||||
self.results = PQResultStore()
|
||||
|
||||
# 加载上次保存的设置
|
||||
self.config_file = self.get_config_path()
|
||||
@@ -278,10 +280,6 @@ class PQAutomationApp:
|
||||
on_test_type_change = _main.on_test_type_change
|
||||
|
||||
create_cct_params_frame = _ccp.create_cct_params_frame
|
||||
_get_cct_var_dict = _ccp._get_cct_var_dict
|
||||
_parse_cct_float = _ccp._parse_cct_float
|
||||
_save_cct_params_for = _ccp._save_cct_params_for
|
||||
_handle_cct_focus_out = _ccp._handle_cct_focus_out
|
||||
on_sdr_cct_param_focus_out = _ccp.on_sdr_cct_param_focus_out
|
||||
save_sdr_cct_params = _ccp.save_sdr_cct_params
|
||||
on_hdr_cct_param_focus_out = _ccp.on_hdr_cct_param_focus_out
|
||||
@@ -309,11 +307,7 @@ class PQAutomationApp:
|
||||
show_custom_result_context_menu = _ctp.show_custom_result_context_menu
|
||||
set_custom_result_table_locked = _ctp.set_custom_result_table_locked
|
||||
start_custom_row_single_step = _ctp.start_custom_row_single_step
|
||||
_clear_custom_result_row = _ctp._clear_custom_result_row
|
||||
_run_custom_row_single_step = _ctp._run_custom_row_single_step
|
||||
_update_custom_result_row = _ctp._update_custom_result_row
|
||||
copy_custom_result_table = _ctp.copy_custom_result_table
|
||||
fill_custom_result_test_data = _ctp.fill_custom_result_test_data
|
||||
clear_custom_template_results = _ctp.clear_custom_template_results
|
||||
auto_expand_custom_result_view = _ctp.auto_expand_custom_result_view
|
||||
append_custom_template_result = _ctp.append_custom_template_result
|
||||
@@ -405,13 +399,13 @@ class PQAutomationApp:
|
||||
self.debug_panel.disable_all_debug()
|
||||
self.log_gui.log("单步调试已禁用", level="success")
|
||||
except Exception as e:
|
||||
self.log_gui.log(f"[Error] 禁用单步调试失败: {str(e)}", level="error")
|
||||
self.log_gui.log(f"禁用单步调试失败: {str(e)}", level="error")
|
||||
if hasattr(self, "debug_container"):
|
||||
try:
|
||||
self.debug_container.pack_forget()
|
||||
self.log_gui.log("单步调试面板已隐藏", level="success")
|
||||
except Exception as e:
|
||||
self.log_gui.log(f"[Error] 隐藏调试面板失败: {str(e)}", level="error")
|
||||
self.log_gui.log(f"隐藏调试面板失败: {str(e)}", level="error")
|
||||
|
||||
def _set_config_panel_btn_state(self, state):
|
||||
"""统一设置配置面板按钮状态(disabled/normal)。"""
|
||||
@@ -434,7 +428,7 @@ class PQAutomationApp:
|
||||
"""切换信号格式 Tab 到目标测试类型。"""
|
||||
if not hasattr(self, "signal_tabs"):
|
||||
if hasattr(self, "log_gui"):
|
||||
self.log_gui.log("[Error] signal_tabs 尚未创建", level="error")
|
||||
self.log_gui.log("signal_tabs 尚未创建", level="error")
|
||||
return
|
||||
|
||||
try:
|
||||
@@ -484,24 +478,14 @@ class PQAutomationApp:
|
||||
if gamma_tab_id in current_tabs:
|
||||
gamma_index = current_tabs.index(gamma_tab_id)
|
||||
self.chart_notebook.forget(gamma_index)
|
||||
if hasattr(self, "log_gui"):
|
||||
self.log_gui.log("已隐藏 Gamma 曲线 Tab", level="success")
|
||||
|
||||
if eotf_tab_id not in current_tabs:
|
||||
self.chart_notebook.insert(1, self.eotf_chart_frame, text="EOTF 曲线")
|
||||
if hasattr(self, "log_gui"):
|
||||
self.log_gui.log("已显示 EOTF 曲线 Tab", level="success")
|
||||
else:
|
||||
if eotf_tab_id in current_tabs:
|
||||
eotf_index = current_tabs.index(eotf_tab_id)
|
||||
self.chart_notebook.forget(eotf_index)
|
||||
if hasattr(self, "log_gui"):
|
||||
self.log_gui.log("已隐藏 EOTF 曲线 Tab", level="success")
|
||||
|
||||
if gamma_tab_id not in current_tabs:
|
||||
self.chart_notebook.insert(1, self.gamma_chart_frame, text="Gamma 曲线")
|
||||
if hasattr(self, "log_gui"):
|
||||
self.log_gui.log("已显示 Gamma 曲线 Tab", level="success")
|
||||
|
||||
custom_tab_id = str(self.custom_template_tab_frame)
|
||||
current_tabs = list(self.chart_notebook.tabs())
|
||||
@@ -509,13 +493,9 @@ class PQAutomationApp:
|
||||
if test_type == "sdr_movie":
|
||||
if custom_tab_id not in current_tabs:
|
||||
self.chart_notebook.add(self.custom_template_tab_frame, text="客户模板结果显示")
|
||||
if hasattr(self, "log_gui"):
|
||||
self.log_gui.log("已显示客户模板结果 Tab", level="success")
|
||||
else:
|
||||
if custom_tab_id in current_tabs:
|
||||
self.chart_notebook.forget(self.custom_template_tab_frame)
|
||||
if hasattr(self, "log_gui"):
|
||||
self.log_gui.log("已隐藏客户模板结果 Tab", level="success")
|
||||
|
||||
self.chart_notebook.update_idletasks()
|
||||
except Exception as e:
|
||||
@@ -655,7 +635,7 @@ class PQAutomationApp:
|
||||
time.sleep(0.1)
|
||||
self.root.update()
|
||||
if self.test_thread.is_alive():
|
||||
self.log_gui.log("[Error] 测试线程未能正常结束,将在后台继续等待", level="error")
|
||||
self.log_gui.log("测试线程未能正常结束,将在后台继续等待", level="error")
|
||||
else:
|
||||
self.log_gui.log("测试线程已结束", level="success")
|
||||
|
||||
@@ -663,8 +643,8 @@ class PQAutomationApp:
|
||||
"""清空测试结果对象与中间数据缓存。"""
|
||||
try:
|
||||
self.log_gui.log("清理测试数据...", level="info")
|
||||
if hasattr(self, "results"):
|
||||
self.results = None
|
||||
if hasattr(self, "results") and self.results is not None:
|
||||
self.results.clear()
|
||||
self.log_gui.log(" 测试结果对象已清空", level="success")
|
||||
for attr in [
|
||||
"gamut_results",
|
||||
@@ -677,7 +657,7 @@ class PQAutomationApp:
|
||||
setattr(self, attr, None)
|
||||
self.log_gui.log(" 所有中间数据已清空", level="success")
|
||||
except Exception as e:
|
||||
self.log_gui.log(f"[Error] 清理数据时出错: {str(e)}", level="error")
|
||||
self.log_gui.log(f"清理数据时出错: {str(e)}", level="error")
|
||||
|
||||
def _clear_charts_and_tables(self):
|
||||
"""清空图表与客户模板结果表格,并跳转到色域图 Tab。"""
|
||||
@@ -685,18 +665,18 @@ class PQAutomationApp:
|
||||
self.clear_chart()
|
||||
self.log_gui.log("图表已清空", level="success")
|
||||
except Exception as e:
|
||||
self.log_gui.log(f"[Error] 清空图表时出错: {str(e)}", level="error")
|
||||
self.log_gui.log(f"清空图表时出错: {str(e)}", level="error")
|
||||
try:
|
||||
self.clear_custom_template_results()
|
||||
self.log_gui.log("客户模板结果表格已清空", level="success")
|
||||
except Exception as e:
|
||||
self.log_gui.log(f"[Error] 清空客户模板结果表格失败: {str(e)}", level="error")
|
||||
self.log_gui.log(f"清空客户模板结果表格失败: {str(e)}", level="error")
|
||||
try:
|
||||
if hasattr(self, "chart_notebook"):
|
||||
self.chart_notebook.select(self.gamut_chart_frame)
|
||||
self.root.update_idletasks()
|
||||
except Exception as e:
|
||||
self.log_gui.log(f"[Error] 跳转到色域图失败: {str(e)}", level="error")
|
||||
self.log_gui.log(f"跳转到色域图失败: {str(e)}", level="error")
|
||||
|
||||
def _restore_ui_after_stop(self):
|
||||
"""恢复主按钮与状态栏到非测试态。"""
|
||||
@@ -785,7 +765,7 @@ class PQAutomationApp:
|
||||
messagebox.showinfo("成功", f"测试结果已保存到目录:\n{result_dir}")
|
||||
|
||||
except Exception as e:
|
||||
self.log_gui.log(f"[Error] 保存测试结果失败: {str(e)}", level="error")
|
||||
self.log_gui.log(f"保存测试结果失败: {str(e)}", level="error")
|
||||
import traceback
|
||||
|
||||
self.log_gui.log(traceback.format_exc(), level="error")
|
||||
@@ -862,7 +842,7 @@ class PQAutomationApp:
|
||||
self.save_pq_config()
|
||||
|
||||
except Exception as e:
|
||||
self.log_gui.log(f"[Error] 更新配置失败: {str(e)}", level="error")
|
||||
self.log_gui.log(f"更新配置失败: {str(e)}", level="error")
|
||||
|
||||
def update_config_and_tabs(self):
|
||||
"""更新配置并同步Tab状态"""
|
||||
|
||||
Reference in New Issue
Block a user