重构UCD模块

This commit is contained in:
xinzhu.yin
2026-06-11 15:53:41 +08:00
parent 38222ff002
commit cc7218411c
11 changed files with 395 additions and 188 deletions

View File

@@ -218,7 +218,7 @@ def show_custom_result_context_menu(self: "PQAutomationApp", event):
can_single_step = (
has_selection
and self.ca is not None
and self.ucd is not None
and self.signal_service.is_connected
and not self.testing
)
try:
@@ -259,7 +259,7 @@ def start_custom_row_single_step(self: "PQAutomationApp"):
if not hasattr(self, "custom_result_tree"):
return
if self.ca is None or self.ucd is None:
if self.ca is None or not self.signal_service.is_connected:
messagebox.showerror("错误", "请先连接CA410和信号发生器")
return
@@ -570,7 +570,7 @@ def append_custom_template_result(self: "PQAutomationApp", row_no, result_data):
def start_custom_template_test(self: "PQAutomationApp"):
"""开始客户模板测试SDR"""
if self.ca is None or self.ucd is None:
if self.ca is None or not self.signal_service.is_connected:
messagebox.showerror("错误", "请先连接CA410和信号发生器")
return

View File

@@ -1077,7 +1077,7 @@ def on_screen_module_signal_format_changed(self: "PQAutomationApp", event=None):
self.save_pq_config()
return
if getattr(self.ucd, "status", False):
if self.signal_service.is_connected:
ok = self.signal_service.update_signal_format(
color_space=color_space,
data_range=data_range,
@@ -1121,7 +1121,7 @@ def on_sdr_output_format_changed(self: "PQAutomationApp", event=None):
self.log_gui.log("警告: 测试进行中,格式更改将在下次测试时生效", level="error")
return
if getattr(self.ucd, "status", False):
if self.signal_service.is_connected:
ok = self.signal_service.update_signal_format(
color_space=self.sdr_color_space_var.get(),
data_range=self.sdr_data_range_var.get(),
@@ -1145,7 +1145,7 @@ def on_hdr_output_format_changed(self: "PQAutomationApp", event=None):
self.log_gui.log("警告: 测试进行中,格式更改将在下次测试时生效", level="error")
return
if getattr(self.ucd, "status", False):
if self.signal_service.is_connected:
ok = self.signal_service.update_signal_format(
color_space=self.hdr_color_space_var.get(),
data_range=self.hdr_data_range_var.get(),
@@ -1169,6 +1169,9 @@ def on_local_dimming_timing_changed(self: "PQAutomationApp", event=None):
self.config.current_test_types.setdefault("local_dimming", {})["timing"] = selected_timing
if hasattr(self, "invalidate_ld_ucd_params_cache"):
self.invalidate_ld_ucd_params_cache()
if self.testing:
self.log_gui.log("警告: 测试进行中,分辨率更改将在下次测试时生效", level="error")
@@ -1191,6 +1194,9 @@ def on_local_dimming_signal_format_changed(self: "PQAutomationApp", event=None):
ld_cfg["bpc"] = UCDEnum.SignalFormat.BitDepth.get_bit_value(bit_depth)
ld_cfg["data_range"] = data_range
if hasattr(self, "invalidate_ld_ucd_params_cache"):
self.invalidate_ld_ucd_params_cache()
self.log_gui.log(
(
"Local Dimming 信号格式已更新: "
@@ -1205,7 +1211,7 @@ def on_local_dimming_signal_format_changed(self: "PQAutomationApp", event=None):
self.save_pq_config()
return
if getattr(self.ucd, "status", False):
if self.signal_service.is_connected:
ok = self.signal_service.update_signal_format(
color_space=color_space,
data_range=data_range,