添加信号格式修改
This commit is contained in:
@@ -4,6 +4,7 @@ from __future__ import annotations
|
||||
|
||||
import datetime
|
||||
import os
|
||||
import sys
|
||||
import threading
|
||||
import tkinter as tk
|
||||
from tkinter import filedialog, messagebox
|
||||
@@ -11,7 +12,7 @@ from tkinter import filedialog, messagebox
|
||||
import ttkbootstrap as ttk
|
||||
|
||||
|
||||
_TEMPLATE_FILE = "pantone\xa02670\xa0colors.xlsx"
|
||||
_TEMPLATE_FILE = "pantone_2670_colors.xlsx"
|
||||
|
||||
|
||||
def create_pantone_baseline_panel(self):
|
||||
@@ -153,8 +154,22 @@ def toggle_pantone_baseline_panel(self):
|
||||
self.show_panel("pantone_baseline")
|
||||
|
||||
|
||||
def _get_settings_dir(self):
|
||||
"""返回 settings 绝对目录,避免依赖当前工作目录。"""
|
||||
if getattr(self, "config_file", None):
|
||||
return os.path.dirname(self.config_file)
|
||||
|
||||
if getattr(sys, "frozen", False):
|
||||
base_dir = os.path.dirname(sys.executable)
|
||||
else:
|
||||
base_dir = os.path.dirname(
|
||||
os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
)
|
||||
return os.path.join(base_dir, "settings")
|
||||
|
||||
|
||||
def _load_patterns(self):
|
||||
path = os.path.join("settings", _TEMPLATE_FILE)
|
||||
path = os.path.join(_get_settings_dir(self), _TEMPLATE_FILE)
|
||||
if not os.path.isfile(path):
|
||||
raise FileNotFoundError(f"未找到模板文件: {path}")
|
||||
|
||||
@@ -513,7 +528,7 @@ def _auto_save_template(self):
|
||||
|
||||
def _write_template_xlsx(self, path):
|
||||
# 优先复制 settings 模板,再覆盖数据区;没有模板时自动创建同结构表。
|
||||
template_path = os.path.join("settings", _TEMPLATE_FILE)
|
||||
template_path = os.path.join(_get_settings_dir(self), _TEMPLATE_FILE)
|
||||
from openpyxl import load_workbook, Workbook
|
||||
|
||||
if os.path.isfile(template_path):
|
||||
|
||||
Reference in New Issue
Block a user