修改引用逻辑、新增Pattern更改界面、新增Calman灰阶界面
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""测试执行(runner)相关逻辑(Step 5 重构)。
|
||||
"""测试执行(runner)相关逻辑(Step 5 重构)。
|
||||
|
||||
从 pqAutomationApp.PQAutomationApp 中搬迁。每个函数第一行 `self = app`
|
||||
以保留原有 `self.xxx` 属性访问不变。
|
||||
@@ -15,7 +15,13 @@ import numpy as np
|
||||
import algorithm.pq_algorithm as pq_algorithm
|
||||
from app.pq.pq_result import PQResult
|
||||
|
||||
def new_pq_results(self, test_type, test_name):
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from pqAutomationApp import PQAutomationApp
|
||||
|
||||
|
||||
def new_pq_results(self: "PQAutomationApp", test_type, test_name):
|
||||
# 通过 PQResultStore 创建/替换指定 test_type 的结果,并设为当前活跃
|
||||
self.results.new(test_type, test_name)
|
||||
# 设置配置
|
||||
@@ -36,7 +42,7 @@ def new_pq_results(self, test_type, test_name):
|
||||
)
|
||||
|
||||
|
||||
def run_test(self, test_type, test_items):
|
||||
def run_test(self: "PQAutomationApp", test_type, test_items):
|
||||
"""执行测试"""
|
||||
try:
|
||||
self.log_gui.log(f"开始执行{self.get_test_type_name(test_type)}测试", level="info")
|
||||
@@ -63,7 +69,7 @@ def run_test(self, test_type, test_items):
|
||||
self._dispatch_ui(self.on_test_error)
|
||||
|
||||
|
||||
def run_screen_module_test(self, test_items):
|
||||
def run_screen_module_test(self: "PQAutomationApp", test_items):
|
||||
"""执行屏模组性能测试 - 优化版"""
|
||||
self.log_gui.log("执行屏模组性能测试...", level="info")
|
||||
|
||||
@@ -138,7 +144,7 @@ def run_screen_module_test(self, test_items):
|
||||
self.test_contrast("screen_module", shared_gray_data)
|
||||
|
||||
|
||||
def run_custom_sdr_test(self, test_items):
|
||||
def run_custom_sdr_test(self: "PQAutomationApp", test_items):
|
||||
"""执行客户定制 SDR 测试 - 升级版"""
|
||||
self.log_gui.log("执行客户定制 SDR 测试...", level="info")
|
||||
# 获取信号格式设置
|
||||
@@ -154,7 +160,7 @@ def run_custom_sdr_test(self, test_items):
|
||||
self._dispatch_ui(self.on_custom_template_test_completed)
|
||||
|
||||
|
||||
def run_sdr_movie_test(self, test_items):
|
||||
def run_sdr_movie_test(self: "PQAutomationApp", test_items):
|
||||
"""执行SDR Movie测试"""
|
||||
self.log_gui.log("执行SDR Movie测试...", level="info")
|
||||
|
||||
@@ -225,7 +231,7 @@ def run_sdr_movie_test(self, test_items):
|
||||
self.test_color_accuracy("sdr_movie")
|
||||
|
||||
|
||||
def run_hdr_movie_test(self, test_items):
|
||||
def run_hdr_movie_test(self: "PQAutomationApp", test_items):
|
||||
"""执行HDR Movie测试"""
|
||||
self.log_gui.log("执行HDR Movie测试...", level="info")
|
||||
|
||||
@@ -300,7 +306,7 @@ def run_hdr_movie_test(self, test_items):
|
||||
self.test_color_accuracy("hdr_movie")
|
||||
|
||||
|
||||
def send_fix_pattern(self, mode):
|
||||
def send_fix_pattern(self: "PQAutomationApp", mode):
|
||||
"""发送固定图案并采集数据 - 支持不同测试类型的信号格式"""
|
||||
results = []
|
||||
|
||||
@@ -460,7 +466,7 @@ def send_fix_pattern(self, mode):
|
||||
return None
|
||||
|
||||
|
||||
def test_custom_sdr(self):
|
||||
def test_custom_sdr(self: "PQAutomationApp"):
|
||||
"""执行客户定制 SDR 测试 - 升级版"""
|
||||
self.log_gui.log("执行客户定制 SDR 测试...", level="info")
|
||||
results = self.send_fix_pattern("custom")
|
||||
@@ -471,7 +477,7 @@ def test_custom_sdr(self):
|
||||
self.log_gui.log(f"客户模板采集完成,共 {len(results)} 组数据", level="success")
|
||||
|
||||
|
||||
def test_gamut(self, test_type):
|
||||
def test_gamut(self: "PQAutomationApp", test_type):
|
||||
"""测试色域"""
|
||||
self.log_gui.log("开始测试色域...", level="info")
|
||||
self.results.start_test_item("gamut")
|
||||
@@ -629,7 +635,7 @@ def test_gamut(self, test_type):
|
||||
raise
|
||||
|
||||
|
||||
def test_gamma(self, test_type, gray_data=None):
|
||||
def test_gamma(self: "PQAutomationApp", test_type, gray_data=None):
|
||||
"""测试Gamma曲线
|
||||
|
||||
Args:
|
||||
@@ -720,7 +726,7 @@ def test_gamma(self, test_type, gray_data=None):
|
||||
raise
|
||||
|
||||
|
||||
def test_eotf(self, test_type, gray_data=None):
|
||||
def test_eotf(self: "PQAutomationApp", test_type, gray_data=None):
|
||||
"""测试 EOTF 曲线(HDR 专用)
|
||||
|
||||
Args:
|
||||
@@ -803,7 +809,7 @@ def test_eotf(self, test_type, gray_data=None):
|
||||
raise
|
||||
|
||||
|
||||
def test_cct(self, test_type, gray_data=None):
|
||||
def test_cct(self: "PQAutomationApp", test_type, gray_data=None):
|
||||
"""测试色度一致性"""
|
||||
self.log_gui.log("开始测试色度一致性...", level="info")
|
||||
self.results.start_test_item("cct")
|
||||
@@ -843,7 +849,7 @@ def test_cct(self, test_type, gray_data=None):
|
||||
raise
|
||||
|
||||
|
||||
def test_contrast(self, test_type, gray_data=None):
|
||||
def test_contrast(self: "PQAutomationApp", test_type, gray_data=None):
|
||||
"""测试对比度
|
||||
|
||||
Args:
|
||||
@@ -907,7 +913,7 @@ def test_contrast(self, test_type, gray_data=None):
|
||||
raise
|
||||
|
||||
|
||||
def test_color_accuracy(self, test_type):
|
||||
def test_color_accuracy(self: "PQAutomationApp", test_type):
|
||||
"""测试色准 - 使用手工实现的 ΔE 2000(应用 Gamma)"""
|
||||
|
||||
# ========== Gamma 参考值 ==========
|
||||
@@ -1067,7 +1073,7 @@ def test_color_accuracy(self, test_type):
|
||||
self.log_gui.log("色准测试完成", level="success")
|
||||
|
||||
|
||||
def on_test_completed(self):
|
||||
def on_test_completed(self: "PQAutomationApp"):
|
||||
"""测试完成后的UI更新"""
|
||||
self.testing = False
|
||||
self.start_btn.config(state=tk.NORMAL)
|
||||
@@ -1210,7 +1216,7 @@ def on_test_completed(self):
|
||||
messagebox.showinfo("完成", "测试已完成!")
|
||||
|
||||
|
||||
def on_custom_template_test_completed(self):
|
||||
def on_custom_template_test_completed(self: "PQAutomationApp"):
|
||||
"""客户模板测试完成后的UI更新"""
|
||||
self.testing = False
|
||||
self.set_custom_result_table_locked(False)
|
||||
@@ -1231,7 +1237,7 @@ def on_custom_template_test_completed(self):
|
||||
messagebox.showinfo("完成", "客户模板测试已完成!")
|
||||
|
||||
|
||||
def get_current_test_result(self):
|
||||
def get_current_test_result(self: "PQAutomationApp"):
|
||||
"""获取当前测试结果"""
|
||||
test_type = self.test_type_var.get()
|
||||
test_items = self.get_selected_test_items()
|
||||
@@ -1263,7 +1269,7 @@ def get_current_test_result(self):
|
||||
return result
|
||||
|
||||
|
||||
def on_test_error(self):
|
||||
def on_test_error(self: "PQAutomationApp"):
|
||||
"""测试出错后的UI更新"""
|
||||
self.testing = False
|
||||
self.set_custom_result_table_locked(False)
|
||||
@@ -1284,3 +1290,27 @@ def on_test_error(self):
|
||||
messagebox.showerror("错误", "测试过程中发生错误,请查看日志")
|
||||
|
||||
|
||||
|
||||
|
||||
class TestRunnerMixin:
|
||||
"""由 tools/refactor_to_mixins.py 自动生成。
|
||||
把本模块的自由函数挂到 PQAutomationApp 上,便于 F12 跳转与类型推断。
|
||||
"""
|
||||
new_pq_results = new_pq_results
|
||||
run_test = run_test
|
||||
run_screen_module_test = run_screen_module_test
|
||||
run_custom_sdr_test = run_custom_sdr_test
|
||||
run_sdr_movie_test = run_sdr_movie_test
|
||||
run_hdr_movie_test = run_hdr_movie_test
|
||||
send_fix_pattern = send_fix_pattern
|
||||
test_custom_sdr = test_custom_sdr
|
||||
test_gamut = test_gamut
|
||||
test_gamma = test_gamma
|
||||
test_eotf = test_eotf
|
||||
test_cct = test_cct
|
||||
test_contrast = test_contrast
|
||||
test_color_accuracy = test_color_accuracy
|
||||
on_test_completed = on_test_completed
|
||||
on_custom_template_test_completed = on_custom_template_test_completed
|
||||
get_current_test_result = get_current_test_result
|
||||
on_test_error = on_test_error
|
||||
|
||||
Reference in New Issue
Block a user