Files
admin d33f341192
Docker Build / Build and Push Docker Image (push) Successful in 35s
Docker Build / Deploy to Server (push) Successful in 3s
fix(shell): classic 的 tab 焦点/颜色、应用名进标题栏
用户截图报了四个问题,根因各不相同:

## 1. 「登录」的蓝色下划线永远不消失

classic / dark 皮肤里 tabLogin 下面那条下划线是**匿名 Control**(没有 name),
UpdateTabStyle 只认 lineLogin / lineRegister / lineCard / lineReset,
找不到 lineLogin 就永远保持 XML 里写的 TAB_ACT 色 → 那条线一直亮着。

修:生成脚本里给它 name="lineLogin"。

## 2. 切到「我的设备」后焦点还留在「登录」上

    void SwitchTab(int tab) {
        if (!strcmp(g_loginMode, "card") && tab == 1) { ShowManageDevices(); return; }

卡密模式下点「我的设备」直接进设备管理就 return 了,g_tab 没更新、
UpdateTabStyle 没调用 → 高亮留在上一页。

修:return 之前先把 g_tab 设成 1 并刷一次 tab 样式。

## 3. classic 的 tab 颜色不对

UpdateTabStyle 里没有 classic 分支,落到默认的 bgMode=true / 全 0 色,
tab 文字会被设成透明;下划线还写死成 dark 的 #4EA3E8,和 classic 的
#0E639C 不是一个色系。

修:加 classic 分支 + 引入 lineColor 变量,下划线颜色跟皮肤走
(classic #0E639C / dark #4EA3E8 / split #4CC2FF / terminal #7FE39B…);
非「下划线型」皮肤(light/card/industrial/compact 靠 tab 底色区分)一律清掉下划线。

## 4. 应用名应该在标题栏,不该在正文多一行

原来标题栏固定写「软件授权验证」,正文再用一行蓝色大字(lblApp)写应用名,
同一个信息说两遍还白占一行高度。

修:
- WM_CREATE 里把应用名写进 lblTitle,并隐藏 lblApp / lblBrand
- 窗口标题(任务栏/Alt-Tab)也用应用名
- ShowTabsAgain / ApplyAppInfo 同步改,别再把固定文案或正文那行放回去
- 设备管理页标题格式改成「应用名 · 设备管理」

## 顺带修掉一个会反复踩的坑

skins_v4.h 是脚本生成的,但脚本里标题 Label 没有 name="lblTitle" ——
原来那名字是手工补进 .h 的,一重新生成就丢了,代码 SetText 找不到控件,
标题栏永远显示 XML 里的固定文案。现在脚本里 8 套皮肤全部带 name="lblTitle";
另 4 套(split/industrial/terminal/compact)原本是装饰文案
(VFY / AUTHORIZATION / vfy@local:~$ auth / 账号中心),也统一挂上 lblTitle。

生成脚本也从 tmpfs 收进仓库:shell/duilib/scripts/gen_skins_v4.py,
输出路径改成跟着仓库走,不再写死 /root/.hermes/cache/scratch/...。

## 实测(wine + 像素取色,不看错觉)

- 标题栏文字读出「游戏盒子打包器」,正文无蓝色大字
- 下划线仅一条:y=86/87,x=20~103,颜色 #0E639C(深蓝,不是 #4EA3E8)
- 点「我的设备」后:下划线移到 x=104~187(第 2 个 tab),
  原「登录」那条消失 → 焦点正确跟随
2026-11-29 17:05:36 +08:00

494 lines
30 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
# 生成 7 套「登录 / 注册 / 卡密充值 / 忘记密码」四 tab 皮肤(老 DuiLib,纯 XML)
# 输出:/root/.hermes/cache/scratch/vfyshell/demo/skins_v4.h
import io
OUT = __file__.rsplit("/scripts/", 1)[0] + "/skins_v4.h"
# ------------------------- 面板片段 -------------------------
def p_login(L, IN_BG, IN_FG, IN_BORDER, REM, PRI, PRI_FG, BTN="登录"):
return f''' <VerticalLayout name="panelLogin" height="248">
<Label name="lblUser" text="账号或卡密" textcolor="{L}" height="18" />
<Edit name="editUser" height="40" bkcolor="{IN_BG}" nativebkcolor="{IN_BG}" textcolor="{IN_FG}" bordercolor="{IN_BORDER}" inset="10,0,0,0" />
<Control height="12" />
<Label name="lblPass" text="密码" textcolor="{L}" height="18" />
<Edit name="editPass" height="40" bkcolor="{IN_BG}" nativebkcolor="{IN_BG}" textcolor="{IN_FG}" bordercolor="{IN_BORDER}" inset="10,0,0,0" password="true" />
<Control height="12" />
<HorizontalLayout name="rowRemember" height="22">
<Button name="btnRemember" text="[ ] 记住账号" textcolor="{REM}" bkcolor="#00000000" width="104" height="22" />
</HorizontalLayout>
<Control height="14" />
<Button name="btnLogin" text="{BTN}" height="44" bkcolor="{PRI}" textcolor="{PRI_FG}" font="1" />
<Label name="lblTip" text="" textcolor="#FFE08A8A" height="22" margin="0,8,0,0" />
</VerticalLayout>
'''
def p_register(L, IN_BG, IN_FG, IN_BORDER, PRI, PRI_FG, ACC):
return f''' <VerticalLayout name="panelRegister" height="404" visible="false">
<Label text="用户名" textcolor="{L}" height="18" />
<Edit name="regUser" height="38" bkcolor="{IN_BG}" nativebkcolor="{IN_BG}" textcolor="{IN_FG}" bordercolor="{IN_BORDER}" inset="10,0,0,0" />
<Control height="10" />
<Label text="邮箱" textcolor="{L}" height="18" />
<HorizontalLayout height="38">
<Edit name="regEmail" bkcolor="{IN_BG}" nativebkcolor="{IN_BG}" textcolor="{IN_FG}" bordercolor="{IN_BORDER}" inset="10,0,0,0" />
<Control width="8" />
<Button name="btnSendCode" text="发送验证码" width="104" height="38" bkcolor="{ACC}" textcolor="#FFFFFFFF" />
</HorizontalLayout>
<Control height="10" />
<Label name="lblRegCode" text="邮箱验证码" textcolor="{L}" height="18" />
<Edit name="regCode" height="38" bkcolor="{IN_BG}" nativebkcolor="{IN_BG}" textcolor="{IN_FG}" bordercolor="{IN_BORDER}" inset="10,0,0,0" />
<Control height="10" />
<Label text="密码" textcolor="{L}" height="18" />
<Edit name="regPass" height="38" bkcolor="{IN_BG}" nativebkcolor="{IN_BG}" textcolor="{IN_FG}" bordercolor="{IN_BORDER}" inset="10,0,0,0" password="true" />
<Control height="10" />
<Label text="确认密码" textcolor="{L}" height="18" />
<Edit name="regPass2" height="38" bkcolor="{IN_BG}" nativebkcolor="{IN_BG}" textcolor="{IN_FG}" bordercolor="{IN_BORDER}" inset="10,0,0,0" password="true" />
<Control height="14" />
<Button name="btnRegister" text="注册并登录" height="44" bkcolor="{PRI}" textcolor="{PRI_FG}" font="1" />
<Label name="regTip" text="" textcolor="#FFE08A8A" height="22" margin="0,8,0,0" />
</VerticalLayout>
'''
def p_card(L, IN_BG, IN_FG, IN_BORDER, PRI, PRI_FG):
return f''' <VerticalLayout name="panelCard" height="250" visible="false">
<Label text="用户名" textcolor="{L}" height="18" />
<Edit name="cardUser" height="40" bkcolor="{IN_BG}" nativebkcolor="{IN_BG}" textcolor="{IN_FG}" bordercolor="{IN_BORDER}" inset="10,0,0,0" />
<Control height="12" />
<Label text="卡密" textcolor="{L}" height="18" />
<Edit name="cardKey" height="40" bkcolor="{IN_BG}" nativebkcolor="{IN_BG}" textcolor="{IN_FG}" bordercolor="{IN_BORDER}" inset="10,0,0,0" />
<Control height="10" />
<Label text="卡密充入该账号余额,充值后请用账号密码登录" textcolor="{L}" height="18" />
<Control height="14" />
<Button name="btnRecharge" text="立即充值" height="44" bkcolor="{PRI}" textcolor="{PRI_FG}" font="1" />
<Label name="cardTip" text="" textcolor="#FFE08A8A" height="22" margin="0,8,0,0" />
</VerticalLayout>
'''
def p_reset(L, IN_BG, IN_FG, IN_BORDER, PRI, PRI_FG, ACC):
return f''' <VerticalLayout name="panelReset" height="322" visible="false">
<Label name="lblResetCard" text="卡密" textcolor="{L}" height="18" visible="false" />
<Edit name="resetCardKey" height="40" bkcolor="{IN_BG}" nativebkcolor="{IN_BG}" textcolor="{IN_FG}" bordercolor="{IN_BORDER}" inset="10,0,0,0" visible="false" />
<Control name="spResetCard" height="12" visible="false" />
<Label text="邮箱" textcolor="{L}" height="18" />
<HorizontalLayout height="40">
<Edit name="resetEmail" bkcolor="{IN_BG}" nativebkcolor="{IN_BG}" textcolor="{IN_FG}" bordercolor="{IN_BORDER}" inset="10,0,0,0" />
<Control width="8" />
<Button name="btnSendCode2" text="发送验证码" width="104" height="40" bkcolor="{ACC}" textcolor="#FFFFFFFF" />
</HorizontalLayout>
<Control height="12" />
<Label text="邮箱验证码" textcolor="{L}" height="18" />
<Edit name="resetCode" height="40" bkcolor="{IN_BG}" nativebkcolor="{IN_BG}" textcolor="{IN_FG}" bordercolor="{IN_BORDER}" inset="10,0,0,0" />
<Control height="12" />
<Label text="新密码" textcolor="{L}" height="18" />
<Edit name="resetPass" height="40" bkcolor="{IN_BG}" nativebkcolor="{IN_BG}" textcolor="{IN_FG}" bordercolor="{IN_BORDER}" inset="10,0,0,0" password="true" />
<Control height="14" />
<Button name="btnReset" text="重置密码" height="44" bkcolor="{PRI}" textcolor="{PRI_FG}" font="1" />
<Label name="resetTip" text="" textcolor="#FFE08A8A" height="22" margin="0,8,0,0" />
</VerticalLayout>
'''
def p_overlays(L, IN_BG, IN_FG, IN_BD, PRI, PRI_FG, MUTED):
"""公告 / 更新 / 设备超限 三个覆盖面板:和四个 tab 面板同级,显示时先隐藏它们。"""
return f''' <VerticalLayout name="panelNotice" height="322" visible="false">
<Label text="公 告" textcolor="{PRI}" font="1" height="30" />
<Label name="noticeTitle" text="" textcolor="{IN_FG}" height="26" />
<Control height="6" />
<Label name="noticeBody" text="" textcolor="{L}" height="150" multiline="true" endellipsis="true" />
<HorizontalLayout height="34">
<Button name="btnNoticePrev" text="上一条" width="86" height="32" bkcolor="{IN_BG}" textcolor="{IN_FG}" />
<Control width="8" />
<Button name="btnNoticeNext" text="下一条" width="86" height="32" bkcolor="{IN_BG}" textcolor="{IN_FG}" />
<Control />
<Label name="noticeIdx" text="" textcolor="{MUTED}" width="54" />
</HorizontalLayout>
<Control height="12" />
<Button name="btnNoticeOk" text="我知道了" height="44" bkcolor="{PRI}" textcolor="{PRI_FG}" font="1" />
</VerticalLayout>
<VerticalLayout name="panelUpdate" height="300" visible="false">
<Label text="版本更新" textcolor="{PRI}" font="1" height="28" />
<Label name="updTitle" text="" textcolor="{IN_FG}" height="26" />
<Control height="6" />
<Label name="updNotes" text="" textcolor="{L}" height="130" multiline="true" endellipsis="true" />
<Label name="updTip" text="" textcolor="{MUTED}" height="24" />
<HorizontalLayout height="44">
<Button name="btnUpdLater" text="稍后提醒" width="112" height="44" bkcolor="{IN_BG}" textcolor="{IN_FG}" />
<Control width="10" />
<Button name="btnUpdate" text="立即更新" height="44" bkcolor="{PRI}" textcolor="{PRI_FG}" font="1" />
</HorizontalLayout>
</VerticalLayout>
<VerticalLayout name="panelDevice" height="386" visible="false">
<Label name="devHead" text="设备数量已满" textcolor="{PRI}" font="1" height="28" />
<Label name="devTitle" text="" textcolor="{IN_FG}" height="24" />
<Control height="6" />
<Label name="lblDevCard" text="卡密" textcolor="{L}" height="18" visible="false" />
<Edit name="devCardKey" height="36" bkcolor="{IN_BG}" nativebkcolor="{IN_BG}" textcolor="{IN_FG}" bordercolor="{IN_BD}" inset="10,0,0,0" visible="false" />
<Control name="spDevCard" height="6" visible="false" />
<Control height="6" />
<Label name="devBody" text="" textcolor="{L}" height="150" multiline="true" endellipsis="true" />
<Control height="6" />
<Label text="输入要解绑的设备序号" textcolor="{MUTED}" height="18" />
<Edit name="devIdx" height="36" bkcolor="{IN_BG}" nativebkcolor="{IN_BG}" textcolor="{IN_FG}" bordercolor="{IN_BD}" inset="10,0,0,0" />
<Label name="devTip" text="" textcolor="{MUTED}" height="22" />
<HorizontalLayout height="44">
<Button name="btnUnbind" text="解绑该设备" width="118" height="44" bkcolor="{PRI}" textcolor="{PRI_FG}" font="1" />
<Control width="8" />
<Button name="btnUnbindOld" text="解绑最早一台" width="118" height="44" bkcolor="{PRI}" textcolor="{PRI_FG}" />
<Control width="8" />
<Button name="btnRetryLogin" text="重试" width="72" height="44" bkcolor="{IN_BG}" textcolor="{IN_FG}" />
<Control width="8" />
<Button name="btnBack" text="返回" width="72" height="44" bkcolor="{IN_BG}" textcolor="{IN_FG}" />
</HorizontalLayout>
</VerticalLayout>
'''
def footer(L, LINK, dev_prefix="设备"):
return f''' <Label name="lblDevice" text="{dev_prefix}" textcolor="{L}" height="18" margin="0,6,0,0" />
'''
# ------------------------- 皮肤 1:dark(下划线 tab) -------------------------
def skin_dark():
T = dict(BG="#FF141418", TITLE_BG="#FF1D1D24", TITLE="#FFF0F0F4", CLOSE="#FF9A9AA6",
TAB_ACT="#FF4EA3E8", TAB_IDLE="#FF9A9AA6", L="#FFB4B4BE",
IN_BG="#FF2A2A33", IN_FG="#FFF4F4F8", IN_BD="#FF474755", REM="#FFB4B4BE",
PRI="#FF146FB8", PRI_FG="#FFFFFFFF", ACC="#FF2F6E4E", DEV="#FF5C5C68")
return f'''<?xml version="1.0" encoding="utf-8"?>
<Window size="470,436" caption="0,0,-1,44" mininfo="470,380" bkcolor="{T['BG']}">
<VerticalLayout bkcolor="{T['BG']}" bordercolor="#FF32323A" bordersize="1">
<HorizontalLayout height="44" bkcolor="{T['TITLE_BG']}">
<Label name="lblTitle" text="软件授权验证" textcolor="{T['TITLE']}" font="1" width="260" textpadding="20,0,0,0" />
<Control />
<Button name="btnClose" text="×" font="1" width="40" height="44" textcolor="{T['CLOSE']}" bkcolor="{T['TITLE_BG']}" hotbkcolor="#33FFFFFF" pushedbkcolor="#55FFFFFF" />
</HorizontalLayout>
<HorizontalLayout height="44" inset="20,0,20,0">
<VerticalLayout width="84">
<Button name="tabLogin" text="登录" height="42" bkcolor="#00000000" textcolor="{T['TAB_ACT']}" font="1" />
<Control name="lineLogin" height="2" bkcolor="{T['TAB_ACT']}" />
</VerticalLayout>
<VerticalLayout width="84">
<Button name="tabRegister" text="注册" height="42" bkcolor="#00000000" textcolor="{T['TAB_IDLE']}" />
<Control name="lineRegister" height="2" bkcolor="#00000000" />
</VerticalLayout>
<VerticalLayout width="84">
<Button name="tabCard" text="卡密充值" height="42" bkcolor="#00000000" textcolor="{T['TAB_IDLE']}" />
<Control name="lineCard" height="2" bkcolor="#00000000" />
</VerticalLayout>
<VerticalLayout width="84">
<Button name="tabReset" text="忘记密码" height="42" bkcolor="#00000000" textcolor="{T['TAB_IDLE']}" />
<Control name="lineReset" height="2" bkcolor="#00000000" />
</VerticalLayout>
<Control />
</HorizontalLayout>
<VerticalLayout inset="24,14,24,16">
<Label name="lblApp" text="演示程序" textcolor="{T['TAB_ACT']}" height="30" font="2" />
<Control height="8" />
{p_login(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['REM'], T['PRI'], T['PRI_FG'])}
{p_register(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['ACC'])}
{p_card(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'])}
{p_reset(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['ACC'])}
{p_overlays(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['DEV'])}
{footer(T['DEV'], T['TAB_ACT'])}
</VerticalLayout>
</VerticalLayout>
</Window>'''
# ------------------------- 皮肤 2:light(分段按钮 tab) -------------------------
def skin_classic():
# classic:照搬原 Direct2D 壳的 VS Code 暗色(#1E1E1E 卡片 / #0E639C 主色)
T = dict(BG="#FF1E1E1E", TITLE_BG="#FF252527", TITLE="#FFE6E6E6", CLOSE="#FF9D9D9D",
TAB_ACT="#FF0E639C", TAB_IDLE="#FF9D9D9D", L="#FFB4B4BE",
IN_BG="#FF252526", IN_FG="#FFE6E6E6", IN_BD="#FF3F3F46", REM="#FFB4B4BE",
PRI="#FF0E639C", PRI_FG="#FFFFFFFF", ACC="#FF0F7B4F", DEV="#FF9D9D9D")
return f'''<?xml version="1.0" encoding="utf-8"?>
<Window size="470,436" caption="0,0,-1,44" mininfo="470,380" bkcolor="{T['BG']}">
<VerticalLayout bkcolor="{T['BG']}" bordercolor="#FF32323A" bordersize="1">
<HorizontalLayout height="44" bkcolor="{T['TITLE_BG']}">
<Label name="lblTitle" text="软件授权验证" textcolor="{T['TITLE']}" font="1" width="260" textpadding="20,0,0,0" />
<Control />
<Button name="btnClose" text="×" font="1" width="40" height="44" textcolor="{T['CLOSE']}" bkcolor="{T['TITLE_BG']}" hotbkcolor="#33FFFFFF" pushedbkcolor="#55FFFFFF" />
</HorizontalLayout>
<HorizontalLayout height="44" inset="20,0,20,0">
<VerticalLayout width="84">
<Button name="tabLogin" text="登录" height="42" bkcolor="#00000000" textcolor="{T['TAB_ACT']}" font="1" />
<Control name="lineLogin" height="2" bkcolor="{T['TAB_ACT']}" />
</VerticalLayout>
<VerticalLayout width="84">
<Button name="tabRegister" text="注册" height="42" bkcolor="#00000000" textcolor="{T['TAB_IDLE']}" />
<Control name="lineRegister" height="2" bkcolor="#00000000" />
</VerticalLayout>
<VerticalLayout width="84">
<Button name="tabCard" text="卡密充值" height="42" bkcolor="#00000000" textcolor="{T['TAB_IDLE']}" />
<Control name="lineCard" height="2" bkcolor="#00000000" />
</VerticalLayout>
<VerticalLayout width="84">
<Button name="tabReset" text="忘记密码" height="42" bkcolor="#00000000" textcolor="{T['TAB_IDLE']}" />
<Control name="lineReset" height="2" bkcolor="#00000000" />
</VerticalLayout>
<Control />
</HorizontalLayout>
<VerticalLayout inset="24,14,24,16">
<Label name="lblApp" text="演示程序" textcolor="{T['TAB_ACT']}" height="30" font="2" />
<Control height="8" />
{p_login(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['REM'], T['PRI'], T['PRI_FG'])}
{p_register(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['ACC'])}
{p_card(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'])}
{p_reset(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['ACC'])}
{p_overlays(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['DEV'])}
{footer(T['DEV'], T['TAB_ACT'])}
</VerticalLayout>
</VerticalLayout>
</Window>'''
# ------------------------- 皮肤 2:light(分段按钮 tab) -------------------------
def skin_light():
T = dict(BG="#FFFAFAFC", TITLE="#FF1F1F24", CLOSE="#FF6B6B75", L="#FF4B5563",
IN_BG="#FFF1F3F7", IN_FG="#FF1F2430", IN_BD="#FFC3CBD8", REM="#FF4B5563",
PRI="#FF1B6FD6", PRI_FG="#FFFFFFFF", ACC="#FF128A5B", SEG_ACT="#FF1B6FD6",
SEG_IDLE="#FFEBEFF6", SEG_ACT_FG="#FFFFFFFF", SEG_IDLE_FG="#FF5B6270", DEV="#FF8A8F99")
return f'''<?xml version="1.0" encoding="utf-8"?>
<Window size="470,436" caption="0,0,-1,44" mininfo="470,380" bkcolor="{T['BG']}">
<VerticalLayout bkcolor="{T['BG']}" bordercolor="#FFDCDCE3" bordersize="1">
<HorizontalLayout height="44" bkcolor="#FFFFFFFF">
<Label name="lblTitle" text="软件授权验证" textcolor="{T['TITLE']}" font="1" width="260" textpadding="20,0,0,0" />
<Control />
<Button name="btnClose" text="×" font="1" width="40" height="44" textcolor="{T['CLOSE']}" bkcolor="#FFFFFFFF" hotbkcolor="#14000000" pushedbkcolor="#22000000" />
</HorizontalLayout>
<HorizontalLayout height="12" />
<HorizontalLayout height="38" inset="24,0,24,0">
<Button name="tabLogin" text="登录" height="38" bkcolor="{T['SEG_ACT']}" textcolor="{T['SEG_ACT_FG']}" font="1" />
<Control width="6" />
<Button name="tabRegister" text="注册" height="38" bkcolor="{T['SEG_IDLE']}" textcolor="{T['SEG_IDLE_FG']}" />
<Control width="6" />
<Button name="tabCard" text="卡密充值" height="38" bkcolor="{T['SEG_IDLE']}" textcolor="{T['SEG_IDLE_FG']}" />
<Control width="6" />
<Button name="tabReset" text="忘记密码" height="38" bkcolor="{T['SEG_IDLE']}" textcolor="{T['SEG_IDLE_FG']}" />
</HorizontalLayout>
<VerticalLayout inset="24,16,24,16">
<Label name="lblApp" text="演示程序" textcolor="{T['PRI']}" height="30" font="2" />
<Control height="8" />
{p_login(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['REM'], T['PRI'], T['PRI_FG'])}
{p_register(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['ACC'])}
{p_card(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'])}
{p_reset(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['ACC'])}
{p_overlays(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['DEV'])}
{footer(T['DEV'], T['PRI'])}
</VerticalLayout>
</VerticalLayout>
</Window>'''
# ------------------------- 皮肤 3:split(左品牌栏 + 右侧文字 tab) -------------------------
def skin_split():
T = dict(BG="#FF12151A", SIDE="#FF1A2230", ACT="#FF4CC2FF", IDLE="#FF97A5B4", L="#FF8794A3",
IN_BG="#FF1A1F27", IN_FG="#FFF2F6FA", IN_BD="#FF2E343D", PRI="#FF2C7BE5",
PRI_FG="#FFFFFFFF", ACC="#FF2B6A50", DEV="#FF7E8B99")
return f'''<?xml version="1.0" encoding="utf-8"?>
<Window size="680,452" caption="0,0,0,0" mininfo="680,400" bkcolor="{T['BG']}">
<HorizontalLayout bkcolor="{T['BG']}" bordercolor="#FF282D35" bordersize="1">
<VerticalLayout width="196" bkcolor="{T['SIDE']}">
<HorizontalLayout height="44" inset="24,0,0,0">
<Label text="VFY" textcolor="{T['ACT']}" font="1" width="120" />
<Control />
</HorizontalLayout>
<VerticalLayout inset="24,4,24,0">
<Label name="lblTitle" text="软件授权验证" textcolor="#FFC8D3E0" height="28" font="1" />
<Label text="SOFTWARE LICENSE" textcolor="#FF63707E" height="20" />
<Label text="登录后绑定本机设备" textcolor="#FF4C5A68" height="20" margin="0,14,0,0" />
</VerticalLayout>
<VerticalLayout />
<HorizontalLayout height="28" inset="24,0,24,16">
<Label text="v9 · DuiLib" textcolor="#FF4A5764" />
</HorizontalLayout>
</VerticalLayout>
<VerticalLayout>
<HorizontalLayout height="44" inset="24,0,16,0">
<Button name="tabLogin" text="登录" width="72" height="44" bkcolor="#00000000" textcolor="{T['ACT']}" font="1" />
<Button name="tabRegister" text="注册" width="72" height="44" bkcolor="#00000000" textcolor="{T['IDLE']}" />
<Button name="tabCard" text="卡密充值" width="92" height="44" bkcolor="#00000000" textcolor="{T['IDLE']}" />
<Button name="tabReset" text="忘记密码" width="92" height="44" bkcolor="#00000000" textcolor="{T['IDLE']}" />
<Button name="btnClose" text="×" font="1" width="40" height="44" textcolor="#FF8E9BAA" bkcolor="{T['BG']}" hotbkcolor="#22FFFFFF" />
</HorizontalLayout>
<VerticalLayout inset="24,4,24,14">
<Label name="lblApp" text="演示程序" textcolor="#FFF6FAFF" height="30" font="2" />
<Control height="8" />
{p_login(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['L'], T['PRI'], T['PRI_FG'])}
{p_register(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['ACC'])}
{p_card(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'])}
{p_reset(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['ACC'])}
{p_overlays(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['DEV'])}
{footer(T['DEV'], T['ACT'])}
</VerticalLayout>
</VerticalLayout>
</HorizontalLayout>
</Window>'''
# ------------------------- 皮肤 4:card(顶部色条 + 卡片内段按钮) -------------------------
def skin_card():
T = dict(BG="#FFF5F6F9", BAR="#FF3B2BD6", L="#FF4B5563", IN_BG="#FFFFFFFF", IN_FG="#FF1F2430",
IN_BD="#FFC9D1DC", PRI="#FF3B2BD6", PRI_FG="#FFFFFFFF", ACC="#FF128A5B",
SEG_IDLE="#FFE8E6FF", SEG_IDLE_FG="#FF5B56A8", DEV="#FF8A8F99")
return f'''<?xml version="1.0" encoding="utf-8"?>
<Window size="720,460" caption="0,0,-1,88" mininfo="720,400" bkcolor="{T['BG']}">
<VerticalLayout bkcolor="{T['BG']}" bordercolor="#FFD7DBE3" bordersize="1">
<HorizontalLayout height="88" bkcolor="{T['BAR']}">
<VerticalLayout inset="28,16,0,0">
<Label name="lblTitle" text="软件授权验证" textcolor="#FFFFFFFF" font="1" height="32" />
<Label name="lblApp" text="演示程序" textcolor="#FFD9D4FF" height="22" />
</VerticalLayout>
<Control />
<Button name="btnClose" text="×" font="1" width="46" height="88" textcolor="#FFEDEBFF" bkcolor="{T['BAR']}" hotbkcolor="#22000000" />
</HorizontalLayout>
<HorizontalLayout height="50" inset="28,12,28,0">
<Button name="tabLogin" text="登录" height="36" bkcolor="#FFFFFFFF" textcolor="{T['PRI']}" font="1" />
<Control width="8" />
<Button name="tabRegister" text="注册" height="36" bkcolor="{T['SEG_IDLE']}" textcolor="{T['SEG_IDLE_FG']}" />
<Control width="8" />
<Button name="tabCard" text="卡密充值" height="36" bkcolor="{T['SEG_IDLE']}" textcolor="{T['SEG_IDLE_FG']}" />
<Control width="8" />
<Button name="tabReset" text="忘记密码" height="36" bkcolor="{T['SEG_IDLE']}" textcolor="{T['SEG_IDLE_FG']}" />
</HorizontalLayout>
<HorizontalLayout inset="28,14,28,16">
<VerticalLayout width="248">
<Label text="账号安全" textcolor="#FF1F2430" height="24" font="1" />
<Label text="登录后账号与本机设备绑定," textcolor="{T['L']}" height="20" />
<Label text="超出设备上限时请先下线一台。" textcolor="{T['L']}" height="20" />
<Control height="12" />
{footer(T['DEV'], T['PRI'])}
</VerticalLayout>
<Control width="24" />
<Control width="1" bkcolor="#FFE3E6EC" />
<Control width="24" />
<VerticalLayout>
{p_login(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['L'], T['PRI'], T['PRI_FG'])}
{p_register(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['ACC'])}
{p_card(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'])}
{p_reset(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['ACC'])}
{p_overlays(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['DEV'])}
</VerticalLayout>
</HorizontalLayout>
</VerticalLayout>
</Window>'''
# ------------------------- 皮肤 5:industrial(标题栏内 tab) -------------------------
def skin_industrial():
T = dict(BG="#FF0A1520", BAR="#FF10304C", ACT="#FF1A5A8C", L="#FF9FC0D8",
IN_BG="#FF14304A", IN_FG="#FFEAF6FF", IN_BD="#FF23567F", PRI="#FF1F6FB2",
PRI_FG="#FFFFFFFF", ACC="#FF1B4A3C", DEV="#FF5F89A6")
return f'''<?xml version="1.0" encoding="utf-8"?>
<Window size="600,452" caption="0,0,-1,46" mininfo="600,400" bkcolor="{T['BG']}">
<VerticalLayout bkcolor="{T['BG']}" bordercolor="#FF1F4E79" bordersize="1">
<HorizontalLayout height="46" bkcolor="{T['BAR']}">
<Label name="lblTitle" text="软件授权验证" textcolor="#FF7FD1FF" font="1" width="200" textpadding="18,0,0,0" />
<Control />
<Button name="tabLogin" text="LOGIN" width="76" height="46" bkcolor="{T['ACT']}" textcolor="#FFFFFFFF" />
<Button name="tabRegister" text="SIGN UP" width="84" height="46" bkcolor="#00000000" textcolor="#FF9FC8E6" />
<Button name="tabCard" text="CARD" width="66" height="46" bkcolor="#00000000" textcolor="#FF9FC8E6" />
<Button name="tabReset" text="RESET" width="70" height="46" bkcolor="#00000000" textcolor="#FF9FC8E6" />
<Button name="btnClose" text="×" font="1" width="44" height="46" textcolor="#FFBEE3FF" bkcolor="{T['BAR']}" hotbkcolor="#33FFFFFF" />
</HorizontalLayout>
<VerticalLayout inset="24,14,24,14">
<Label name="lblApp" text="演示程序" textcolor="#FFA8D4F0" height="30" font="2" />
<Control height="8" />
{p_login(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['L'], T['PRI'], T['PRI_FG'])}
{p_register(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['ACC'])}
{p_card(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'])}
{p_reset(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['ACC'])}
{p_overlays(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['DEV'])}
{footer(T['DEV'], T['PRI'])}
</VerticalLayout>
</VerticalLayout>
</Window>'''
# ------------------------- 皮肤 6:terminal(命令式 tab) -------------------------
def skin_terminal():
T = dict(BG="#FF0B0F0C", BAR="#FF101710", ACT="#FF7FE39B", L="#FF7FAE90",
IN_BG="#FF16211A", IN_FG="#FFD7F5DF", IN_BD="#FF2B3A2D", PRI="#FF1B7A4E",
PRI_FG="#FFFFFFFF", ACC="#FF234A33", DEV="#FF6F9E80")
return f'''<?xml version="1.0" encoding="utf-8"?>
<Window size="620,446" caption="0,0,-1,38" mininfo="620,400" bkcolor="{T['BG']}">
<VerticalLayout bkcolor="{T['BG']}" bordercolor="{T['IN_BD']}" bordersize="1">
<HorizontalLayout height="38" bkcolor="{T['BAR']}" inset="0,0,8,0">
<Label name="lblTitle" text="软件授权验证" textcolor="{T['ACT']}" width="220" textpadding="14,0,0,0" />
<Control />
<Button name="btnClose" text="×" font="1" width="38" height="38" textcolor="#FF7FB08C" bkcolor="{T['BAR']}" hotbkcolor="#22FFFFFF" />
</HorizontalLayout>
<HorizontalLayout height="34" bkcolor="#FF0E150F" inset="8,0,8,0">
<Button name="tabLogin" text="login" width="76" height="34" bkcolor="#00000000" textcolor="{T['ACT']}" font="1" />
<Button name="tabRegister" text="register" width="92" height="34" bkcolor="#00000000" textcolor="{T['L']}" />
<Button name="tabCard" text="card" width="66" height="34" bkcolor="#00000000" textcolor="{T['L']}" />
<Button name="tabReset" text="reset" width="70" height="34" bkcolor="#00000000" textcolor="{T['L']}" />
<Control />
</HorizontalLayout>
<VerticalLayout inset="16,10,16,12">
<Label name="lblApp" text="# 演示程序" textcolor="{T['ACT']}" height="28" font="2" />
<Control height="6" />
{p_login(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['L'], T['PRI'], T['PRI_FG'], "[ 执行登录 ]")}
{p_register(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['ACC'])}
{p_card(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'])}
{p_reset(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['ACC'])}
{p_overlays(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['DEV'])}
{footer(T['DEV'], T['ACT'])}
</VerticalLayout>
</VerticalLayout>
</Window>'''
# ------------------------- 皮肤 7:compact(左列竖排 tab) -------------------------
def skin_compact():
T = dict(BG="#FF11151A", BAR="#FF161C22", ACT="#FF2E9E6B", L="#FF95A7B8",
IN_BG="#FF1B232B", IN_FG="#FFFFFFFF", IN_BD="#FF32404E", PRI="#FF2E9E6B",
PRI_FG="#FFFFFFFF", ACC="#FF234A33", SEL="#FF1C6142", DEV="#FF8698A8")
return f'''<?xml version="1.0" encoding="utf-8"?>
<Window size="760,392" caption="0,0,-1,38" mininfo="760,300" bkcolor="{T['BG']}">
<VerticalLayout bkcolor="{T['BG']}" bordercolor="#FF2A3440" bordersize="1">
<HorizontalLayout height="38" bkcolor="{T['BAR']}">
<Label name="lblTitle" text="软件授权验证" textcolor="#FFA8BCCE" width="160" textpadding="16,0,0,0" />
<Control />
<Button name="btnClose" text="×" font="1" width="38" height="38" textcolor="#FFA8BCCE" bkcolor="{T['BAR']}" hotbkcolor="#22FFFFFF" />
</HorizontalLayout>
<HorizontalLayout inset="16,12,16,12">
<VerticalLayout width="176">
<Label name="lblApp" text="演示程序" textcolor="#FFF2F8FF" height="28" font="2" />
<Control height="10" />
<Button name="tabLogin" text="登录" width="100" height="32" bkcolor="{T['SEL']}" textcolor="#FFFFFFFF" />
<Control height="6" />
<Button name="tabRegister" text="注册" width="100" height="32" bkcolor="{T['BAR']}" textcolor="#FF9FB3C8" />
<Control height="6" />
<Button name="tabCard" text="卡密充值" width="100" height="32" bkcolor="{T['BAR']}" textcolor="#FF9FB3C8" />
<Control height="6" />
<Button name="tabReset" text="忘记密码" width="100" height="32" bkcolor="{T['BAR']}" textcolor="#FF9FB3C8" />
<VerticalLayout />
{footer(T['DEV'], T['ACT'])}
</VerticalLayout>
<Control width="14" />
<Control width="1" bkcolor="#FF2A3440" />
<Control width="14" />
<VerticalLayout>
{p_login(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['L'], T['PRI'], T['PRI_FG'])}
{p_register(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['ACC'])}
{p_card(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'])}
{p_reset(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['ACC'])}
{p_overlays(T['L'], T['IN_BG'], T['IN_FG'], T['IN_BD'], T['PRI'], T['PRI_FG'], T['DEV'])}
</VerticalLayout>
</HorizontalLayout>
</VerticalLayout>
</Window>'''
SKINS = [("classic", skin_classic(), 470, 436),
("dark", skin_dark(), 470, 436), ("light", skin_light(), 470, 436),
("split", skin_split(), 680, 452), ("card", skin_card(), 720, 460),
("industrial", skin_industrial(), 600, 452), ("terminal", skin_terminal(), 620, 446),
("compact", skin_compact(), 760, 392)]
with io.open(OUT, "w", encoding="utf-8") as f:
f.write("// 由 gen_skins_v4.py 生成,不要手改\n#pragma once\n\n")
for name, xml, w, h in SKINS:
f.write(f'static const char *kSkin_{name} = R"SKIN({xml})SKIN";\n\n')
f.write('struct SkinDef { const char *name; const char *xml; int w, h; };\n')
f.write('static const SkinDef kSkins[] = {\n')
for name, xml, w, h in SKINS:
f.write(f' {{ "{name}", kSkin_{name}, {w}, {h} }},\n')
f.write(' { NULL, NULL, 0, 0 }\n};\n')
print("skins_v4.h 已生成(4 tab × 7 皮肤)")
for name, xml, w, h in SKINS:
print(f" {name:11s} {w}x{h} {len(xml)} 字节")