修改引用逻辑、新增Pattern更改界面、新增Calman灰阶界面

This commit is contained in:
xinzhu.yin
2026-05-27 11:26:28 +08:00
parent a903c17cb3
commit dff4e0df4d
24 changed files with 3327 additions and 386 deletions

View File

@@ -1,4 +1,4 @@
"""配置文件 I/OStep 4 重构)。
"""配置文件 I/OStep 4 重构)。
从 pqAutomationApp.PQAutomationApp 中搬迁。每个函数第一行 `self = app`
以保留原有 `self.xxx` 属性访问不变。
@@ -8,7 +8,13 @@ import json
import os
import sys
def get_config_path(self):
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from pqAutomationApp import PQAutomationApp
def get_config_path(self: "PQAutomationApp"):
"""获取配置文件的完整路径(兼容打包后的程序)"""
# 判断是否是打包后的程序
@@ -30,7 +36,7 @@ def get_config_path(self):
return config_file
def load_pq_config(self):
def load_pq_config(self: "PQAutomationApp"):
"""加载PQ配置兼容打包后的程序"""
try:
# 使用 self.config_file已经是动态路径
@@ -48,7 +54,7 @@ def load_pq_config(self):
self.log_gui.log(f"加载配置文件失败: {str(e)},使用默认配置", level="error")
def save_pq_config(self):
def save_pq_config(self: "PQAutomationApp"):
"""保存PQ配置兼容打包后的程序"""
try:
# 确保目录存在
@@ -61,7 +67,7 @@ def save_pq_config(self):
self.log_gui.log(f"保存配置文件失败: {str(e)}", level="error")
def clear_config_file(self):
def clear_config_file(self: "PQAutomationApp"):
"""清理配置文件(兼容打包后的程序)"""
from tkinter import messagebox
@@ -82,3 +88,13 @@ def clear_config_file(self):
self.log_gui.log(f"配置文件清理失败: {str(e)}", level="error")
class ConfigIOMixin:
"""由 tools/refactor_to_mixins.py 自动生成。
把本模块的自由函数挂到 PQAutomationApp 上,便于 F12 跳转与类型推断。
"""
get_config_path = get_config_path
load_pq_config = load_pq_config
save_pq_config = save_pq_config
clear_config_file = clear_config_file