重构继续优化主文件中函数

This commit is contained in:
xinzhu.yin
2026-04-21 11:50:57 +08:00
parent a5595b7e60
commit 6b8bfe06b9
4 changed files with 423 additions and 584 deletions

View File

@@ -730,26 +730,20 @@ def toggle_cct_params_frame(self):
# 屏模组:只有色度参数
if "cct" in selected_items:
self.cct_params_frame.pack(fill=tk.X, padx=5, pady=5)
if hasattr(self, "log_gui"):
self.log_gui.log("✓ 显示屏模组色度参数设置")
elif current_test_type == "sdr_movie":
# SDR只有色度参数色准不需要参数设置框
if "cct" in selected_items:
self.sdr_cct_params_frame.pack(fill=tk.X, padx=5, pady=5)
if hasattr(self, "log_gui"):
self.log_gui.log("✓ 显示 SDR 色度参数设置")
elif current_test_type == "hdr_movie":
# HDR只有色度参数色准不需要参数设置框
if "cct" in selected_items:
if hasattr(self, "hdr_cct_params_frame"):
self.hdr_cct_params_frame.pack(fill=tk.X, padx=5, pady=5)
if hasattr(self, "log_gui"):
self.log_gui.log("✓ 显示 HDR 色度参数设置")
else:
if hasattr(self, "log_gui"):
self.log_gui.log("⚠️ HDR 色度参数框尚未创建")
self.log_gui.log("[ERROR] HDR 色度参数框尚未创建")
# ---- gamut 参考标准改变回调(统一实现) ----

View File

@@ -497,8 +497,6 @@ def create_operation_frame(self):
self.update_custom_button_visibility()
def on_screen_module_timing_changed(self, event=None):
"""屏模组信号格式改变时的回调"""
try:
@@ -535,3 +533,61 @@ def on_screen_module_timing_changed(self, event=None):
except Exception as e:
self.log_gui.log(f"❌ 屏模组信号格式更改失败: {str(e)}")
def update_test_items(self):
"""根据当前测试类型更新测试项目复选框"""
# 先隐藏所有测试项目框架
for config in self.test_items.values():
config["frame"].pack_forget()
current_test_type = self.config.current_test_type
self.test_vars = {}
if current_test_type in self.test_items:
config = self.test_items[current_test_type]
frame = config["frame"]
frame.pack(fill=tk.X, padx=5, pady=5)
# 添加测试类型标签
type_label = ttk.Label(
frame,
text=self.get_test_type_name(current_test_type),
style="primary.TLabel",
)
type_label.grid(row=0, column=0, columnspan=2, sticky=tk.W, padx=5, pady=3)
# 从配置中读取保存的选择状态
saved_test_items = self.config.current_test_types[current_test_type].get(
"test_items", []
)
# 添加复选框
for i, (text, var_name) in enumerate(config["items"]):
is_checked = var_name in saved_test_items
var = tk.BooleanVar(value=is_checked)
self.test_vars[f"{current_test_type}_{var_name}"] = var
ttk.Checkbutton(
frame,
text=text,
variable=var,
bootstyle="round-toggle",
command=self.update_config_and_tabs,
).grid(row=i // 2 + 1, column=i % 2, sticky=tk.W, padx=10, pady=5)
if hasattr(self, "chart_notebook"):
self.update_chart_tabs_state()
if hasattr(self, "cct_params_frame"):
self.toggle_cct_params_frame()
def on_test_type_change(self):
"""根据测试类型更新内容区域"""
# 更新配置信息显示
if hasattr(self, "config") and hasattr(self.config, "get_current_config"):
self.update_config_info_display()
# SDR 选中时显示客户模版按钮
self.update_custom_button_visibility()

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
{
"current_test_type": "screen_module",
"current_test_type": "sdr_movie",
"test_types": {
"screen_module": {
"name": "屏模组性能测试",