fix: v0.4.1 修复主题切换丢 swatch 底色与连接失败长错误串撑爆布局;新增 selftest_theme;重打包

This commit is contained in:
2026-09-28 15:20:11 +08:00
parent 5bf7f02609
commit 62b325cd9d
5 changed files with 156 additions and 15 deletions
+13 -5
View File
@@ -326,11 +326,19 @@ class DLPC485:
self.ser = None
with self._lock:
self._target = None
et = str(e)
if 'PermissionError' in repr(e) or '拒绝访问' in et \
or 'Access is denied' in et:
et += '(串口被占用: 检查串口助手/另一个本工具实例)'
self.on_status(f'连接失败: {et}')
blob = str(e) + repr(e)
if 'PermissionError' in blob or '拒绝访问' in blob \
or 'Access is denied' in blob:
hint = '串口被占用(串口助手/另一实例?)'
elif 'FileNotFoundError' in blob or '找不到指定的' in blob \
or 'No such file' in blob:
hint = '串口不存在,请刷新后重选'
else:
hint = '无法打开,详情见日志'
# 状态标签只放短提示(长异常串会撑爆参数行把窗口拉长),
# 完整异常走 on_event 进收发日志
self.on_status(f'连接失败: {hint}')
self.on_event(f'连接失败: {e!r}')
if self.ser is not None:
try:
item = None