feat: 产品更名 DLPilot(3D 光固化光机调试台) + 按标记调整界面

This commit is contained in:
2026-09-12 03:05:32 +08:00
parent 90433064ec
commit 744fbfd298
11 changed files with 131 additions and 87 deletions
+56 -13
View File
@@ -1,9 +1,9 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
HDMI-Tool 主界面 — CustomTkinter 双栏仪表盘
DLPilot 主界面 — CustomTkinter 双栏仪表盘
================================================================
布局(HDMI-Tool/UI参考布局.svg):
布局(DLPilot/UI参考布局.svg):
左列 显示器选择 | 支持的模式 | EDID 信息 | 测试图案/纯色/自定义 | EDID 原始数据
右列 串口选择与参数 | 串口数据(收发日志) | 预设与自定义命令 | 光强/定时快捷滑条
默认深色外观, 顶栏可切换 Dark/Light/System。
@@ -12,6 +12,7 @@ HDMI-Tool 主界面 — CustomTkinter 双栏仪表盘
投屏窗口在 patterns, 串口协议在 dlpc_rs485, 运行配置在 config。
"""
import ctypes
import ctypes
import os
import queue
@@ -63,7 +64,11 @@ def run_gui(auto_close=0):
class App(ctk.CTk):
def __init__(self, auto_close=0):
super().__init__()
self.title('HDMI-Tool — EDID 查看器 + 测试图案 + 光机控制 (LT8619C 转接板调试)')
self.title('DLPilot — 3D 光固化光机调试台 (EDID · 测试图案 · RS485 光机控制)')
try: # 任务栏独立分组
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('hulk.DLPilot')
except Exception:
pass
self.geometry('1440x920')
self.minsize(1180, 800)
ic = get_icon_path()
@@ -97,8 +102,10 @@ class App(ctk.CTk):
def _set_appearance(self, mode):
ctk.set_appearance_mode(mode)
def _card(self, parent, title, button=None, command=None, right_label=None):
"""卡片容器: 圆角边框 + 标题行(可带右侧小按钮/右对齐标签), 返回 (卡片, 内容 frame)
def _card(self, parent, title, button=None, command=None, right_label=None,
right_widget=None):
"""卡片容器: 圆角边框 + 标题行(可带右侧小按钮/右对齐标签/自定义控件),
返回 (卡片, 内容 frame)
卡片自身用 grid 参与列布局; 卡片内部(head/content/行控件)一律用 pack。
"""
@@ -107,6 +114,8 @@ class App(ctk.CTk):
head = ctk.CTkFrame(card, fg_color='transparent')
head.pack(fill='x', padx=12, pady=(8, 0))
ctk.CTkLabel(head, text=title, font=BOLD, anchor='w').pack(side='left')
if right_widget is not None: # 自定义控件(如 电流读数+查电流)
right_widget.pack(side='right')
if right_label is not None:
ctk.CTkLabel(head, textvariable=right_label,
text_color='gray60').pack(side='right')
@@ -120,7 +129,7 @@ class App(ctk.CTk):
def _build(self):
top = ctk.CTkFrame(self, fg_color='transparent')
top.pack(fill='x', padx=12, pady=(10, 2))
ctk.CTkLabel(top, text='HDMI-Tool', font=TITLE_FONT).pack(side='left')
ctk.CTkLabel(top, text='DLPilot', font=TITLE_FONT).pack(side='left')
ctk.CTkLabel(top, text='EDID · 测试图案 · 光机控制',
text_color='gray60').pack(side='left', padx=10, pady=(6, 0))
seg = ctk.CTkSegmentedButton(top, values=['Dark', 'Light', 'System'],
@@ -149,8 +158,8 @@ class App(ctk.CTk):
).pack(expand=True)
def _build_left(self, col):
col.grid_rowconfigure(1, weight=2) # 支持的模式(与 EDID 信息等高)
col.grid_rowconfigure(2, weight=2) # EDID 信息
col.grid_rowconfigure(1, weight=2) # 支持的模式
col.grid_rowconfigure(2, weight=1) # EDID 信息(压缩高度)
col.grid_rowconfigure(4, weight=0) # EDID 原始数据(固定高, 压缩)
col.grid_columnconfigure(0, weight=1)
@@ -218,7 +227,7 @@ class App(ctk.CTk):
row3 = ctk.CTkFrame(c, fg_color='transparent')
row3.pack(fill='x', pady=(6, 0))
self.slot_buttons = []
for i in range(config.SLOT_COUNT):
for i in range(3): # 自定义栏位(沿用原 3 槽配置)
cell = ctk.CTkFrame(row3, fg_color='transparent')
cell.pack(side='left', padx=(0, 10))
btn = ctk.CTkButton(cell, text=self.slots[i]['name'], width=96,
@@ -231,6 +240,22 @@ class App(ctk.CTk):
self.slot_buttons.append(btn)
ctk.CTkLabel(row3, text='点击投图, 齿轮按钮配置图片',
text_color='gray50').pack(side='left', padx=4)
# -- 光校图案(预留 5 槽): 3D 光固化打印测试/校准用图 --
row4 = ctk.CTkFrame(c, fg_color='transparent')
row4.pack(fill='x', pady=(6, 0))
for i in range(3, config.SLOT_COUNT):
cell = ctk.CTkFrame(row4, fg_color='transparent')
cell.pack(side='left', padx=(0, 10))
btn = ctk.CTkButton(cell, text=self.slots[i]['name'], width=96,
command=lambda i=i: self._show_custom(i))
btn.pack(side='left')
ctk.CTkButton(cell, text='\uE713', width=30, height=24,
font=('Segoe MDL2 Assets', 13),
command=lambda i=i: self._configure_slot(i)
).pack(side='left', padx=(4, 0))
self.slot_buttons.append(btn)
ctk.CTkLabel(row4, text='校准图案(预留 5 槽, 齿轮改图)',
text_color='gray50').pack(side='left', padx=4)
# -- EDID 原始数据 --
card, c = self._card(col, 'EDID 原始数据',
@@ -293,12 +318,20 @@ class App(ctk.CTk):
'累加和校验; 全部命令见 README"光机控制"')
# -- 光机命令 --
card, c = self._card(col,'光机命令 — 预设 / 自定义 / TEC')
# 标题行右侧: 电流实时读数 + 查电流按钮(okR..G..B.. 应答解析)
cur_frame = ctk.CTkFrame(self, fg_color='transparent')
self.var_current = tk.StringVar(value='电流: —')
ctk.CTkLabel(cur_frame, textvariable=self.var_current, width=168,
anchor='e', text_color='#3B8ED0').pack(side='left')
ctk.CTkButton(cur_frame, text='查电流', width=64, height=24,
command=self._query_current).pack(side='left', padx=(6, 0))
card, c = self._card(col,'光机命令 — 预设 / 自定义 / TEC',
right_widget=cur_frame)
card.grid(row=2, column=0, sticky='ew', pady=(10, 0))
row1 = ctk.CTkFrame(c, fg_color='transparent')
row1.pack(fill='x')
for name, cmd in (('开光机', 'M730S0'), ('关光机', 'M730S1'),
('电流', 'M732'), ('版本', 'M999'), ('软件重启', 'M888'),
('查版本', 'M999'), ('软件重启', 'M888'),
('开TEC', 'M7S0'), ('关TEC', 'M7S1'), ('TEC33.0°C', 'M8S330')):
ctk.CTkButton(row1, text=name, width=64,
command=lambda cc=cmd: self._dlpc_send(cc)
@@ -365,7 +398,7 @@ class App(ctk.CTk):
textvariable=self.var_light)
self.ent_light.pack(side='left')
self.ent_light.bind('<Return>', self._light_entry_apply)
ctk.CTkButton(rowa, text='下发 M731S', width=110,
ctk.CTkButton(rowa, text='下发电流值', width=110,
command=self._dlpc_send_light).pack(side='left', padx=(6, 0))
rowb = ctk.CTkFrame(c, fg_color='transparent')
rowb.pack(fill='x', pady=(8, 0))
@@ -395,7 +428,7 @@ class App(ctk.CTk):
textvariable=self.var_tec)
self.ent_tec.pack(side='left')
self.ent_tec.bind('<Return>', self._tec_entry_apply)
ctk.CTkButton(rowc, text='下发 M8S', width=110,
ctk.CTkButton(rowc, text='下发温度值', width=110,
command=self._dlpc_send_tec).pack(side='left', padx=(6, 0))
# ============================================================
@@ -634,8 +667,16 @@ class App(ctk.CTk):
except ValueError:
text = f'{which}: {m.group(1)}'
self._dlpc_log_q.put(('temp', text))
# 电流查询应答: okR<n>G<n>B<n> -> 标题行实时读数
m = re.search(r'← okR(\d+)G(\d+)B(\d+)', line)
if m:
self._dlpc_log_q.put(('current', f'电流 R:{m.group(1)} '
f'G:{m.group(2)} B:{m.group(3)}'))
self._dlpc_log_q.put(('event', line))
def _query_current(self):
self._dlpc_send('M732')
def _query_dmd(self):
self._tl_order.append('DMD')
self._dlpc_send('M201')
@@ -666,6 +707,8 @@ class App(ctk.CTk):
self.var_dmd.set(text)
else:
self.var_lamp.set(text)
elif kind == 'current':
self.var_current.set(text)
self._dlpc_log(text)
except queue.Empty:
pass