修改Calman灰阶中结果图显示、修改UI主题样式应用

This commit is contained in:
xinzhu.yin
2026-06-04 10:36:15 +08:00
parent 3aa975c4d3
commit 49d82da8b9
16 changed files with 597 additions and 210 deletions

View File

@@ -388,50 +388,31 @@ class PQAutomationApp(
if hasattr(self, "log_gui"):
self.log_gui.log(f"切换信号格式失败: {str(e)}", level="error")
def _switch_chart_tabs_by_test_type(self, test_type):
"""按测试类型切换 Gamma/EOTF 与客户模板结果 Tab"""
if not hasattr(self, "chart_notebook"):
def _sync_custom_template_tab_visibility(self, test_type):
"""按测试类型与客户模板结果状态同步客户模板 Tab 可见性"""
if not hasattr(self, "_set_custom_template_tab_visible"):
return
try:
def _safe_insert_tab(frame, text, target_pos=1):
"""安全插入 Tab有目标位置则插入否则追加到末尾。"""
tabs = list(self.chart_notebook.tabs())
if not tabs or target_pos >= len(tabs):
self.chart_notebook.add(frame, text=text)
return
before_tab_id = tabs[target_pos]
self.chart_notebook.insert(before_tab_id, frame, text=text)
# 客户模板结果 Tab 只属于 SDR Movie。
if test_type != "sdr_movie":
self._set_custom_template_tab_visible(False)
return
current_tabs = list(self.chart_notebook.tabs())
gamma_tab_id = str(self.gamma_chart_frame)
eotf_tab_id = str(self.eotf_chart_frame)
has_custom_rows = False
tree = getattr(self, "custom_result_tree", None)
if tree is not None:
try:
has_custom_rows = len(tree.get_children()) > 0
except Exception:
has_custom_rows = False
if test_type == "hdr_movie":
if gamma_tab_id in current_tabs:
self.chart_notebook.forget(self.gamma_chart_frame)
if eotf_tab_id not in current_tabs:
_safe_insert_tab(self.eotf_chart_frame, "EOTF 曲线", target_pos=1)
else:
if eotf_tab_id in current_tabs:
self.chart_notebook.forget(self.eotf_chart_frame)
if gamma_tab_id not in current_tabs:
_safe_insert_tab(self.gamma_chart_frame, "Gamma 曲线", target_pos=1)
custom_tab_id = str(self.custom_template_tab_frame)
current_tabs = list(self.chart_notebook.tabs())
if test_type == "sdr_movie":
if custom_tab_id not in current_tabs:
self.chart_notebook.add(self.custom_template_tab_frame, text="客户模板结果显示")
else:
if custom_tab_id in current_tabs:
self.chart_notebook.forget(self.custom_template_tab_frame)
self.chart_notebook.update_idletasks()
except Exception as e:
if hasattr(self, "log_gui"):
self.log_gui.log(f"切换 Gamma/EOTF Tab 失败: {str(e)}", level="error")
# SDR 下仅在客户模板测试进行中,或已有客户模板结果时显示。
show_tab = has_custom_rows or (
getattr(self, "testing", False)
and getattr(self, "test_type_var", None) is not None
and self.test_type_var.get() == "sdr_movie"
)
self._set_custom_template_tab_visible(show_tab)
def change_test_type(self, test_type):
"""切换测试类型"""
@@ -453,7 +434,7 @@ class PQAutomationApp(
self.update_sidebar_selection()
self.on_test_type_change()
self._switch_signal_format_tabs(test_type)
self._switch_chart_tabs_by_test_type(test_type)
self._sync_custom_template_tab_visibility(test_type)
self.sync_gamut_toolbar()
self._restore_charts_for_type(test_type)