fix: v0.4.1 修复主题切换丢 swatch 底色与连接失败长错误串撑爆布局;新增 selftest_theme;重打包
This commit is contained in:
@@ -52,7 +52,8 @@ from PySide6.QtWidgets import (
|
||||
)
|
||||
from qfluentwidgets import (
|
||||
BodyLabel, CardWidget, ComboBox, LineEdit, PlainTextEdit,
|
||||
PrimaryPushButton, PushButton, Slider, StrongBodyLabel, Theme, setTheme,
|
||||
PrimaryPushButton, PushButton, Slider, StrongBodyLabel, Theme,
|
||||
setCustomStyleSheet, setTheme,
|
||||
)
|
||||
|
||||
import config
|
||||
@@ -62,7 +63,7 @@ import edid_parse
|
||||
import patterns
|
||||
|
||||
APP_NAME = "DLPilot"
|
||||
APP_VERSION = "0.4.0"
|
||||
APP_VERSION = "0.4.1"
|
||||
REPO_URL = "https://gitea.hulk.wang/hulk/HW-Debug-Tools"
|
||||
MONO = QFont("Consolas", 10)
|
||||
CHIP_IDLE = "#666666"
|
||||
@@ -266,7 +267,12 @@ class App(QMainWindow):
|
||||
outer.setSpacing(12)
|
||||
header = QHBoxLayout()
|
||||
title = StrongBodyLabel("DLPilot", root)
|
||||
title.setStyleSheet("font-size: 24px; font-weight: 700;")
|
||||
# 标题字号走 QFont:FluentLabelBase 在每次主题切换时会用自带的颜色规则
|
||||
# 重写自定义 qss 槽,setStyleSheet/setCustomStyleSheet 写的字号都会被冲掉
|
||||
title_font = title.font()
|
||||
title_font.setPixelSize(24)
|
||||
title_font.setBold(True)
|
||||
title.setFont(title_font)
|
||||
header.addWidget(title)
|
||||
header.addWidget(BodyLabel("EDID · 测试图案 · RS485 光机控制", root))
|
||||
header.addStretch(1)
|
||||
@@ -355,7 +361,13 @@ class App(QMainWindow):
|
||||
row.addWidget(BodyLabel(f"{channel}: 0x", card))
|
||||
for label, color in items:
|
||||
button = PushButton(label, card)
|
||||
button.setStyleSheet(f"PushButton {{ background: {color}; color: {'black' if color == '#00FF00' else 'white'}; }}")
|
||||
# fluent 控件的样式须走 setCustomStyleSheet:直接 setStyleSheet 的内容
|
||||
# 会在 setTheme 时被库重刷的自带 qss 冲掉;且须覆盖 hover/pressed 态,
|
||||
# 否则悬停瞬间底色仍会被自带态样式盖回
|
||||
fg = 'black' if color == '#00FF00' else 'white'
|
||||
qss = ("PushButton, PushButton:hover, PushButton:pressed, "
|
||||
f"PushButton:disabled {{ background-color: {color}; color: {fg}; border: none; }}")
|
||||
setCustomStyleSheet(button, qss, qss)
|
||||
button.clicked.connect(lambda checked=False, c=color: self._show_solid(c))
|
||||
row.addWidget(button)
|
||||
row.addStretch(1)
|
||||
@@ -414,6 +426,9 @@ class App(QMainWindow):
|
||||
setattr(self, attr, combo)
|
||||
params.addWidget(combo)
|
||||
self.lbl_dlpc_st = BodyLabel("未连接", card)
|
||||
# 状态标签允许换行兜底: 任何长错误串都不得撑大参数行最小宽度(否则窗口拉长,
|
||||
# 刷新/连接按钮被挤出可视区)
|
||||
self.lbl_dlpc_st.setWordWrap(True)
|
||||
params.addWidget(self.lbl_dlpc_st)
|
||||
params.addStretch(1)
|
||||
body.addLayout(params)
|
||||
@@ -770,6 +785,7 @@ class App(QMainWindow):
|
||||
def _dlpc_toggle(self):
|
||||
if self.dlpc.is_connected(): self.dlpc.close(); self._serial_reset_state(); return
|
||||
port = self._dlpc_selected_port()
|
||||
if not port: self.lbl_dlpc_st.setText('未选择串口,请先选择或刷新'); return
|
||||
try: baud, bytesize, stopbits = int(self.cbo_baud.currentText()), int(self.cbo_databits.currentText()), int(self.cbo_stopbits.currentText())
|
||||
except ValueError: self.lbl_dlpc_st.setText("串口参数非法"); return
|
||||
parity = self.cbo_parity.currentText()[:1] or 'N'; config.SERIAL_CFG.update(port=port, baud=baud, bytesize=bytesize, parity=parity, stopbits=stopbits); config.save_slots(self.slots, self.cbo_area.currentText()); self.dlpc.open(port, baud, bytesize=bytesize, parity=parity, stopbits=stopbits)
|
||||
|
||||
Reference in New Issue
Block a user