feat(DLPilot): 图标更新为 DLP/Pilot 双行设计; 图案栏位两排各 5 个等宽
This commit is contained in:
Binary file not shown.
+23
-34
@@ -40,13 +40,12 @@ REPO_URL = 'https://gitea.hulk.wang/hulk/LT8619C_Debug_Tools'
|
||||
|
||||
def get_icon_path():
|
||||
"""工具图标: 源码模式取 logos/ 下, 打包模式取 exe 内嵌资源(_MEIPASS)"""
|
||||
import os
|
||||
import sys
|
||||
if getattr(sys, 'frozen', False):
|
||||
p = os.path.join(getattr(sys, '_MEIPASS', ''), 'logo_ph_orange.ico')
|
||||
p = os.path.join(getattr(sys, '_MEIPASS', ''), 'logo_dlpilot.ico')
|
||||
else:
|
||||
p = os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
||||
'logos', 'logo_ph_orange.ico')
|
||||
'logos', 'logo_dlpilot.ico')
|
||||
return p if os.path.exists(p) else None
|
||||
|
||||
|
||||
@@ -233,38 +232,28 @@ class App(ctk.CTk):
|
||||
text_color='#000000' if color == '#00FF00' else '#FFFFFF',
|
||||
command=lambda cc=color: self._show_solid(cc)
|
||||
).pack(side='left', padx=3)
|
||||
row3 = ctk.CTkFrame(c, fg_color='transparent')
|
||||
row3.pack(fill='x', pady=(6, 0))
|
||||
# -- 图案栏位: 两排各 5 个, 等宽 --
|
||||
self.slot_buttons = []
|
||||
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,
|
||||
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(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, 6))
|
||||
btn = ctk.CTkButton(cell, text=self.slots[i]['name'], width=84,
|
||||
command=lambda i=i: self._show_custom(i))
|
||||
btn.pack(side='left')
|
||||
ctk.CTkButton(cell, text='\uE713', width=26, height=24,
|
||||
font=('Segoe MDL2 Assets', 13),
|
||||
command=lambda i=i: self._configure_slot(i)
|
||||
).pack(side='left', padx=(3, 0))
|
||||
self.slot_buttons.append(btn)
|
||||
ctk.CTkLabel(row4, text='校准图案(齿轮改图)',
|
||||
text_color='gray50').pack(side='left', padx=4)
|
||||
for row_idx, group in enumerate((range(0, 5), range(5, 10))):
|
||||
row = ctk.CTkFrame(c, fg_color='transparent')
|
||||
row.pack(fill='x', pady=(6, 0))
|
||||
for i in group:
|
||||
cell = ctk.CTkFrame(row, fg_color='transparent')
|
||||
cell.pack(side='left', padx=(0, 6))
|
||||
btn = ctk.CTkButton(cell, text=self.slots[i]['name'], width=84,
|
||||
command=lambda i=i: self._show_custom(i))
|
||||
btn.pack(side='left')
|
||||
ctk.CTkButton(cell, text='\uE713', width=26, height=24,
|
||||
font=('Segoe MDL2 Assets', 13),
|
||||
command=lambda i=i: self._configure_slot(i)
|
||||
).pack(side='left', padx=(3, 0))
|
||||
self.slot_buttons.append(btn)
|
||||
if row_idx == 0:
|
||||
ctk.CTkLabel(row, text='点击投图, 齿轮按钮配置图片',
|
||||
text_color='gray50').pack(side='left', padx=4)
|
||||
else:
|
||||
ctk.CTkLabel(row, text='校准图案(齿轮改图)',
|
||||
text_color='gray50').pack(side='left', padx=4)
|
||||
|
||||
# -- EDID 原始数据 --
|
||||
card, c = self._card(col, 'EDID 原始数据',
|
||||
|
||||
@@ -21,7 +21,7 @@ import sys
|
||||
# 本脚本位于 src/, 打包产物输出到工具根的 release/(与 pattern_slots.json 同目录)
|
||||
SRC = os.path.dirname(os.path.abspath(__file__))
|
||||
BASE = os.path.dirname(SRC)
|
||||
ICO = os.path.join(SRC, 'logos', 'logo_ph_orange.ico')
|
||||
ICO = os.path.join(SRC, 'logos', 'logo_dlpilot.ico')
|
||||
|
||||
|
||||
def ensure_pyinstaller():
|
||||
@@ -73,7 +73,7 @@ def build(name, extra_args):
|
||||
# exe 文件图标 + 运行时窗口图标资源(从 _MEIPASS 读取)
|
||||
cmd += ['--icon', ICO, '--add-data', f'{ICO};.']
|
||||
else:
|
||||
print('警告: 未找到 logos/logo_ph_orange.ico(先运行 logos/make_ico.py), 本次打包不带图标')
|
||||
print('警告: 未找到 logos/logo_dlpilot.ico(先运行 logos/make_ico.py), 本次打包不带图标')
|
||||
print('\n>>', ' '.join(cmd))
|
||||
subprocess.check_call(cmd)
|
||||
out = os.path.join(dist, name + '.exe')
|
||||
|
||||
@@ -39,7 +39,7 @@ if getattr(sys, 'frozen', False):
|
||||
BASE_DIR = os.path.dirname(os.path.abspath(sys.executable))
|
||||
else:
|
||||
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
SLOT_COUNT = 8
|
||||
SLOT_COUNT = 10
|
||||
SLOT_CONFIG = os.path.join(BASE_DIR, 'pattern_slots.json')
|
||||
IMG_EXTS = ['.png', '.gif'] + (['.jpg', '.jpeg', '.bmp', '.webp'] if HAS_PIL else [])
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.9 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 22 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 7.3 KiB |
@@ -1,6 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
||||
<rect width="512" height="512" fill="#000000"/>
|
||||
<rect x="38" y="64" width="436" height="186" rx="34" fill="#FF9900"/>
|
||||
<text x="256" y="210" font-family="Arial, 'Microsoft YaHei', sans-serif" font-size="146" font-weight="900" fill="#000000" text-anchor="middle">HDMI</text>
|
||||
<text x="256" y="421" font-family="Arial, 'Microsoft YaHei', sans-serif" font-size="146" font-weight="900" fill="#FFFFFF" text-anchor="middle">Tool</text>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 506 B |
@@ -1,13 +1,13 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
把 logo_ph_orange.svg 同款设计栅格化为多尺寸 .ico(供 exe 图标)
|
||||
DLPilot 图标栅格化: 黑底 512, 橙色圆角矩形, 第一行 DLP(框内黑字), 第二行 Pilot(白字)
|
||||
================================================================
|
||||
设计参数与 SVG 严格一致: 黑底 512, 橙色圆角矩形 x38 y64 w436 h186 rx34,
|
||||
HDMI 146px Arial Bold 黑字(框内居中), Tool 146px 白字(基线 421)。
|
||||
设计参数: 黑底 512, 橙色圆角矩形 x38 y64 w436 h186 rx34,
|
||||
DLP 146px Arial Bold 黑字(框内居中), Pilot 146px Arial Bold 白字(基线 421)。
|
||||
|
||||
输出: logos/logo_ph_orange.png(512, 预览/复用)
|
||||
logos/logo_ph_orange.ico(16~256 七档, exe 图标用)
|
||||
输出: logos/logo_dlpilot.png(512, 预览/复用)
|
||||
logos/logo_dlpilot.ico(16~256 七档, exe 图标用)
|
||||
|
||||
用法: python make_ico.py
|
||||
"""
|
||||
@@ -30,17 +30,17 @@ def render(size=512):
|
||||
raise SystemExit(f'未找到字体 {FONT}, 无法栅格化')
|
||||
f = ImageFont.truetype(FONT, max(8, round(146 * s)))
|
||||
cx = size / 2
|
||||
# HDMI: 居中于橙色框
|
||||
d.text((cx, 64 * s + 186 * s / 2), 'HDMI', font=f, fill=(0, 0, 0), anchor='mm')
|
||||
# Tool: 与 SVG 基线 421 对齐(无下伸字母, 中心 = 421 - cap/2 ~= 368)
|
||||
d.text((cx, 368 * s), 'Tool', font=f, fill=(255, 255, 255), anchor='mm')
|
||||
# DLP: 居中于橙色框
|
||||
d.text((cx, 64 * s + 186 * s / 2), 'DLP', font=f, fill=(0, 0, 0), anchor='mm')
|
||||
# Pilot: 与原设计基线 421 对齐(无下伸字母, 中心 = 421 - cap/2 ~= 368)
|
||||
d.text((cx, 368 * s), 'Pilot', font=f, fill=(255, 255, 255), anchor='mm')
|
||||
return img
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
img = render(512)
|
||||
png = os.path.join(BASE, 'logo_ph_orange.png')
|
||||
ico = os.path.join(BASE, 'logo_ph_orange.ico')
|
||||
png = os.path.join(BASE, 'logo_dlpilot.png')
|
||||
ico = os.path.join(BASE, 'logo_dlpilot.ico')
|
||||
img.save(png)
|
||||
img.save(ico, sizes=[(16, 16), (24, 24), (32, 32), (48, 48),
|
||||
(64, 64), (128, 128), (256, 256)])
|
||||
|
||||
Reference in New Issue
Block a user