修改引用逻辑、新增Pattern更改界面、新增Calman灰阶界面
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""主布局面板创建函数(Step 6 重构)。"""
|
||||
"""主布局面板创建函数(Step 6 重构)。"""
|
||||
|
||||
import re
|
||||
import tkinter as tk
|
||||
@@ -8,7 +8,13 @@ from drivers.UCD323_Enum import UCDEnum
|
||||
from app.views.collapsing_frame import CollapsingFrame
|
||||
from app.resources import load_icon
|
||||
|
||||
def create_floating_config_panel(self):
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from pqAutomationApp import PQAutomationApp
|
||||
|
||||
|
||||
def create_floating_config_panel(self: "PQAutomationApp"):
|
||||
"""创建右上角悬浮配置框"""
|
||||
cf = CollapsingFrame(self.control_frame_top)
|
||||
cf.pack(fill="both")
|
||||
@@ -53,7 +59,7 @@ def create_floating_config_panel(self):
|
||||
self.config_panel_frame.btn.configure(image="closed")
|
||||
|
||||
|
||||
def create_test_items_content(self):
|
||||
def create_test_items_content(self: "PQAutomationApp"):
|
||||
"""创建测试项目选项卡内容"""
|
||||
# 创建测试项目字典,用于管理不同测试类型的选项
|
||||
self.test_items = {
|
||||
@@ -96,7 +102,7 @@ def create_test_items_content(self):
|
||||
self.create_cct_params_frame()
|
||||
|
||||
|
||||
def create_signal_format_content(self):
|
||||
def create_signal_format_content(self: "PQAutomationApp"):
|
||||
"""创建信号格式选项卡内容"""
|
||||
self.signal_tabs = ttk.Notebook(self.signal_format_frame)
|
||||
self.signal_tabs.pack(fill=tk.BOTH, expand=True)
|
||||
@@ -314,7 +320,7 @@ def create_signal_format_content(self):
|
||||
self.signal_tabs.tab(2, state="disabled") # 禁用 HDR
|
||||
|
||||
|
||||
def create_connection_content(self):
|
||||
def create_connection_content(self: "PQAutomationApp"):
|
||||
"""创建设备连接区域"""
|
||||
# 创建设备连接区域的主框架
|
||||
com_frame = ttk.Frame(self.connection_frame)
|
||||
@@ -424,7 +430,7 @@ def create_connection_content(self):
|
||||
ca_channel_combo.bind("<<ComboboxSelected>>", self.update_config)
|
||||
|
||||
|
||||
def create_test_type_frame(self):
|
||||
def create_test_type_frame(self: "PQAutomationApp"):
|
||||
"""创建测试类型选择区域(侧边栏形式)"""
|
||||
# 设置测试类型变量
|
||||
self.test_type_var = tk.StringVar(value="screen_module")
|
||||
@@ -503,6 +509,26 @@ def create_test_type_frame(self):
|
||||
)
|
||||
self.pantone_baseline_btn.pack(fill=tk.X, padx=0, pady=1)
|
||||
|
||||
# Gamma 测试图案配置按钮
|
||||
self.gamma_pattern_btn = ttk.Button(
|
||||
self.sidebar_frame,
|
||||
text="Gamma 图案配置",
|
||||
style="Sidebar.TButton",
|
||||
command=self.toggle_gamma_pattern_panel,
|
||||
takefocus=False,
|
||||
)
|
||||
self.gamma_pattern_btn.pack(fill=tk.X, padx=0, pady=1)
|
||||
|
||||
# CALMAN 风格灰阶测试按钮
|
||||
self.calman_btn = ttk.Button(
|
||||
self.sidebar_frame,
|
||||
text="CALMAN 灰阶",
|
||||
style="Sidebar.TButton",
|
||||
command=self.toggle_calman_panel,
|
||||
takefocus=False,
|
||||
)
|
||||
self.calman_btn.pack(fill=tk.X, padx=0, pady=1)
|
||||
|
||||
# 测试版水印标签(版本 x.x.0.0 时显示)
|
||||
from app_version import is_beta_version, APP_VERSION
|
||||
if is_beta_version():
|
||||
@@ -528,9 +554,13 @@ def create_test_type_frame(self):
|
||||
self.panels["single_step"]["button"] = self.single_step_btn
|
||||
if "pantone_baseline" in self.panels:
|
||||
self.panels["pantone_baseline"]["button"] = self.pantone_baseline_btn
|
||||
if "gamma_pattern" in self.panels:
|
||||
self.panels["gamma_pattern"]["button"] = self.gamma_pattern_btn
|
||||
if "calman" in self.panels:
|
||||
self.panels["calman"]["button"] = self.calman_btn
|
||||
|
||||
|
||||
def update_config_info_display(self):
|
||||
def update_config_info_display(self: "PQAutomationApp"):
|
||||
"""更新配置信息显示"""
|
||||
if hasattr(self, "config") and hasattr(self.config, "get_current_config"):
|
||||
current_config = self.config.get_current_config()
|
||||
@@ -547,7 +577,7 @@ def update_config_info_display(self):
|
||||
self.update_sidebar_selection()
|
||||
|
||||
|
||||
def create_operation_frame(self):
|
||||
def create_operation_frame(self: "PQAutomationApp"):
|
||||
"""创建操作按钮区域"""
|
||||
operation_frame = ttk.Frame(self.control_frame_top)
|
||||
operation_frame.pack(fill=tk.X, padx=5, pady=10)
|
||||
@@ -594,7 +624,7 @@ def create_operation_frame(self):
|
||||
self.update_custom_button_visibility()
|
||||
|
||||
|
||||
def on_screen_module_timing_changed(self, event=None):
|
||||
def on_screen_module_timing_changed(self: "PQAutomationApp", event=None):
|
||||
"""屏模组信号格式改变时的回调"""
|
||||
try:
|
||||
selected_timing = self.screen_module_timing_var.get()
|
||||
@@ -632,7 +662,7 @@ def on_screen_module_timing_changed(self, event=None):
|
||||
self.log_gui.log(f"屏模组信号格式更改失败: {str(e)}", level="error")
|
||||
|
||||
|
||||
def on_sdr_timing_changed(self, event=None):
|
||||
def on_sdr_timing_changed(self: "PQAutomationApp", event=None):
|
||||
"""SDR测试分辨率改变时的回调"""
|
||||
try:
|
||||
selected_timing = self.sdr_timing_var.get()
|
||||
@@ -650,7 +680,7 @@ def on_sdr_timing_changed(self, event=None):
|
||||
self.log_gui.log(f"SDR测试分辨率更改失败: {str(e)}", level="error")
|
||||
|
||||
|
||||
def on_sdr_output_format_changed(self, event=None):
|
||||
def on_sdr_output_format_changed(self: "PQAutomationApp", event=None):
|
||||
"""SDR 色彩格式改变时的回调"""
|
||||
try:
|
||||
fmt = self.sdr_output_format_var.get()
|
||||
@@ -674,7 +704,7 @@ def on_sdr_output_format_changed(self, event=None):
|
||||
self.log_gui.log(f"SDR色彩格式更改失败: {str(e)}", level="error")
|
||||
|
||||
|
||||
def on_hdr_output_format_changed(self, event=None):
|
||||
def on_hdr_output_format_changed(self: "PQAutomationApp", event=None):
|
||||
"""HDR 色彩格式改变时的回调"""
|
||||
try:
|
||||
fmt = self.hdr_output_format_var.get()
|
||||
@@ -700,7 +730,7 @@ def on_hdr_output_format_changed(self, event=None):
|
||||
self.log_gui.log(f"HDR色彩格式更改失败: {str(e)}", level="error")
|
||||
|
||||
|
||||
def update_test_items(self):
|
||||
def update_test_items(self: "PQAutomationApp"):
|
||||
"""根据当前测试类型更新测试项目复选框"""
|
||||
# 先隐藏所有测试项目框架
|
||||
for config in self.test_items.values():
|
||||
@@ -747,7 +777,7 @@ def update_test_items(self):
|
||||
self.toggle_cct_params_frame()
|
||||
|
||||
|
||||
def on_test_type_change(self):
|
||||
def on_test_type_change(self: "PQAutomationApp"):
|
||||
"""根据测试类型更新内容区域"""
|
||||
# 更新配置信息显示
|
||||
if hasattr(self, "config") and hasattr(self.config, "get_current_config"):
|
||||
@@ -756,3 +786,22 @@ def on_test_type_change(self):
|
||||
# SDR 选中时显示客户模版按钮
|
||||
self.update_custom_button_visibility()
|
||||
|
||||
|
||||
|
||||
class MainLayoutMixin:
|
||||
"""由 tools/refactor_to_mixins.py 自动生成。
|
||||
把本模块的自由函数挂到 PQAutomationApp 上,便于 F12 跳转与类型推断。
|
||||
"""
|
||||
create_floating_config_panel = create_floating_config_panel
|
||||
create_test_items_content = create_test_items_content
|
||||
create_signal_format_content = create_signal_format_content
|
||||
create_connection_content = create_connection_content
|
||||
create_test_type_frame = create_test_type_frame
|
||||
update_config_info_display = update_config_info_display
|
||||
create_operation_frame = create_operation_frame
|
||||
on_screen_module_timing_changed = on_screen_module_timing_changed
|
||||
on_sdr_timing_changed = on_sdr_timing_changed
|
||||
on_sdr_output_format_changed = on_sdr_output_format_changed
|
||||
on_hdr_output_format_changed = on_hdr_output_format_changed
|
||||
update_test_items = update_test_items
|
||||
on_test_type_change = on_test_type_change
|
||||
|
||||
Reference in New Issue
Block a user