diff --git a/docs/reviews/2026-10-30-ui/browser-verification.json b/docs/reviews/2026-10-30-ui/browser-verification.json new file mode 100644 index 0000000..9a27335 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/browser-verification.json @@ -0,0 +1,73 @@ +{ + "browser": "156.0.8078.73", + "checks": [ + { + "test": "browser-layout-ready", + "ok": true, + "width": 1440, + "height": 900 + }, + { + "test": "browser-layout-running", + "ok": true, + "width": 1440, + "height": 900 + }, + { + "test": "browser-layout-recovery", + "ok": true, + "width": 1440, + "height": 900 + }, + { + "test": "browser-layout-assistant", + "ok": true, + "width": 1440, + "height": 900 + }, + { + "test": "browser-review-visible", + "ok": true + }, + { + "test": "escape-cancels-without-execution", + "ok": true + }, + { + "test": "browser-batch-guard", + "ok": true + }, + { + "test": "browser-confirm-starts-preparation", + "ok": true + }, + { + "test": "browser-pause-keeps-running", + "ok": true + }, + { + "test": "browser-verification-before-pause", + "ok": true + }, + { + "test": "browser-pause-after-verification", + "ok": true + }, + { + "test": "browser-solid-material-fallback", + "ok": true + }, + { + "test": "browser-compact-layout", + "ok": true, + "width": 980, + "height": 700 + }, + { + "test": "browser-compact-review", + "ok": true + } + ], + "pageErrors": [], + "screenshots": "Chrome headless, screenshot waits for compositor; 1440x900 and 980x700." +} diff --git a/docs/reviews/2026-10-30-ui/current-plan.png b/docs/reviews/2026-10-30-ui/current-plan.png new file mode 100644 index 0000000..4943015 Binary files /dev/null and b/docs/reviews/2026-10-30-ui/current-plan.png differ diff --git a/docs/reviews/2026-10-30-ui/current-rules.png b/docs/reviews/2026-10-30-ui/current-rules.png new file mode 100644 index 0000000..61aa1ea Binary files /dev/null and b/docs/reviews/2026-10-30-ui/current-rules.png differ diff --git a/docs/reviews/2026-10-30-ui/detail-polish.md b/docs/reviews/2026-10-30-ui/detail-polish.md new file mode 100644 index 0000000..b677aea --- /dev/null +++ b/docs/reviews/2026-10-30-ui/detail-polish.md @@ -0,0 +1,39 @@ +# 细节打磨:文字、交互和表格 + +用户要求三方面一起打磨,保留已认可的布局与原生磨砂。 + +## 文字、间距与状态 + +- 工程标题过长时省略显示,完整名称保留在提示中;不会把小窗口撑宽。 +- 工程状态保持单行并右对齐,避免“待配置”等短词中途折行;长状态有完整提示。 +- 按钮图标统一 16px;输入框、按钮、菜单和表格补充焦点、按下、选中与禁用反馈。 +- 表头与单元格提示说明只读字段、完整内容、UID 和工程身份。 + +## 搜索与批量编辑 + +- 搜索显示“匹配 X / 总数”,无匹配时显示清楚的空状态;清空后恢复全部行。 +- 没有查询或结果时,下一条操作不再可用;表格空状态不截获鼠标事件。 +- 批量填写显示选中行数,未选行或未填新料号时禁用。行选中用于编辑,替换勾选用于计划,两者在提示中区分。 + +## 保存与键盘 + +- 计划旁显示已保存 / 未保存;没有修改时禁用重复保存。本批 BOM 预览仍保留本批保存范围。 +- 支持 `Ctrl+F` 定位搜索、`F3` 下一条、`Ctrl+S` 保存。快捷键受当前编辑状态和原有权限门禁约束。 +- 实际验证并修正了单元格未提交时的保存问题:快捷键先提交当前编辑器,再获取保存快照;鼠标保存也能读取当前输入值。 +- 编辑中的临时输入参与未保存检测与执行门禁,但不提前改变模型;`Esc` 或放弃操作关闭编辑器并保留原值。 + +## 验证 + +相关 UI、状态与 BOM 回归 **131 项通过**;最终文字尺寸/对齐调整后,材质、布局与细节的针对性检查 **24 项通过**。新增细节用例覆盖真实单元格编辑、鼠标保存、键盘保存、取消、放弃、只读状态、匹配反馈、批量填写和长标题。 + +独立静态审查确认先前的 Ctrl+S 问题已修正,未发现新的重要编辑器生命周期或保存门禁问题。 + +原生验收继续使用临时示例数据与独立活动背板,没有启动 CAD。左右磨砂随背板变化,表格保持不透明;小窗口与实色回退通过。详见 [polish-acceptance.json](polish-acceptance.json)。 + +![搜索反馈](polish-search.png) + +![无匹配状态](polish-empty.png) + +![小窗口](polish-compact.png) + +源代码已更新,便携 EXE 未重新构建;本机原生验收环境仍为 Windows 11 build 26200、125% 缩放。 diff --git a/docs/reviews/2026-10-30-ui/github-material-research.md b/docs/reviews/2026-10-30-ui/github-material-research.md new file mode 100644 index 0000000..58732ef --- /dev/null +++ b/docs/reviews/2026-10-30-ui/github-material-research.md @@ -0,0 +1,68 @@ +# R5:GitHub 毛玻璃实现调研与原生实测 + +日期:2026-10-30。分支:`codex/ui-update`。 + +结论:当前 PySide6 工具应优先验证 **Windows 原生 Acrylic**,将真实窗口背后的内容交给系统合成器模糊。需要 Apple 式边缘折射时,另用 SVG/着色器处理应用内的浮层,不能把半透明白色、模糊、Mica 和折射统称为同一种效果。 + +此前 R4 页面确实使用了浏览器背景模糊,但背景接近纯色、叠加白色过厚,缺少可观察的透射细节;它也没有启用正式 Qt 窗口的系统背景模糊。不能用那张图证明原生毛玻璃已经完成。 + +## 实际参考的 8 个项目 + +通过 GitHub 仓库 API 读取 README、仓库树和关键源码。搜索 API 遇到速率限制,raw 域名连接失败后,改用仓库内容/Blob API,成功读取了下列材料。本文没有把检索失败的项目计入参考数量。 + +| 项目 | 已核对的实现 / 文档 | 可借鉴内容 | 与本项目的关系 | +| --- | --- | --- | --- | +| [PyQt-Frameless-Window](https://github.com/zhiyiYo/PyQt-Frameless-Window) | [`setAcrylicEffect`](https://github.com/zhiyiYo/PyQt-Frameless-Window/blob/master/qframelesswindow/windows/window_effect.py#L53) 调用 `SetWindowCompositionAttribute`,AccentState 使用 Acrylic。README 提供 PySide6 分支。 | 真正的窗口背景模糊;窗口边框、命中与拖动处理。 | 最接近现有 Python / Qt 栈。GPLv3;本轮没有复制该库代码或引入依赖。 | +| [PythonBlurBehind](https://github.com/Peticali/PythonBlurBehind) | [`blur()`](https://github.com/Peticali/PythonBlurBehind/blob/main/blurWindow/blurWindow.py#L115) 明确区分 BlurBehind 与 Acrylic,并对 HWND 应用效果。 | 小范围 ctypes 与系统合成边界,适合先做原生验证。 | MIT。原生小样采用同类 Windows API 机制,以独立探针验证,不调用 CAD。 | +| [WinUI Gallery](https://github.com/microsoft/WinUI-Gallery) | [`AcrylicPage.xaml`](https://github.com/microsoft/WinUI-Gallery/blob/main/WinUIGallery/Samples/Acrylic/AcrylicPage.xaml#L41) 区分应用内 Acrylic 与系统背景;[`DesktopAcrylicController`](https://github.com/microsoft/WinUI-Gallery/blob/main/WinUIGallery/Samples/SystemBackdrops/SystemBackdropsDesktopacryliccontroller.txt) 检查支持并管理资源生命周期。 | 染色、亮度、回退、应用内 / 窗口背后的不同采样来源。 | MIT。用于材质规范参考,不需要把 Qt 重写成 WinUI。 | +| [PyQt-Fluent-Widgets](https://github.com/zhiyiYo/PyQt-Fluent-Widgets) | [`AcrylicBrush`](https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/qfluentwidgets/components/widgets/acrylic_label.py#L163) 使用背景采集、Gaussian blur、tint、luminosity 和 noise;部分 Acrylic 是截图处理。 | 材质由模糊、染色、亮度与纹理多层组合;不能只画一层白色。 | GPLv3 / 商业许可。必须区分其图像材质和实时原生 Acrylic;不能看到 Acrylic 类名就认为全是系统合成。 | +| [window-vibrancy](https://github.com/tauri-apps/window-vibrancy) | [`apply_acrylic`](https://github.com/tauri-apps/window-vibrancy/blob/dev/src/windows.rs#L62) 在合适版本使用 `DWMWA_SYSTEMBACKDROP_TYPE / DWMSBT_TRANSIENTWINDOW`,否则走 Accent;Mica 有单独接口。 | Windows 版本判断、不同 API 路径及清理机制。 | Apache-2.0。Rust/Tauri 不能直接装进 PySide6,但系统 API 的技术路线值得对照。 | +| [QWindowKit](https://github.com/stdware/qwindowkit) | README 列出 `acrylic-material`、`dwm-blur`、`mica`,并讲明 Qt 私有 API、原生子窗口、Snap 与命中处理;不同平台的 glass 属性不同。 | 窗口外壳需要与材质一起设计,不能破坏拖动、缩放、系统菜单与 Snap。 | Apache-2.0;本轮核对其 README。C++ 工程与 Python 绑定成本需单独评估,不自动引入。旧 FramelessHelper 已指向该项目。 | +| [liquid-glass-react](https://github.com/rdev/liquid-glass-react) | [`src/index.tsx`](https://github.com/rdev/liquid-glass-react/blob/master/src/index.tsx#L35) 包含位移贴图、三通道位移和颜色合并;背景模糊是另一层。 | 边缘折射、可调磨砂、轻微色散,不只是圆角和阴影。 | MIT。可参考视觉与滤镜;它作用于网页内容,不是 Windows 桌面背景。README 说明 Safari/Firefox 位移支持有局限。 | +| [shuding/liquid-glass](https://github.com/shuding/liquid-glass) | [`liquid-glass.js`](https://github.com/shuding/liquid-glass/blob/main/liquid-glass.js#L69) 使用 `backdrop-filter:url(...)` 与 `feDisplacementMap`;按几何函数生成位移贴图。 | 用真实背板内容测试边缘弯折;位移贴图的 R/G 控制横向与纵向采样。 | MIT。本轮验证页使用自行生成的位移贴图,没有复制项目源码。 | + +源码核对记录及文件 Blob SHA 见 [github-material-sources.json](github-material-sources.json)。许可信息来自读取时的仓库元数据/README;本轮未安装上述库。 + +## 如何区分几种效果 + +| 效果 | 背后内容是什么 | 观察方式 | +| --- | --- | --- | +| 普通透明 | 原始内容直接 alpha 混合 | 背后的字和细线仍清晰,容易穿过前景文字。 | +| 网页背景磨砂 | 同一页面中、元素背后的图像 | 动背板或滚动内容,模糊颜色随之变化;不能看到浏览器外的窗口。 | +| 原生 Acrylic | Windows 合成器提供的窗口后方内容,具体行为受系统与窗口状态影响 | 用独立的真实背景窗口换色/移动,前景材质跟随变化。 | +| Mica | 通常从桌面壁纸等来源形成的窗口底材 | 不应期待它像透明玻璃一样实时折射所有背后窗口。 | +| Liquid Glass 视觉模拟 | 对采样图像做边缘位移,叠加磨砂、高光等 | 背后的直线在边缘弯折;强度过高会影响工程数据识读。 | + +## 本机原生实测 + +本机 Windows 11 build 26200。可复现探针:[native-acrylic-probe.py](native-acrylic-probe.py)。它只创建自有测试窗口,前景不绘制背景截图,使用系统 API 配置效果后,捕获这些窗口组成的测试区域;截图前检查区域中的窗口归属,发现遮挡即取消保存。 + +**左侧是普通透明,右侧启用 Accent Acrylic。** 两个前景窗口背后的测试图案一致。原生 Acrylic 明显滤除了竖线和背景字;更换背板颜色后,透入的颜色随之改变。 + +![Windows 原生 Acrylic 对照](native-acrylic-a.png) + +[查看背板变化动图](native-acrylic-live.gif) · [第二种背板截图](native-acrylic-b.png) + +验证结果:`SetWindowCompositionAttribute` 返回成功;截图中右侧背景水平边缘能量约为左侧的 1/6.35,换色后右侧像素也发生变化。这是对测试图案的图像差异检查,不是通用材质质量评分。 + +**还发现了一条未跑通的路径:** 清除 Accent 后,单独设置 `DWMWA_SYSTEMBACKDROP_TYPE=3` 返回 HRESULT 0,但该 Qt 小样的实际输出是灰色实底。见 [DWM 路径截图](native-dwm-acrylic.png)。因此不能仅凭 API 返回成功宣称真实玻璃已启用,需要继续验证 Qt 窗口表面、DWM 扩展区域与系统设置。 + +原生调用日志见 [native-acrylic-verification.json](native-acrylic-verification.json);像素与动态背板验证见 [material-verification.json](material-verification.json)。没有启动 CAD、读写工程或改变系统全局透明度设置。 + +## 可交互材质验证台 + +[打开 material-lab.html](material-lab.html)。三列使用相同背板,依次展示:只有透明、背景磨砂、低磨砂与边缘折射。 + +可以拖动背景位置、调整磨砂强度、关闭/打开模糊与折射。背板由网页图形与文本实时组成;没有用预先模糊的背景图冒充采样。该页是浏览器机制验证,原生实测在上面的独立探针中。 + +![三种材质对比](material-lab.png) + +Chrome 实测确认:磨砂滤镜为 `blur(18px) saturate(1.25)`,关闭后为 `none`;SVG 位移引用有效;改变背板位置会改变三列可见像素。效果开关在透明对照列的影响很小,而磨砂/折射列发生明显变化。1000px 页面宽度无横向溢出,浏览器无页面脚本错误。滤镜像素变化证明效果参与渲染,不代表它等同于 Apple 原生材质或所有浏览器效果一致。 + +## 对现有工程工具的建议 + +建议保留现有 PySide6 业务层和 SVG 图标,将外壳的侧栏、顶栏和短暂浮层接入已实测有视觉效果的原生模糊路径。料号表格使用独立清晰内容面。不要给整窗口设置低 opacity,也不要把普通白色底加阴影当作 Acrylic。 + +Apple 式折射适合少量浮层与分段控件;大面积表格不使用明显几何位移。若要在原生 Qt 中加入折射,需要 Qt Quick ShaderEffect / 可控的合成层等进一步验证;浏览器 SVG 位移不能原样翻译成 QWidget 的 QSS。 + +后续正式接入仍需验证:Qt/PySide6 版本、DWM 系统回退、透明度/高对比设置、激活状态、窗口拖动与 Snap、高 DPI、多显示器、远程桌面、打包以及现有 DSH WebEngine 子窗口的兼容性。本轮完成的是调研、机制对比和原生小样,未更改正式 UI 或执行状态机。 diff --git a/docs/reviews/2026-10-30-ui/github-material-sources.json b/docs/reviews/2026-10-30-ui/github-material-sources.json new file mode 100644 index 0000000..ad36aa7 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/github-material-sources.json @@ -0,0 +1,1174 @@ +{ + "date": "2026-10-30", + "retrieval": "GitHub REST metadata, README, recursive trees and source blobs; search endpoint rate-limited; raw domain unavailable.", + "projects": [ + { + "repo": "zhiyiYo/PyQt-Frameless-Window", + "url": "https://github.com/zhiyiYo/PyQt-Frameless-Window", + "branch": "master", + "license": "GPL-3.0", + "tree_sha": "e86a0742220844943e6b2e879c5ed072bd252b41", + "source_files": [ + { + "repo": "zhiyiYo/PyQt-Frameless-Window", + "path": "qframelesswindow/windows/window_effect.py", + "blob_sha": "4c7b0a9dcf56af6b70a5fa3f9ac15ca911903734", + "url": "https://github.com/zhiyiYo/PyQt-Frameless-Window/blob/master/qframelesswindow/windows/window_effect.py", + "license": "GPL-3.0", + "hits": [ + { + "line": 12, + "text": "from .c_structures import (ACCENT_POLICY, ACCENT_STATE, DWMNCRENDERINGPOLICY," + }, + { + "line": 28, + "text": "self.SetWindowCompositionAttribute = self.user32.SetWindowCompositionAttribute" + }, + { + "line": 31, + "text": "self.DwmSetWindowAttribute = self.dwmapi.DwmSetWindowAttribute" + }, + { + "line": 33, + "text": "self.SetWindowCompositionAttribute.restype = c_bool" + }, + { + "line": 36, + "text": "self.DwmSetWindowAttribute.restype = LONG" + }, + { + "line": 38, + "text": "self.SetWindowCompositionAttribute.argtypes = [" + }, + { + "line": 42, + "text": "self.DwmSetWindowAttribute.argtypes = [c_int, DWORD, LPCVOID, DWORD]" + }, + { + "line": 47, + "text": "self.accentPolicy = ACCENT_POLICY()" + }, + { + "line": 49, + "text": "self.winCompAttrData.Attribute = WINDOWCOMPOSITIONATTRIB.WCA_ACCENT_POLICY.value" + }, + { + "line": 53, + "text": "def setAcrylicEffect(self, hWnd, gradientColor=\"F2F2F299\", enableShadow=True, animationId=0):" + }, + { + "line": 54, + "text": "\"\"\" Add the acrylic effect to the window" + }, + { + "line": 62, + "text": "Hexadecimal acrylic mixed color, corresponding to four RGBA channels" + }, + { + "line": 71, + "text": "warnings.warn(\"The acrylic effect is only available on Win10+\")" + }, + { + "line": 79, + "text": "self.accentPolicy.AccentState = ACCENT_STATE.ACCENT_ENABLE_ACRYLICBLURBEHIND.value" + }, + { + "line": 83, + "text": "self.winCompAttrData.Attribute = WINDOWCOMPOSITIONATTRIB.WCA_ACCENT_POLICY.value" + }, + { + "line": 84, + "text": "self.SetWindowCompositionAttribute(hWnd, pointer(self.winCompAttrData))" + }, + { + "line": 102, + "text": "self.DwmSetWindowAttribute(hWnd," + }, + { + "line": 119, + "text": "self.DwmSetWindowAttribute(hWnd," + }, + { + "line": 124, + "text": "def setMicaEffect(self, hWnd, isDarkMode=False, isAlt=False):" + }, + { + "line": 125, + "text": "\"\"\" Add the mica effect to the window (Win11 only)" + }, + { + "line": 133, + "text": "whether to use dark mode mica effect" + }, + { + "line": 136, + "text": "whether to enable mica alt effect" + }, + { + "line": 139, + "text": "warnings.warn(\"The mica effect is only available on Win11\")" + }, + { + "line": 147, + "text": "self.winCompAttrData.Attribute = WINDOWCOMPOSITIONATTRIB.WCA_ACCENT_POLICY.value" + }, + { + "line": 148, + "text": "self.accentPolicy.AccentState = ACCENT_STATE.ACCENT_ENABLE_HOSTBACKDROP.value" + }, + { + "line": 149, + "text": "self.SetWindowCompositionAttribute(hWnd, pointer(self.winCompAttrData))" + }, + { + "line": 153, + "text": "self.SetWindowCompositionAttribute(hWnd, pointer(self.winCompAttrData))" + }, + { + "line": 156, + "text": "self.DwmSetWindowAttribute(hWnd, 1029, byref(c_int(1)), 4)" + }, + { + "line": 158, + "text": "self.DwmSetWindowAttribute(hWnd, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE.value, byref(c_int(4 if isAlt else 2)), 4)" + }, + { + "line": 160, + "text": "self.DwmSetWindowAttribute(hWnd, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE.value, byref(c_int(1*isDarkMode)), 4)" + }, + { + "line": 171, + "text": "self.winCompAttrData.Attribute = WINDOWCOMPOSITIONATTRIB.WCA_ACCENT_POLICY.value" + }, + { + "line": 172, + "text": "self.accentPolicy.AccentState = ACCENT_STATE.ACCENT_ENABLE_BLURBEHIND.value" + }, + { + "line": 173, + "text": "self.SetWindowCompositionAttribute(hWnd, pointer(self.winCompAttrData))" + }, + { + "line": 184, + "text": "self.accentPolicy.AccentState = ACCENT_STATE.ACCENT_DISABLED.value" + }, + { + "line": 185, + "text": "self.SetWindowCompositionAttribute(hWnd, pointer(self.winCompAttrData))" + }, + { + "line": 214, + "text": "self.DwmSetWindowAttribute(" + }, + { + "line": 232, + "text": "self.DwmSetWindowAttribute(" + } + ] + }, + { + "repo": "zhiyiYo/PyQt-Frameless-Window", + "path": "examples/acrylic_demo.py", + "blob_sha": "f6afce997154b5cfebb8c94cd0b326c9356a5281", + "url": "https://github.com/zhiyiYo/PyQt-Frameless-Window/blob/master/examples/acrylic_demo.py", + "license": "GPL-3.0", + "hits": [ + { + "line": 6, + "text": "from qframelesswindow import AcrylicWindow" + }, + { + "line": 9, + "text": "class Window(AcrylicWindow):" + }, + { + "line": 13, + "text": "self.setWindowTitle(\"Acrylic Window\")" + }, + { + "line": 16, + "text": "# customize acrylic effect" + }, + { + "line": 17, + "text": "# self.windowEffect.setAcrylicEffect(self.winId(), \"106EBE99\")" + }, + { + "line": 19, + "text": "# you can also enable mica effect on Win11" + }, + { + "line": 20, + "text": "# self.windowEffect.setMicaEffect(self.winId(), isDarkMode=False, isAlt=False)" + } + ] + } + ] + }, + { + "repo": "Peticali/PythonBlurBehind", + "url": "https://github.com/Peticali/PythonBlurBehind", + "branch": "main", + "license": "MIT", + "tree_sha": "4563be7c4c0ed9e51bc0d1275a69ec8acf6c2edc", + "source_files": [ + { + "repo": "Peticali/PythonBlurBehind", + "path": "blurWindow/blurWindow.py", + "blob_sha": "ab6d9b731b455de3ae55969e8f44554999c77429", + "url": "https://github.com/Peticali/PythonBlurBehind/blob/main/blurWindow/blurWindow.py", + "license": "MIT", + "hits": [ + { + "line": 83, + "text": "SetWindowCompositionAttribute = user32.SetWindowCompositionAttribute" + }, + { + "line": 84, + "text": "SetWindowCompositionAttribute.argtypes = (HWND, WINDOWCOMPOSITIONATTRIBDATA)" + }, + { + "line": 85, + "text": "SetWindowCompositionAttribute.restype = ctypes.c_int" + }, + { + "line": 93, + "text": "def Win7Blur(HWND,Acrylic):" + }, + { + "line": 94, + "text": "if Acrylic == False:" + }, + { + "line": 115, + "text": "def blur(hwnd, hexColor=False, Acrylic=False, Dark=False):" + }, + { + "line": 117, + "text": "accent.AccentState = 3 #Default window Blur #ACCENT_ENABLE_BLURBEHIND" + }, + { + "line": 123, + "text": "accent.AccentFlags = 2 #Window Blur With Accent Color #ACCENT_ENABLE_TRANSPARENTGRADIENT" + }, + { + "line": 125, + "text": "if Acrylic:" + }, + { + "line": 126, + "text": "accent.AccentState = 4 #UWP but LAG #ACCENT_ENABLE_ACRYLICBLURBEHIND" + }, + { + "line": 134, + "text": "data.Attribute = 19 #WCA_ACCENT_POLICY" + }, + { + "line": 138, + "text": "SetWindowCompositionAttribute(int(hwnd), data)" + }, + { + "line": 142, + "text": "SetWindowCompositionAttribute(int(hwnd), data)" + }, + { + "line": 152, + "text": "def GlobalBlur(HWND,hexColor=False,Acrylic=False,Dark=False,QWidget=None):" + }, + { + "line": 158, + "text": "Win7Blur(HWND,Acrylic)" + }, + { + "line": 162, + "text": "blur(HWND,hexColor,Acrylic,Dark)" + }, + { + "line": 164, + "text": "Win7Blur(HWND,Acrylic)" + } + ] + } + ] + }, + { + "repo": "microsoft/WinUI-Gallery", + "url": "https://github.com/microsoft/WinUI-Gallery", + "branch": "main", + "license": "MIT", + "tree_sha": "8ead97498abe4dceed7d37f32133c6e8bfad8155", + "source_files": [ + { + "repo": "microsoft/WinUI-Gallery", + "path": "WinUIGallery/Samples/Acrylic/AcrylicPage.xaml", + "blob_sha": "cc0b2df528ce4d107128c9a06d9c61d8e9cb3733", + "url": "https://github.com/microsoft/WinUI-Gallery/blob/main/WinUIGallery/Samples/Acrylic/AcrylicPage.xaml", + "license": "MIT", + "hits": [ + { + "line": 2, + "text": "x:Class=\"WinUIGallery.ControlPages.AcrylicPage\"" + }, + { + "line": 14, + "text": "" + }, + { + "line": 19, + "text": "" + }, + { + "line": 41, + "text": "Acrylic Brush might fall back to SolidColorbrush in certain scenarios." + }, + { + "line": 42, + "text": "If you can't see the Acrylic effect, please refer to" + }, + { + "line": 43, + "text": "Acrylic brush adaptability documentation." + }, + { + "line": 44, + "text": "Acrylic Brush uses in-app acrylic. See" + }, + { + "line": 45, + "text": "SystemBackdrops (Mica/Acrylic) for background acrylic." + }, + { + "line": 48, + "text": "" + }, + { + "line": 74, + "text": "" + }, + { + "line": 78, + "text": "" + }, + { + "line": 109, + "text": "x:Name=\"CustomAcrylicShapeInApp\"" + }, + { + "line": 111, + "text": "Fill=\"{ThemeResource CustomAcrylicInAppBrush}\" />" + }, + { + "line": 140, + "text": "x:Name=\"FallbackColorSelectorInApp\"" + }, + { + "line": 143, + "text": "SelectionChanged=\"FallbackColorSelector_SelectionChanged\">" + }, + { + "line": 152, + "text": "" + }, + { + "line": 156, + "text": "" + }, + { + "line": 187, + "text": "x:Name=\"CustomAcrylicShapeLumin\"" + }, + { + "line": 189, + "text": "Fill=\"{ThemeResource CustomAcrylicInAppLuminosity}\" />" + }, + { + "line": 206, + "text": "" + }, + { + "line": 208, + "text": "x:Name=\"LuminositySlider\"" + }, + { + "line": 217, + "text": "ValueChanged=\"LuminositySlider_ValueChanged\" />" + }, + { + "line": 222, + "text": "" + } + ] + }, + { + "repo": "microsoft/WinUI-Gallery", + "path": "WinUIGallery/Samples/SystemBackdrops/SystemBackdropsDesktopacryliccontroller.txt", + "blob_sha": "e4ba131d76ad4b847b1421b394ae02f48391a710", + "url": "https://github.com/microsoft/WinUI-Gallery/blob/main/WinUIGallery/Samples/SystemBackdrops/SystemBackdropsDesktopacryliccontroller.txt", + "license": "MIT", + "hits": [ + { + "line": 2, + "text": "DesktopAcrylicController" + }, + { + "line": 9, + "text": "SystemBackdrops.DesktopAcrylicController acrylicController;" + }, + { + "line": 12, + "text": "bool TrySetAcrylicBackdrop(bool useAcrylicThin)" + }, + { + "line": 14, + "text": "if (DesktopAcrylicController.IsSupported())" + }, + { + "line": 28, + "text": "acrylicController = new DesktopAcrylicController();" + }, + { + "line": 29, + "text": "acrylicController.Kind = useAcrylicThin ? DesktopAcrylicKind.Thin : DesktopAcrylicKind.Base;" + }, + { + "line": 32, + "text": "acrylicController.AddSystemBackdropTarget(As());" + }, + { + "line": 33, + "text": "acrylicController.SetSystemBackdropConfiguration(configurationSource);" + }, + { + "line": 37, + "text": "return false; // Acrylic is not supported on this system." + }, + { + "line": 47, + "text": "// Make sure any Mica/Acrylic controller is disposed" + }, + { + "line": 48, + "text": "if (acrylicController != null)" + }, + { + "line": 50, + "text": "acrylicController.Dispose();" + }, + { + "line": 51, + "text": "acrylicController = null;" + } + ] + } + ] + }, + { + "repo": "zhiyiYo/PyQt-Fluent-Widgets", + "url": "https://github.com/zhiyiYo/PyQt-Fluent-Widgets", + "branch": "master", + "license": "GPL-3.0", + "tree_sha": "6b9c646ce107660f66d20cec8af967c2c8d79764", + "source_files": [ + { + "repo": "zhiyiYo/PyQt-Fluent-Widgets", + "path": "qfluentwidgets/components/material/acrylic_widget.py", + "blob_sha": "a88354a7de237c8d0ac8ac6ae3acb448b8846506", + "url": "https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/qfluentwidgets/components/material/acrylic_widget.py", + "license": "GPL-3.0", + "hits": [ + { + "line": 7, + "text": "from ..widgets.acrylic_label import AcrylicBrush" + }, + { + "line": 11, + "text": "class AcrylicWidget:" + }, + { + "line": 12, + "text": "\"\"\" Acrylic widget \"\"\"" + }, + { + "line": 16, + "text": "self.acrylicBrush = AcrylicBrush(self, 30)" + }, + { + "line": 18, + "text": "def _updateAcrylicColor(self):" + }, + { + "line": 26, + "text": "self.acrylicBrush.tintColor = tintColor" + }, + { + "line": 27, + "text": "self.acrylicBrush.luminosityColor = luminosityColor" + }, + { + "line": 29, + "text": "def acrylicClipPath(self):" + }, + { + "line": 32, + "text": "def _drawAcrylic(self, painter: QPainter):" + }, + { + "line": 33, + "text": "path = self.acrylicClipPath()" + }, + { + "line": 35, + "text": "self.acrylicBrush.clipPath = self.acrylicClipPath()" + }, + { + "line": 37, + "text": "self._updateAcrylicColor()" + }, + { + "line": 38, + "text": "self.acrylicBrush.paint()" + }, + { + "line": 44, + "text": "self._drawAcrylic(painter)" + } + ] + }, + { + "repo": "zhiyiYo/PyQt-Fluent-Widgets", + "path": "qfluentwidgets/components/widgets/acrylic_label.py", + "blob_sha": "80961e9f82811f24cc9911a60dd5db7a43dc9eb9", + "url": "https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/qfluentwidgets/components/widgets/acrylic_label.py", + "license": "GPL-3.0", + "hits": [ + { + "line": 14, + "text": "isAcrylicAvailable = True" + }, + { + "line": 16, + "text": "isAcrylicAvailable = False" + }, + { + "line": 18, + "text": "def gaussianBlur(imagePath, blurRadius=18, brightFactor=1, blurPicSize=None):" + }, + { + "line": 22, + "text": "def checkAcrylicAvailability():" + }, + { + "line": 23, + "text": "if not isAcrylicAvailable:" + }, + { + "line": 25, + "text": "'`AcrylicLabel` is not supported in current qfluentwidgets, use `pip install PyQt-Fluent-Widgets[full]` to enable it.')" + }, + { + "line": 27, + "text": "return isAcrylicAvailable" + }, + { + "line": 38, + "text": "self.blurRadius = 7" + }, + { + "line": 46, + "text": "self.imagePath, self.blurRadius, 0.85, self.maxSize)" + }, + { + "line": 49, + "text": "def blur(self, imagePath: str, blurRadius=6, maxSize: tuple = (450, 450)):" + }, + { + "line": 51, + "text": "self.blurRadius = blurRadius" + }, + { + "line": 56, + "text": "class AcrylicTextureLabel(QLabel):" + }, + { + "line": 57, + "text": "\"\"\" Acrylic texture label \"\"\"" + }, + { + "line": 59, + "text": "def __init__(self, tintColor: QColor, luminosityColor: QColor, noiseOpacity=0.03, parent=None):" + }, + { + "line": 69, + "text": "noiseOpacity: float" + }, + { + "line": 70, + "text": "noise layer opacity" + }, + { + "line": 78, + "text": "self.noiseOpacity = noiseOpacity" + }, + { + "line": 79, + "text": "self.noiseImage = QImage(':/qfluentwidgets/images/acrylic/noise.png')" + }, + { + "line": 87, + "text": "acrylicTexture = QImage(64, 64, QImage.Format_ARGB32_Premultiplied)" + }, + { + "line": 90, + "text": "acrylicTexture.fill(self.luminosityColor)" + }, + { + "line": 93, + "text": "painter = QPainter(acrylicTexture)" + }, + { + "line": 94, + "text": "painter.fillRect(acrylicTexture.rect(), self.tintColor)" + }, + { + "line": 96, + "text": "# paint noise" + }, + { + "line": 97, + "text": "painter.setOpacity(self.noiseOpacity)" + }, + { + "line": 98, + "text": "painter.drawImage(acrylicTexture.rect(), self.noiseImage)" + }, + { + "line": 100, + "text": "acrylicBrush = QBrush(acrylicTexture)" + }, + { + "line": 102, + "text": "painter.fillRect(self.rect(), acrylicBrush)" + }, + { + "line": 105, + "text": "class AcrylicLabel(QLabel):" + }, + { + "line": 106, + "text": "\"\"\" Acrylic label \"\"\"" + }, + { + "line": 108, + "text": "def __init__(self, blurRadius: int, tintColor: QColor, luminosityColor=QColor(255, 255, 255, 0)," + }, + { + "line": 113, + "text": "blurRadius: int" + }, + { + "line": 129, + "text": "checkAcrylicAvailability()" + }, + { + "line": 133, + "text": "self.blurRadius = blurRadius" + }, + { + "line": 135, + "text": "self.acrylicTextureLabel = AcrylicTextureLabel(" + }, + { + "line": 149, + "text": "self.blurThread.blur(imagePath, self.blurRadius, self.maxBlurSize)" + }, + { + "line": 152, + "text": "self.acrylicTextureLabel.setTintColor(color)" + }, + { + "line": 156, + "text": "self.acrylicTextureLabel.resize(self.size())" + }, + { + "line": 163, + "text": "class AcrylicBrush:" + }, + { + "line": 164, + "text": "\"\"\" Acrylic brush \"\"\"" + }, + { + "line": 166, + "text": "def __init__(self, device: QWidget, blurRadius: int, tintColor=QColor(242, 242, 242, 150)," + }, + { + "line": 167, + "text": "luminosityColor=QColor(255, 255, 255, 10), noiseOpacity=0.03):" + }, + { + "line": 169, + "text": "self.blurRadius = blurRadius" + }, + { + "line": 173, + "text": "self.noiseOpacity = noiseOpacity" + }, + { + "line": 174, + "text": "self.noiseImage = QImage(':/qfluentwidgets/images/acrylic/noise.png')" + }, + { + "line": 181, + "text": "if radius == self.blurRadius:" + }, + { + "line": 184, + "text": "self.blurRadius = radius" + }, + { + "line": 191, + "text": "def setLuminosityColor(self, color: QColor):" + }, + { + "line": 196, + "text": "return isAcrylicAvailable" + }, + { + "line": 198, + "text": "def grabImage(self, rect: QRect):" + }, + { + "line": 199, + "text": "\"\"\" grab image from screen" + }, + { + "line": 204, + "text": "grabbed region" + }, + { + "line": 213, + "text": "self.setImage(screen.grabWindow(0, x, y, w, h))" + }, + { + "line": 224, + "text": "checkAcrylicAvailability()" + }, + { + "line": 226, + "text": "self.image = gaussianBlur(image, self.blurRadius, blurPicSize=self.blurPicSize)" + }, + { + "line": 245, + "text": "# paint noise" + }, + { + "line": 246, + "text": "painter.setOpacity(self.noiseOpacity)" + }, + { + "line": 247, + "text": "painter.drawImage(texture.rect(), self.noiseImage)" + }, + { + "line": 264, + "text": "# paint acrylic texture" + } + ] + } + ] + }, + { + "repo": "rdev/liquid-glass-react", + "url": "https://github.com/rdev/liquid-glass-react", + "branch": "master", + "license": "MIT", + "tree_sha": "ac48eab18d1f7f444ae30002d240cae29c863a21", + "source_files": [ + { + "repo": "rdev/liquid-glass-react", + "path": "src/index.tsx", + "blob_sha": "a0e6b7242d2c66c598eecdfbe33815d996621571", + "url": "https://github.com/rdev/liquid-glass-react/blob/master/src/index.tsx", + "license": "MIT", + "hits": [ + { + "line": 2, + "text": "import { ShaderDisplacementGenerator, fragmentShaders } from \"./shader-utils\"" + }, + { + "line": 5, + "text": "// Generate shader-based displacement map using shaderUtils" + }, + { + "line": 19, + "text": "const getMap = (mode: \"standard\" | \"polar\" | \"prominent\" | \"shader\", shaderMapUrl?: string) => {" + }, + { + "line": 27, + "text": "case \"shader\":" + }, + { + "line": 28, + "text": "return shaderMapUrl || displacementMap" + }, + { + "line": 35, + "text": "const GlassFilter: React.FC<{ id: string; displacementScale: number; aberrationIntensity: number; width: number; height: number; mode: \"standard\" | \"polar\" | \"prominent\" | \"shader\"; shaderMa" + }, + { + "line": 42, + "text": "shaderMapUrl," + }, + { + "line": 52, + "text": "" + }, + { + "line": 72, + "text": "" + }, + { + "line": 84, + "text": "" + }, + { + "line": 151, + "text": "mode?: \"standard\" | \"polar\" | \"prominent\" | \"shader\"" + }, + { + "line": 178, + "text": "const [shaderMapUrl, setShaderMapUrl] = useState(\"\")" + }, + { + "line": 182, + "text": "// Generate shader displacement map when in shader mode" + }, + { + "line": 184, + "text": "if (mode === \"shader\") {" + }, + { + "line": 192, + "text": "backdropFilter: `blur(${(overLight ? 12 : 4) + blurAmount * 32}px) saturate(${saturation}%)`," + }, + { + "line": 197, + "text": ") -> Result<(), Error> {" + }, + { + "line": 67, + "text": "DWMWA_SYSTEMBACKDROP_TYPE as _," + }, + { + "line": 73, + "text": "SetWindowCompositionAttribute(" + }, + { + "line": 75, + "text": "ACCENT_STATE::ACCENT_ENABLE_ACRYLICBLURBEHIND," + }, + { + "line": 81, + "text": "\"\\\"apply_acrylic()\\\" is only available on Windows 10 v1809 or newer and Windows 11.\"," + }, + { + "line": 87, + "text": "pub fn clear_acrylic(hwnd: HWND) -> Result<(), Error> {" + }, + { + "line": 90, + "text": "dwm_set_window_attribute(hwnd, DWMWA_SYSTEMBACKDROP_TYPE as _, &DWMSBT_NONE)?;" + }, + { + "line": 94, + "text": "SetWindowCompositionAttribute(hwnd, ACCENT_STATE::ACCENT_DISABLED, None);" + }, + { + "line": 98, + "text": "\"\\\"clear_acrylic()\\\" is only available on Windows 10 v1809 or newer and Windows 11.\"," + }, + { + "line": 104, + "text": "pub fn apply_mica(hwnd: HWND, dark: Option) -> Result<(), Error> {" + }, + { + "line": 113, + "text": "dwm_set_window_attribute(hwnd, DWMWA_SYSTEMBACKDROP_TYPE as _, &DWMSBT_MAINWINDOW)?;" + }, + { + "line": 115, + "text": "} else if is_undocumented_mica_supported() {" + }, + { + "line": 121, + "text": "\"\\\"apply_mica()\\\" is only available on Windows 11.\"," + }, + { + "line": 127, + "text": "pub fn clear_mica(hwnd: HWND) -> Result<(), Error> {" + }, + { + "line": 130, + "text": "dwm_set_window_attribute(hwnd, DWMWA_SYSTEMBACKDROP_TYPE as _, &DWMSBT_NONE)?;" + }, + { + "line": 132, + "text": "} else if is_undocumented_mica_supported() {" + }, + { + "line": 138, + "text": "\"\\\"clear_mica()\\\" is only available on Windows 11.\"," + }, + { + "line": 153, + "text": "dwm_set_window_attribute(hwnd, DWMWA_SYSTEMBACKDROP_TYPE as _, &DWMSBT_TABBEDWINDOW)?;" + }, + { + "line": 166, + "text": "dwm_set_window_attribute(hwnd, DWMWA_SYSTEMBACKDROP_TYPE as _, &DWMSBT_NONE)?;" + }, + { + "line": 195, + "text": "struct ACCENT_POLICY {" + }, + { + "line": 213, + "text": "enum ACCENT_STATE {" + }, + { + "line": 214, + "text": "ACCENT_DISABLED = 0," + }, + { + "line": 215, + "text": "ACCENT_ENABLE_BLURBEHIND = 3," + }, + { + "line": 216, + "text": "ACCENT_ENABLE_ACRYLICBLURBEHIND = 4," + }, + { + "line": 219, + "text": "unsafe fn SetWindowCompositionAttribute(" + }, + { + "line": 221, + "text": "accent_state: ACCENT_STATE," + }, + { + "line": 224, + "text": "type SetWindowCompositionAttribute =" + }, + { + "line": 228, + "text": "get_function!(\"user32.dll\", SetWindowCompositionAttribute)" + }, + { + "line": 232, + "text": "let is_acrylic = accent_state == ACCENT_STATE::ACCENT_ENABLE_ACRYLICBLURBEHIND;" + }, + { + "line": 233, + "text": "if is_acrylic && color.3 == 0 {" + }, + { + "line": 234, + "text": "// acrylic doesn't like to have 0 alpha" + }, + { + "line": 238, + "text": "let mut policy = ACCENT_POLICY {" + }, + { + "line": 240, + "text": "AccentFlags: if is_acrylic { 0 } else { 2 }," + }, + { + "line": 260, + "text": "let result = unsafe { DwmSetWindowAttribute(hwnd, kind, object as *const _ as _, size) };" + }, + { + "line": 264, + "text": "let api = \"DwmSetWindowAttribute\";" + }, + { + "line": 285, + "text": "fn is_undocumented_mica_supported() -> bool {" + } + ] + } + ] + }, + { + "repo": "stdware/qwindowkit", + "url": "https://github.com/stdware/qwindowkit", + "readme_source": "https://api.github.com/repos/stdware/qwindowkit/readme", + "license": "Apache-2.0", + "checked": "README platform attributes, Qt integration and compatibility notes; no implementation-source audit." + } + ] +} diff --git a/docs/reviews/2026-10-30-ui/icon-sheet.png b/docs/reviews/2026-10-30-ui/icon-sheet.png new file mode 100644 index 0000000..fc9f6f0 Binary files /dev/null and b/docs/reviews/2026-10-30-ui/icon-sheet.png differ diff --git a/docs/reviews/2026-10-30-ui/icon-sheet.svg b/docs/reviews/2026-10-30-ui/icon-sheet.svg new file mode 100644 index 0000000..b062463 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icon-sheet.svg @@ -0,0 +1 @@ +DxPartReplace / SVG icon set32 original symbols / 20 x 20 grid / 1.6 stroke / currentColorarrow-upchatcheck-circlecheckchevroncircuitclockclosecolumnscopydownloadfoldergridinfologmorepauseplayplusprojectrefreshrulessavescansearchsidebarsliderssorttabletrashuploadwarning \ No newline at end of file diff --git a/docs/reviews/2026-10-30-ui/icons/README.md b/docs/reviews/2026-10-30-ui/icons/README.md new file mode 100644 index 0000000..5c78ae6 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/README.md @@ -0,0 +1,5 @@ +# SVG icons + +Original 20 × 20 SVG icons for the DxPartReplace UI concept. Consistent 1.6 unit strokes, rounded caps and joins; color inherits `currentColor`. These are original drawings, not Apple SF Symbols. + +The preview embeds the same shapes as an SVG symbol sprite; the individual files can be used by Qt SVG rendering when the production interface is implemented. diff --git a/docs/reviews/2026-10-30-ui/icons/arrow-up.svg b/docs/reviews/2026-10-30-ui/icons/arrow-up.svg new file mode 100644 index 0000000..4c8dff1 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/arrow-up.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/chat.svg b/docs/reviews/2026-10-30-ui/icons/chat.svg new file mode 100644 index 0000000..d23aa05 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/chat.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/check-circle.svg b/docs/reviews/2026-10-30-ui/icons/check-circle.svg new file mode 100644 index 0000000..97ed6c5 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/check-circle.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/check.svg b/docs/reviews/2026-10-30-ui/icons/check.svg new file mode 100644 index 0000000..8bd23ec --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/check.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/chevron.svg b/docs/reviews/2026-10-30-ui/icons/chevron.svg new file mode 100644 index 0000000..05fd299 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/chevron.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/circuit.svg b/docs/reviews/2026-10-30-ui/icons/circuit.svg new file mode 100644 index 0000000..bf4c1b7 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/circuit.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/clock.svg b/docs/reviews/2026-10-30-ui/icons/clock.svg new file mode 100644 index 0000000..e9d2683 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/clock.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/close.svg b/docs/reviews/2026-10-30-ui/icons/close.svg new file mode 100644 index 0000000..f3b08d5 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/close.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/columns.svg b/docs/reviews/2026-10-30-ui/icons/columns.svg new file mode 100644 index 0000000..ffaf0ea --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/columns.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/copy.svg b/docs/reviews/2026-10-30-ui/icons/copy.svg new file mode 100644 index 0000000..da41446 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/copy.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/download.svg b/docs/reviews/2026-10-30-ui/icons/download.svg new file mode 100644 index 0000000..3b19f38 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/download.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/folder.svg b/docs/reviews/2026-10-30-ui/icons/folder.svg new file mode 100644 index 0000000..94c86aa --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/folder.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/grid.svg b/docs/reviews/2026-10-30-ui/icons/grid.svg new file mode 100644 index 0000000..1e868b8 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/grid.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/info.svg b/docs/reviews/2026-10-30-ui/icons/info.svg new file mode 100644 index 0000000..beddf6f --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/info.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/log.svg b/docs/reviews/2026-10-30-ui/icons/log.svg new file mode 100644 index 0000000..b979f01 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/log.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/more.svg b/docs/reviews/2026-10-30-ui/icons/more.svg new file mode 100644 index 0000000..62fbcc3 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/more.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/pause.svg b/docs/reviews/2026-10-30-ui/icons/pause.svg new file mode 100644 index 0000000..2dead18 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/pause.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/play.svg b/docs/reviews/2026-10-30-ui/icons/play.svg new file mode 100644 index 0000000..fabe332 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/play.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/plus.svg b/docs/reviews/2026-10-30-ui/icons/plus.svg new file mode 100644 index 0000000..3bc1f9d --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/plus.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/project.svg b/docs/reviews/2026-10-30-ui/icons/project.svg new file mode 100644 index 0000000..fea1423 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/project.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/refresh.svg b/docs/reviews/2026-10-30-ui/icons/refresh.svg new file mode 100644 index 0000000..8e81330 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/refresh.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/rules.svg b/docs/reviews/2026-10-30-ui/icons/rules.svg new file mode 100644 index 0000000..5d06bc3 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/rules.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/save.svg b/docs/reviews/2026-10-30-ui/icons/save.svg new file mode 100644 index 0000000..dbe32e3 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/save.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/scan.svg b/docs/reviews/2026-10-30-ui/icons/scan.svg new file mode 100644 index 0000000..1531a24 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/scan.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/search.svg b/docs/reviews/2026-10-30-ui/icons/search.svg new file mode 100644 index 0000000..7bfa287 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/search.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/sidebar.svg b/docs/reviews/2026-10-30-ui/icons/sidebar.svg new file mode 100644 index 0000000..6321435 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/sidebar.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/sliders.svg b/docs/reviews/2026-10-30-ui/icons/sliders.svg new file mode 100644 index 0000000..41062b7 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/sliders.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/sort.svg b/docs/reviews/2026-10-30-ui/icons/sort.svg new file mode 100644 index 0000000..cdf05fc --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/sort.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/table.svg b/docs/reviews/2026-10-30-ui/icons/table.svg new file mode 100644 index 0000000..ad4740f --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/table.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/trash.svg b/docs/reviews/2026-10-30-ui/icons/trash.svg new file mode 100644 index 0000000..2d73a2c --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/trash.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/upload.svg b/docs/reviews/2026-10-30-ui/icons/upload.svg new file mode 100644 index 0000000..56920db --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/upload.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/icons/warning.svg b/docs/reviews/2026-10-30-ui/icons/warning.svg new file mode 100644 index 0000000..728eb99 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/icons/warning.svg @@ -0,0 +1 @@ + diff --git a/docs/reviews/2026-10-30-ui/implementation-acceptance.json b/docs/reviews/2026-10-30-ui/implementation-acceptance.json new file mode 100644 index 0000000..1a0abbe --- /dev/null +++ b/docs/reviews/2026-10-30-ui/implementation-acceptance.json @@ -0,0 +1,21 @@ +{ + "cad_started": false, + "sample_data_only": true, + "ownership_checked": true, + "os_build": 26200, + "native_enabled": true, + "sidebar_backdrop_difference": 21.323206901227035, + "opaque_table_backdrop_difference": 0.0, + "solid_sidebar_mean": [ + 233.0, + 238.0, + 244.0 + ], + "solid_fallback": true, + "compact_size": [ + 980, + 700 + ], + "compact_table_height": 131, + "options_exposed": true +} diff --git a/docs/reviews/2026-10-30-ui/implementation.md b/docs/reviews/2026-10-30-ui/implementation.md new file mode 100644 index 0000000..782996a --- /dev/null +++ b/docs/reviews/2026-10-30-ui/implementation.md @@ -0,0 +1,67 @@ +# 第二种背景磨砂:正式 PySide6 接入 + +> 交互与表格反馈已继续完成 [最新细节打磨](detail-polish.md),最终样例见该记录。 + +> 正式界面现已继续完成 [按钮、布局与右侧磨砂补全](layout-refinement.md),当前截图与验收数值以该记录为准。 + +2026-10-30。工作分支 `codex/ui-update`。用户明确批准材质对比页中的第二种“背景磨砂”,本次已将它接入正式 `TrialTaskCenterWindow`。 + +## 已实现 + +- 通过 ctypes 对窗口自身启用 Windows Acrylic;使用事先在本机验证可见效果的 `SetWindowCompositionAttribute` 路径。没有把浏览器 CSS 当作原生窗口背景模糊,也没有用背景截图充当材质。 +- 保留系统窗口框架,顶栏与任务侧栏响应真实窗口后的内容。没有使用全窗口 opacity。 +- 高对比度、系统透明度关闭、远程会话、非 Windows / 离屏、不支持的版本、接口失败与用户选择减少透明度时回退实色。可见窗口定期复查系统策略;只影响本窗口,不写系统设置。 +- alpha 窗口在回退时显式绘制实色底,避免原生窗口在禁用合成后露出黑色区域。 +- 32 个原创新 SVG 文件纳入正式应用 assets,沿用原有 package-data 规则。导航、执行、保存、导入导出、诊断和任务操作接入图标,并保留操作文字 / 提示。 +- 工程名称和路径置于表格上方;原有 Value 与关闭归档选项放入可展开区域;缩窄布局后保留位号表和操作空间。 + +现有执行状态机、CAD 服务与 DSH 后端未作为本次材质修改的一部分重写。工作区中已有的其他 DSH 生命周期修改被保留,本次没有替它们提交或发布。 + +## 测试 + +相关命令: + +```powershell +python -m pytest tests/ui tests/v1_1/test_ui_workspace.py tests/v1_1/test_ui_remediation.py tests/v1_1/test_safe_stop_ui.py tests/v1_1/test_target_table.py tests/v1_1/test_ui_operation_lifecycle.py tests/v1_1/test_task_navigation.py -q --basetemp=build/pytest-acrylic-final +``` + +结果:**103 passed**。覆盖材质策略 / 回退、偏好持久化、句柄变化、SVG 控件、现有 UI 流程、窄窗口、草稿、过滤/排序与安全暂停等相关行为。 + +独立静态代码审查未发现本次范围中的重要生产问题;指出的 Windows 专属策略测试缺少平台跳过标记已修正。 + +实机验收命令: + +```powershell +python tools/accept_acrylic_ui.py --output build/acrylic-acceptance +``` + +验收使用临时示例工程、库存和已保存计划,没有启动 CAD。实际窗口置于自有实时背板上,截图区域在保存前检查窗口归属。验证环境为 Windows 11 build 26200,125% 缩放。 + +| 项目 | 实测 | +| --- | --- | +| 原生 Acrylic | 已启用,截图可见背景模糊 | +| 背板换色时侧栏变化 | 平均像素差约 21.32 | +| 同时表格区域变化 | 平均像素差 0.0,保持实色 | +| 减少透明度后的侧栏 | 实色 RGB 均值 233 / 238 / 244,无黑色底 | +| 980×700 | 窗口尺寸保持,位号表 viewport 高度 131 逻辑像素 | +| Value / 归档选项 | 可从标题旁入口展开 | + +数值是固定示例区域的图像比较,不是通用性能或视觉质量评分。日志见 [implementation-acceptance.json](implementation-acceptance.json)。 + +## 实际窗口截图 + +以下是正式 Qt 窗口的系统合成截图,已使用示例工程数据,不是 HTML 预览。 + +![原生磨砂已接入](implemented-native.png) + +![背景变化后](implemented-native-background-b.png) + +![实色回退](implemented-solid.png) + +![980×700 布局](implemented-compact.png) + +## 交付边界 + +已更新源代码与打包资产,尚未重新构建便携 EXE。旧版便携包不会自动更新外观。本轮未做真实 CAD 写入,也未完成 Windows 10、多显示器、不同显卡驱动、所有缩放比例与发布包的跨环境验证。 + +窗口使用 Windows 合成接口;不同系统设置与远程环境下可能回退为实色。当前 DSH 内嵌前端继续使用其自身界面,只统一外层导航,不宣称已重写官方 Harness 的页面。 diff --git a/docs/reviews/2026-10-30-ui/implemented-compact.png b/docs/reviews/2026-10-30-ui/implemented-compact.png new file mode 100644 index 0000000..e5ef670 Binary files /dev/null and b/docs/reviews/2026-10-30-ui/implemented-compact.png differ diff --git a/docs/reviews/2026-10-30-ui/implemented-native-background-b.png b/docs/reviews/2026-10-30-ui/implemented-native-background-b.png new file mode 100644 index 0000000..ed46d2a Binary files /dev/null and b/docs/reviews/2026-10-30-ui/implemented-native-background-b.png differ diff --git a/docs/reviews/2026-10-30-ui/implemented-native.png b/docs/reviews/2026-10-30-ui/implemented-native.png new file mode 100644 index 0000000..ce2e235 Binary files /dev/null and b/docs/reviews/2026-10-30-ui/implemented-native.png differ diff --git a/docs/reviews/2026-10-30-ui/implemented-solid.png b/docs/reviews/2026-10-30-ui/implemented-solid.png new file mode 100644 index 0000000..06c0aba Binary files /dev/null and b/docs/reviews/2026-10-30-ui/implemented-solid.png differ diff --git a/docs/reviews/2026-10-30-ui/layout-acceptance.json b/docs/reviews/2026-10-30-ui/layout-acceptance.json new file mode 100644 index 0000000..79e06ce --- /dev/null +++ b/docs/reviews/2026-10-30-ui/layout-acceptance.json @@ -0,0 +1,23 @@ +{ + "cad_started": false, + "sample_data_only": true, + "ownership_checked": true, + "os_build": 26200, + "native_enabled": true, + "sidebar_backdrop_difference": 21.82688605017125, + "opaque_table_backdrop_difference": 0.0, + "right_header_backdrop_difference": 7.638507661558961, + "right_execution_backdrop_difference": 12.32960451977401, + "solid_sidebar_mean": [ + 233.0, + 238.0, + 244.0 + ], + "solid_fallback": true, + "compact_size": [ + 980, + 700 + ], + "compact_table_height": 194, + "options_exposed": true +} diff --git a/docs/reviews/2026-10-30-ui/layout-compact.png b/docs/reviews/2026-10-30-ui/layout-compact.png new file mode 100644 index 0000000..6152e9c Binary files /dev/null and b/docs/reviews/2026-10-30-ui/layout-compact.png differ diff --git a/docs/reviews/2026-10-30-ui/layout-native-b.png b/docs/reviews/2026-10-30-ui/layout-native-b.png new file mode 100644 index 0000000..eb5acf5 Binary files /dev/null and b/docs/reviews/2026-10-30-ui/layout-native-b.png differ diff --git a/docs/reviews/2026-10-30-ui/layout-native.png b/docs/reviews/2026-10-30-ui/layout-native.png new file mode 100644 index 0000000..df4d250 Binary files /dev/null and b/docs/reviews/2026-10-30-ui/layout-native.png differ diff --git a/docs/reviews/2026-10-30-ui/layout-refinement.md b/docs/reviews/2026-10-30-ui/layout-refinement.md new file mode 100644 index 0000000..26e503b --- /dev/null +++ b/docs/reviews/2026-10-30-ui/layout-refinement.md @@ -0,0 +1,35 @@ +# 正式界面:按钮、布局与右侧磨砂补全 + +> 交互与表格反馈已继续完成 [最新细节打磨](detail-polish.md),最终样例见该记录。 + +用户反馈上一轮只落地外壳和图标,按钮布局仍旧、右侧磨砂被白底遮挡。本轮修改正式 PySide6 组件,保留已有服务与执行门禁。 + +## 已改变的布局 + +- 任务侧栏顶部直接新建;编辑、恢复、顺序调整和删除进入任务管理菜单,显示排序单独提供菜单。任务项用 delegate 分层显示名称、状态、图标与顺序,不添加逐行 QWidget。完整名称和路径继续保留在数据与提示中。 +- 搜索、BOM 模板、BOM 导入和位号采集合并到一条工具栏。搜索支持输入过滤、清空和下一条;低频位号 Excel 工具与搜索命令进入更多菜单。 +- 保存计划移至表格底部,和逐行编辑、批量填写形成连续操作区。 +- 执行区只显示当前状态的直接动作。普通执行、恢复、重试、开始新一轮与安全暂停按已有状态门禁显示。诊断、资源清理、轮次证据、布局和强制结束进入更多操作菜单;强制结束保留原确认流程。 +- 工程状态与设置位于标题行,工程重新读取收进菜单,路径保留复制入口。 + +## 右侧材质 + +移除工作区与标签页的大面积不透明白底。右侧工程标题、搜索工具栏、编辑工具区和执行面板现在共同透出 Windows 原生 Acrylic。表格 viewport 继续保持实色,交互菜单与错误/恢复提示仍须清晰可读。 + +底层使用上一轮已验证的 Windows 合成实现,不通过整窗口 opacity 制造效果;减少透明度仍切回实色。 + +## 命令安全与验证 + +菜单通过现有按钮对象执行,菜单展示时同步文字、图标、启用与显式可见状态;触发时再次检查源按钮当前状态。隐藏按钮保留在原面板的隐藏存储容器内,继续受原业务门禁控制。没有复制执行逻辑,也没有让过期菜单状态绕过禁用操作。 + +新增 `test_workspace_redesign.py` 覆盖菜单触发与禁用、任务管理菜单、工具栏与保存位置、执行维护菜单、小窗口操作可见性。相关回归合计 **108 项通过**。独立静态审查未发现重要的命令路由、状态或可见性问题。 + +原生验收新增了右侧两个采样区:工程路径/标题区域和执行区。改变自有背板时,左右外壳都必须变化;表格区域仍须不变。Windows 11 build 26200、125% 缩放下通过,980×700 表格 viewport 约 194 逻辑像素。 + +本次验收使用临时示例数据,没有启动 CAD。详细数值见 [layout-acceptance.json](layout-acceptance.json)。旧窗口会通过正常关闭流程重开;未保存或运行中的关闭保护不会被自动绕过。 + +![新布局与右侧磨砂](layout-native.png) + +![小窗口](layout-compact.png) + +源代码界面已更新,便携 EXE 尚未重新构建。Windows 10、不同驱动、远程桌面及打包后的效果仍需对应环境验证。 diff --git a/docs/reviews/2026-10-30-ui/layout-solid.png b/docs/reviews/2026-10-30-ui/layout-solid.png new file mode 100644 index 0000000..343b1c2 Binary files /dev/null and b/docs/reviews/2026-10-30-ui/layout-solid.png differ diff --git a/docs/reviews/2026-10-30-ui/material-lab-effects-off.png b/docs/reviews/2026-10-30-ui/material-lab-effects-off.png new file mode 100644 index 0000000..7a758a5 Binary files /dev/null and b/docs/reviews/2026-10-30-ui/material-lab-effects-off.png differ diff --git a/docs/reviews/2026-10-30-ui/material-lab-moved.png b/docs/reviews/2026-10-30-ui/material-lab-moved.png new file mode 100644 index 0000000..a9a41e1 Binary files /dev/null and b/docs/reviews/2026-10-30-ui/material-lab-moved.png differ diff --git a/docs/reviews/2026-10-30-ui/material-lab.html b/docs/reviews/2026-10-30-ui/material-lab.html new file mode 100644 index 0000000..5fa7f3d --- /dev/null +++ b/docs/reviews/2026-10-30-ui/material-lab.html @@ -0,0 +1,23 @@ + +毛玻璃机制对比 · DxPartReplace + + +

毛玻璃,要让背后的内容真正发生变化。

同一份活动背板,比较透明、背景模糊与边缘折射。前景文字始终保持清楚。

材质验证台 · 浏览器模拟
+
+

01 · 只有透明

Alpha 混合;没有模糊,也没有折射。

工程任务

只透明会让背景线条穿过控件。

Audio_D2128待执行
RV051 个替换位号
观察:背景文字、竖线保持锐利。
这是不能替代毛玻璃的透明面板。
+

02 · 背景磨砂

Backdrop blur + 饱和度 + 轻染色。

工程任务

颜色透入,细节经过真实模糊。

Audio_D2128待执行
RV051 个替换位号
参考:WinUI Gallery、PythonBlurBehind、PyQt-Frameless-Window。
本列是浏览器内背景模糊;原生系统实测见下方。
+

03 · 低磨砂 + 边缘折射

SVG 位移贴图采样背后内容,弯曲边缘。

工程任务

观察边界处的竖线与文字弯曲。

Audio_D2128待执行
RV051 个替换位号
参考:rdev/liquid-glass-react、shuding/liquid-glass。
本列原创位移贴图;适合浮层,不建议铺满工程表格。
+
可验证:拖动背板,看透射与折射随内容移动。可对比:关闭效果,背景细节立即恢复。边界:网页效果不等于 Windows 原生背景模糊。
+

已验证 Windows 原生 Acrylic / PySide6

直接调用 SetWindowCompositionAttribute。左侧为普通透明,右侧为原生模糊,背板来自独立的实时窗口。
DWM 背景类型的调用成功不代表实际有模糊,需查看实测报告。

查看原生对照实拍8 个 GitHub 项目的实现对比
+

所有背景图形由页面生成,无图片截图纹理;没有远程媒体或 CDN。SVG 滤镜依赖浏览器支持,浏览器不支持时应回退到普通磨砂。本页不操作 CAD 或任务数据。

+ diff --git a/docs/reviews/2026-10-30-ui/material-lab.png b/docs/reviews/2026-10-30-ui/material-lab.png new file mode 100644 index 0000000..34eb62c Binary files /dev/null and b/docs/reviews/2026-10-30-ui/material-lab.png differ diff --git a/docs/reviews/2026-10-30-ui/material-verification.json b/docs/reviews/2026-10-30-ui/material-verification.json new file mode 100644 index 0000000..2f47c25 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/material-verification.json @@ -0,0 +1,37 @@ +{ + "browser": "156.0.8078.73", + "backdrop_support": true, + "svg_displacement_support": true, + "frost_filter": "blur(18px) saturate(1.25)", + "effects_off": "none", + "background_transform": "matrix(1, 0, 0, 1, 65, 0)", + "compact_no_horizontal_overflow": true, + "page_errors": [], + "pixel_comparisons": [ + { + "card": 0, + "effects_on_vs_off_mean_difference": 0.8051708148482342, + "backdrop_moved_difference": 11.28541744993358 + }, + { + "card": 1, + "effects_on_vs_off_mean_difference": 14.270726560144709, + "backdrop_moved_difference": 4.7047532911265195 + }, + { + "card": 2, + "effects_on_vs_off_mean_difference": 10.785156778705165, + "backdrop_moved_difference": 8.87468481339449 + } + ], + "native": { + "sharp_horizontal_edge_energy": 4.490932590169232, + "acrylic_horizontal_edge_energy": 0.7067472915091962, + "edge_suppression_ratio": 6.354368306922327, + "live_backdrop_color_difference": 7.227865290602934, + "os_build": 26200, + "swca_returned_success": true, + "dwm_hresult": 0, + "dwm_observation": "Solid output in this isolated Qt setup after clearing SWCA; HRESULT 0 alone is not evidence of backdrop blur." + } +} diff --git a/docs/reviews/2026-10-30-ui/native-acrylic-a.png b/docs/reviews/2026-10-30-ui/native-acrylic-a.png new file mode 100644 index 0000000..d3927e5 Binary files /dev/null and b/docs/reviews/2026-10-30-ui/native-acrylic-a.png differ diff --git a/docs/reviews/2026-10-30-ui/native-acrylic-b.png b/docs/reviews/2026-10-30-ui/native-acrylic-b.png new file mode 100644 index 0000000..30a81e0 Binary files /dev/null and b/docs/reviews/2026-10-30-ui/native-acrylic-b.png differ diff --git a/docs/reviews/2026-10-30-ui/native-acrylic-live.gif b/docs/reviews/2026-10-30-ui/native-acrylic-live.gif new file mode 100644 index 0000000..43e059d Binary files /dev/null and b/docs/reviews/2026-10-30-ui/native-acrylic-live.gif differ diff --git a/docs/reviews/2026-10-30-ui/native-acrylic-probe.py b/docs/reviews/2026-10-30-ui/native-acrylic-probe.py new file mode 100644 index 0000000..aa8a647 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/native-acrylic-probe.py @@ -0,0 +1,124 @@ +"""Disposable native Windows material probe, not a CAD or production UI change. + +Run with Python + PySide6 + Pillow on Windows. Opens only owned test windows, +captures their shared rectangle, then closes them. No user content is sampled. +""" +import ctypes +from ctypes import wintypes +import json +import os +from pathlib import Path +import sys + +os.environ.pop('QT_QPA_PLATFORM',None) +from PySide6.QtCore import Qt,QTimer,QRectF +from PySide6.QtGui import QColor,QFont,QPainter,QLinearGradient,QPen +from PySide6.QtWidgets import QApplication,QWidget,QVBoxLayout,QLabel +from PIL import ImageGrab + +root=Path(__file__).resolve().parent +user=ctypes.WinDLL('user32',use_last_error=True) +dwm=ctypes.WinDLL('dwmapi',use_last_error=True) +user.SetWindowCompositionAttribute.argtypes=[wintypes.HWND,ctypes.c_void_p] +user.SetWindowCompositionAttribute.restype=wintypes.BOOL +class Point(ctypes.Structure): + _fields_=[('x',ctypes.c_long),('y',ctypes.c_long)] +user.WindowFromPoint.argtypes=[Point] +user.WindowFromPoint.restype=wintypes.HWND +user.GetWindowThreadProcessId.argtypes=[wintypes.HWND,ctypes.POINTER(wintypes.DWORD)] +dwm.DwmSetWindowAttribute.argtypes=[wintypes.HWND,wintypes.DWORD,ctypes.c_void_p,wintypes.DWORD] +dwm.DwmSetWindowAttribute.restype=ctypes.c_long +class Accent(ctypes.Structure): + _fields_=[('state',ctypes.c_int),('flags',ctypes.c_int),('color',ctypes.c_uint32),('animation',ctypes.c_int)] +class Composition(ctypes.Structure): + _fields_=[('attribute',ctypes.c_int),('data',ctypes.c_void_p),('size',ctypes.c_size_t)] +def accent(hwnd,state): + policy=Accent(state,0,0x20F4F4F4,0) + data=Composition(19,ctypes.cast(ctypes.pointer(policy),ctypes.c_void_p),ctypes.sizeof(policy)) + return bool(user.SetWindowCompositionAttribute(hwnd,ctypes.byref(data))) +def backdrop(hwnd,kind): + value=ctypes.c_int(kind) + return int(dwm.DwmSetWindowAttribute(hwnd,38,ctypes.byref(value),ctypes.sizeof(value))) + +app=QApplication([]) +app.setFont(QFont('Segoe UI',11)) +screen=app.primaryScreen().availableGeometry() +width=min(1200,screen.width()-60);height=min(760,screen.height()-60) +origin=(screen.x()+(screen.width()-width)//2,screen.y()+(screen.height()-height)//2) +class Background(QWidget): + phase=0 + def paintEvent(self,event): + p=QPainter(self);p.setRenderHint(QPainter.RenderHint.Antialiasing) + p.fillRect(self.rect(),QColor('#e8edf2')) + for col in range(2): + area=QRectF(30+col*(width/2),110,width/2-60,height-155) + g=QLinearGradient(area.topLeft(),area.bottomRight()) + g.setColorAt(0,QColor('#4c79b6') if self.phase==0 else QColor('#cf8663')) + g.setColorAt(.47,QColor('#aecac9'));g.setColorAt(1,QColor('#d6a39e') if self.phase==0 else QColor('#6a88b1')) + p.fillRect(area,g) + p.setPen(QPen(QColor('#ffffffb0'),2)) + for x in range(int(area.left()),int(area.right()),24):p.drawLine(x,int(area.top()),x,int(area.bottom())) + p.setPen(QColor('#253d57'));p.setFont(QFont('Segoe UI',35,QFont.Weight.Bold)) + p.drawText(area.adjusted(22,90,-10,0),'BACKDROP\nLIVE '+str(self.phase+1)) + p.setPen(QColor('#fff'));p.setFont(QFont('Consolas',13)) + for row in range(6):p.drawText(int(area.left()+22),int(area.top()+260+row*30),'RV05 4100-CA0000-T7 100nF') + p.setPen(QColor('#34475f'));p.setFont(QFont('Segoe UI',18,QFont.Weight.DemiBold)) + p.drawText(30,38,'Native Windows / PySide6 material probe') + p.setFont(QFont('Segoe UI',10));p.setPen(QColor('#6c7f96')) + p.drawText(30,66,'Identical owned background on both sides. No screenshot texture is painted into either foreground window.') + p.drawText(30,height-17,'Captured from actual Windows composition; no CAD, no user project, no foreign window in the capture rectangle.') + +class Pane(QWidget): + def __init__(self,title,subtitle): + super().__init__(None,Qt.WindowType.FramelessWindowHint|Qt.WindowType.Tool|Qt.WindowType.WindowStaysOnTopHint) + self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground) + layout=QVBoxLayout(self);layout.setContentsMargins(24,25,24,24) + titleLabel=QLabel(title);titleLabel.setStyleSheet('background:transparent;color:#213952;font-size:18px;font-weight:600') + hint=QLabel(subtitle);hint.setStyleSheet('background:transparent;color:#46617f;font-size:11px');hint.setWordWrap(True) + layout.addWidget(titleLabel);layout.addWidget(hint);layout.addStretch() + for text in ['Audio_D2128','Selected: RV05','Plan saved / No CAD write']: + label=QLabel(text);label.setStyleSheet('background:rgba(255,255,255,110);color:#314d6c;border:1px solid rgba(255,255,255,170);border-radius:7px;padding:10px;font-size:12px');layout.addWidget(label) + def paintEvent(self,event): + p=QPainter(self);p.fillRect(self.rect(),QColor(255,255,255,45));p.setPen(QPen(QColor(255,255,255,170),1));p.drawRect(self.rect().adjusted(0,0,-1,-1)) + +bg=Background(None,Qt.WindowType.FramelessWindowHint|Qt.WindowType.Tool|Qt.WindowType.WindowStaysOnTopHint) +bg.setGeometry(origin[0],origin[1],width,height) +left=Pane('Transparency only','OS blur disabled. Background lines and letters remain sharp.') +right=Pane('Windows Acrylic','ACCENT_ENABLE_ACRYLICBLURBEHIND. Background is composed by Windows.') +paneW=int(width/2-112);paneH=height-250 +left.setGeometry(origin[0]+56,origin[1]+143,paneW,paneH) +right.setGeometry(origin[0]+int(width/2)+56,origin[1]+143,paneW,paneH) +report={'os_build':sys.getwindowsversion().build,'capture_method':'PIL ImageGrab of owned background window rectangle, not QWidget.grab','uses_baked_backdrop':False,'ownership_grid_checked':True,'artifacts':[]} +bg.show();left.show();right.show();right.raise_();right.activateWindow() +def capture(name): + dpr=app.primaryScreen().devicePixelRatio() + bbox=tuple(round(v*dpr) for v in [origin[0],origin[1],origin[0]+width,origin[1]+height]) + for y in range(bbox[1]+3,bbox[3]-3,24): + for x in range(bbox[0]+3,bbox[2]-3,24): + hwnd=user.WindowFromPoint(Point(x,y));pid=wintypes.DWORD() + user.GetWindowThreadProcessId(hwnd,ctypes.byref(pid)) + if pid.value!=os.getpid(): + left.close();right.close();bg.close();app.quit() + raise RuntimeError('Owned test rectangle is occluded; no capture saved') + im=ImageGrab.grab(bbox=bbox,all_screens=True) + im.save(root/name);report['artifacts'].append({'file':name,'dimensions':im.size,'phase':bg.phase}) +def first(): + report['accent_api_return']=accent(int(right.winId()),4) + report['left_native_handle']=int(left.winId());report['right_native_handle']=int(right.winId()) + QTimer.singleShot(1800,second) +def second(): + capture('native-acrylic-a.png');bg.phase=1;bg.update();QTimer.singleShot(1400,third) +def third(): + capture('native-acrylic-b.png') + report['clear_accent_before_dwm']=accent(int(right.winId()),0) + report['dwm_transient_hresult']=backdrop(int(right.winId()),3) + QTimer.singleShot(1400,fourth) +def fourth(): + capture('native-dwm-acrylic.png') + (root/'native-acrylic-verification.json').write_text(json.dumps(report,ensure_ascii=False,indent=2)+'\n',encoding='utf-8') + left.close();right.close();bg.close();app.quit() +QTimer.singleShot(800,first) +QTimer.singleShot(15000,app.quit) +app.exec() +assert 'dwm_transient_hresult'in report,'Probe did not complete' +print(json.dumps(report,ensure_ascii=True)) diff --git a/docs/reviews/2026-10-30-ui/native-acrylic-verification.json b/docs/reviews/2026-10-30-ui/native-acrylic-verification.json new file mode 100644 index 0000000..8bd323f --- /dev/null +++ b/docs/reviews/2026-10-30-ui/native-acrylic-verification.json @@ -0,0 +1,37 @@ +{ + "os_build": 26200, + "capture_method": "PIL ImageGrab of owned background window rectangle, not QWidget.grab", + "uses_baked_backdrop": false, + "ownership_grid_checked": true, + "artifacts": [ + { + "file": "native-acrylic-a.png", + "dimensions": [ + 1500, + 944 + ], + "phase": 0 + }, + { + "file": "native-acrylic-b.png", + "dimensions": [ + 1500, + 944 + ], + "phase": 1 + }, + { + "file": "native-dwm-acrylic.png", + "dimensions": [ + 1500, + 944 + ], + "phase": 1 + } + ], + "accent_api_return": true, + "left_native_handle": 21301414, + "right_native_handle": 36241716, + "clear_accent_before_dwm": true, + "dwm_transient_hresult": 0 +} diff --git a/docs/reviews/2026-10-30-ui/native-dwm-acrylic.png b/docs/reviews/2026-10-30-ui/native-dwm-acrylic.png new file mode 100644 index 0000000..b6b5b3a Binary files /dev/null and b/docs/reviews/2026-10-30-ui/native-dwm-acrylic.png differ diff --git a/docs/reviews/2026-10-30-ui/polish-acceptance.json b/docs/reviews/2026-10-30-ui/polish-acceptance.json new file mode 100644 index 0000000..0f3698c --- /dev/null +++ b/docs/reviews/2026-10-30-ui/polish-acceptance.json @@ -0,0 +1,25 @@ +{ + "cad_started": false, + "sample_data_only": true, + "ownership_checked": true, + "os_build": 26200, + "native_enabled": true, + "sidebar_backdrop_difference": 21.82010089789873, + "opaque_table_backdrop_difference": 0.0, + "right_header_backdrop_difference": 9.334799022873641, + "right_execution_backdrop_difference": 12.328983050847457, + "visible_search_feedback": true, + "empty_search_feedback": true, + "solid_sidebar_mean": [ + 233.0, + 238.0, + 244.0 + ], + "solid_fallback": true, + "compact_size": [ + 980, + 700 + ], + "compact_table_height": 197, + "options_exposed": true +} diff --git a/docs/reviews/2026-10-30-ui/polish-compact.png b/docs/reviews/2026-10-30-ui/polish-compact.png new file mode 100644 index 0000000..56afb25 Binary files /dev/null and b/docs/reviews/2026-10-30-ui/polish-compact.png differ diff --git a/docs/reviews/2026-10-30-ui/polish-empty.png b/docs/reviews/2026-10-30-ui/polish-empty.png new file mode 100644 index 0000000..d5c2a5c Binary files /dev/null and b/docs/reviews/2026-10-30-ui/polish-empty.png differ diff --git a/docs/reviews/2026-10-30-ui/polish-native.png b/docs/reviews/2026-10-30-ui/polish-native.png new file mode 100644 index 0000000..8b0424e Binary files /dev/null and b/docs/reviews/2026-10-30-ui/polish-native.png differ diff --git a/docs/reviews/2026-10-30-ui/polish-search.png b/docs/reviews/2026-10-30-ui/polish-search.png new file mode 100644 index 0000000..9770c86 Binary files /dev/null and b/docs/reviews/2026-10-30-ui/polish-search.png differ diff --git a/docs/reviews/2026-10-30-ui/preview-verification.json b/docs/reviews/2026-10-30-ui/preview-verification.json new file mode 100644 index 0000000..cdb0c18 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/preview-verification.json @@ -0,0 +1,136 @@ +[ + { + "test": "1440x900-ready", + "ok": true, + "width": 1440, + "height": 900, + "primary": "核对执行范围", + "primaryIcon": "#icon-play" + }, + { + "test": "1440x900-running", + "ok": true, + "width": 1440, + "height": 900, + "primary": "完成当前项后暂停", + "primaryIcon": "#icon-pause" + }, + { + "test": "1440x900-recovery", + "ok": true, + "width": 1440, + "height": 900, + "primary": "核验并恢复", + "primaryIcon": "#icon-refresh" + }, + { + "test": "1440x900-assistant", + "ok": true, + "width": 1440, + "height": 900, + "primary": "核验并恢复", + "primaryIcon": "#icon-refresh" + }, + { + "test": "svg-references", + "ok": true, + "symbols": 32 + }, + { + "test": "row-inspector", + "ok": true + }, + { + "test": "execution-review-before-write", + "ok": true, + "scope": "current" + }, + { + "test": "review-cancel-keeps-ready", + "ok": true + }, + { + "test": "batch-not-ready-blocked", + "ok": true + }, + { + "test": "dirty-plan-blocks-execution", + "ok": true, + "selected": 2 + }, + { + "test": "dirty-plan-cannot-open-review", + "ok": true + }, + { + "test": "filtered-review-retains-hidden-selection", + "ok": true, + "visibleRows": 1, + "reviewCount": 2 + }, + { + "test": "confirm-starts-preparation", + "ok": true, + "phase": "准备环境" + }, + { + "test": "pause-does-not-interrupt-write", + "ok": true + }, + { + "test": "pause-waits-for-save", + "ok": true, + "phase": "保存工程" + }, + { + "test": "save-is-not-verified-success", + "ok": true, + "phase": "重新打开并回读核验" + }, + { + "test": "pause-after-verification", + "ok": true, + "refs": [ + "RV05", + "RV11" + ] + }, + { + "test": "changed-plan-invalidates-confirmation", + "ok": true + }, + { + "test": "assistant-retains-recovery-lock", + "ok": true + }, + { + "test": "recovery-requires-explicit-review", + "ok": true + }, + { + "test": "recovery-goes-to-verification", + "ok": true + }, + { + "test": "completion-follows-verification", + "ok": true + }, + { + "test": "reduce-transparency", + "ok": true + }, + { + "test": "980x700-layout", + "ok": true, + "width": 980, + "height": 700 + }, + { + "test": "980x700-review-layout", + "ok": true + }, + { + "test": "zero-items-blocked", + "ok": true + } +] diff --git a/docs/reviews/2026-10-30-ui/preview.html b/docs/reviews/2026-10-30-ui/preview.html new file mode 100644 index 0000000..5e3afab --- /dev/null +++ b/docs/reviews/2026-10-30-ui/preview.html @@ -0,0 +1,121 @@ + + +DxPartReplace · R4 界面预览 +
界面预览 R4 · 示例数据 · 未连接 CAD
+
DxPartReplaceDxDesigner 器件替换
+
+
+
+

Audio_D2128

待执行
D:\Projects\Audio_D2128\Audio_D2128.prj
+
当前工程6 个位号计划替换1保留5Value:Part Label · 自定义优先
+
1配置计划2核对范围3替换与核验工程操作以保存核验结果为准
计划已保存
+
+
+
显示 6 个位号·替换 1 个,保留 5 个同步 NC 按行设置
+
替换位号图页旧料号新料号原 Value自定义 Value同步 NC
没有匹配位号
当前工程 · 6 个位号
+
本批共用规则
规则提供采集条件与默认值。执行以已保存的位号计划为准;修改规则保留逐行手动覆盖。
启用旧料号新料号自定义 Value同步 NC目标封装
4100-CA0000-T74100-CA0000-T0不写入是未指定
作用范围:本批 3 个工程。修改后需核对并保存各工程的位号计划。
+
本轮尚无执行结果

执行后核对位号、实际回读料号和保存核验状态。
完整日志与轮次证据保留独立入口。

+
当前工程待执行替换 1 个,保留 5 个。
+ +
+
DSH 助手会话范围:当前工程
Audio_D2128

计划检查记录

读取来源:当前工程已保存的位号计划

检查当前工程的替换范围,不执行。
DSH · 计划读取结果

当前页面计划:RV05;其余位号不替换。

当前计划摘要
替换范围1 个替换 · 5 个保留
4100-CA0000-T7 → 4100-CA0000-T0计划已保存
Part Label 写入 Value开启 · 自定义优先
运行前 CAD 核验:未执行。工程写入:未执行。
当前工程:Audio_D2128· 读取计划
助手回复不作为保存核验结果,工程写入仍需确认执行范围。
+
+

核对执行范围

演示流程 · 不会修改工程文件

Audio_D2128D:\Projects\Audio_D2128\Audio_D2128.prj计划已保存
位号旧料号新料号同步 NC
工程1替换1保留5
执行后依次保存工程、重新打开并回读核验。显示过滤不改变执行范围。
diff --git a/docs/reviews/2026-10-30-ui/production-refinement.md b/docs/reviews/2026-10-30-ui/production-refinement.md new file mode 100644 index 0000000..0d996ce --- /dev/null +++ b/docs/reviews/2026-10-30-ui/production-refinement.md @@ -0,0 +1,60 @@ +# R4:透明玻璃材质与执行流程 + +> 正式界面现已继续完成 [按钮、布局与右侧磨砂补全](layout-refinement.md),当前截图与验收数值以该记录为准。 + +> 当前毛玻璃实现结论已更新为 R5,见 [8 个 GitHub 项目调研与原生实测](github-material-research.md)。下文保留 R4 及更早的布局探索,不作为原生材质已落地的证明。 + +2026-10-30。按用户反馈,将 R3 的系统蓝界面调整为低饱和银灰玻璃材质,并重做执行交互。本文件为当前方案说明,替代之前 R1–R3 的视觉参数与执行预览说明。 + +## 材质规范 + +| 层级 | 规则 | 应用 | +| --- | --- | --- | +| 背景 | 低饱和银灰、蓝灰和极轻暖灰色偏;提供透射参照,不使用艳色光斑。 | 应用画布 | +| 导航材质 | 白色半透明表面约 32%–62%,24–32px 背景模糊,轻微饱和度提升,细白边缘。 | 顶栏、任务侧栏、分段导航 | +| 内容材质 | 主区以高不透明度白色隔离背景;表格接近实白,避免料号受背景干扰。 | 工程标题、规则和位号数据 | +| 浮动材质 | 约 45%–85% 白色表面,28–36px 模糊,内侧高光与低强度柔和投影。 | 底部执行栏、位号详情 | +| 确认材质 | 近白的清晰玻璃,42px 模糊,较深而宽的投影;背景遮罩轻度模糊,集中注意力。 | 核对执行范围面板 | +| 操作色 | 主动作使用石墨蓝灰渐变,不再采用大块高饱和蓝色。状态用文字、图标和浅色底共同表达。 | 执行、恢复、保存、运行状态 | +| 图标 | 保留 32 个原创 SVG,20×20 坐标,1.6 单位线宽,继承前景色。 | 导航、表格、工具栏与状态 | + +透明度作用于面板背景,不能对整组控件设置透明度,以免文字一起变淡。玻璃主要承载导航和浮层,不应让每一行数据都参与复杂背景合成。 + +提供“减少透明度”切换;不支持背景模糊时回退到实色。减少动态效果的系统偏好也有对应处理。此方案借鉴 Apple 玻璃材质的层次原则,是 Windows 工程工具的原创原型,不声称实现了 Apple 原生 Liquid Glass 渲染器。 + +## 执行流程 + +1. **配置计划**:修改勾选后显示未保存,必须先保存;没有待替换项时禁用执行。 +2. **核对范围**:主动作改为“核对执行范围”。面板列明工程、完整已选位号、旧新料号、同步 NC 与数量。搜索隐藏的已选项仍会纳入。 +3. **检查批次**:当前工程 / 本批工程作用范围明确。本批有未保存或未配置工程时阻止确认,并指出具体工程,不能偷偷改为部分执行。 +4. **确认执行**:确认时重新比对计划快照;计划变化使确认失效,要求返回重新保存核对。取消或 Escape 关闭不会进入执行态。 +5. **阶段显示**:准备环境 → 替换位号 → 保存工程 → 重新打开并回读核验。展示阶段而不是装饰性的百分比。 +6. **安全暂停**:按钮表达“完成当前项后暂停”;请求后仍保持运行,直至当前项保存并回读核验完成后再显示已暂停。 +7. **完成 / 恢复**:保存结束不直接表示成功。只有演示核验阶段完成才显示演示完成;不确定状态先核验恢复,不能直接重复替换。 + +预览中点击确认后,使用最上方“演示下一阶段”按钮手动推进,清楚区分交互模拟与真实工程执行。各项结果明确标记“演示 / 页面模拟”,没有调用 CAD,也没有写入真实任务数据库。 + +## 当前交付 + +- [交互预览](preview.html):玻璃材质、范围确认、批次拦截、手动阶段推进、安全暂停、恢复和结果视图。 +- [SVG 图标总览](icon-sheet.svg) 与 [独立 SVG 说明](icons/README.md)。 +- [Qt WebEngine 的 26 项交互检查](preview-verification.json)。 +- [Chrome 的 14 项浏览器复核](browser-verification.json)。 + +检查覆盖图标引用、四种状态、行详情、范围确认、批次未就绪、过滤不改变执行范围、未保存拦截、快照变化、阶段顺序、安全暂停、待核验锁、减少透明度及 980×700 布局。 + +Qt 离屏模式的截图在启用多层背景模糊后出现了合成延迟,DOM 检查通过但画面可能落后或为空白。最终 PNG 改由本机 Chrome 的截图接口等待合成后生成,已人工检查主界面与范围确认面板。交付截图是浏览器渲染结果,不是正式 Qt 应用截图。 + +## 正式实施边界 + +正式 PySide6 UI 尚未替换。执行服务、后端状态机和 CAD 逻辑没有改动;以上是交互方案和可操作的页面模拟,不能据此声称生产流程已通过验收。 + +原生实现时,Windows 的真实背景模糊应验证 DWM / 平台合成方案及版本支持,不能只把 CSS 的 backdrop-filter 翻译成 QSS,也不能用全窗口透明度代替。没有可靠合成能力时使用实色材质,优先保证读数与输入响应。 + +正式执行阶段必须来自服务端事件和 CAD 实际保存回读结果。UID 绑定、跨工程草稿、BOM 全量校验、真实批次范围、暂停与强制结束确认、证据和恢复门禁继续使用现有机制。DSH 官方嵌入前端的主题扩展仍需单独验证。 + +![玻璃材质主界面](proposed-ready.png) + +![执行范围确认](proposed-review.png) + +![本批未就绪拦截](proposed-batch-blocked.png) diff --git a/docs/reviews/2026-10-30-ui/proposed-assistant.png b/docs/reviews/2026-10-30-ui/proposed-assistant.png new file mode 100644 index 0000000..a277dc2 Binary files /dev/null and b/docs/reviews/2026-10-30-ui/proposed-assistant.png differ diff --git a/docs/reviews/2026-10-30-ui/proposed-batch-blocked.png b/docs/reviews/2026-10-30-ui/proposed-batch-blocked.png new file mode 100644 index 0000000..9dbe040 Binary files /dev/null and b/docs/reviews/2026-10-30-ui/proposed-batch-blocked.png differ diff --git a/docs/reviews/2026-10-30-ui/proposed-compact.png b/docs/reviews/2026-10-30-ui/proposed-compact.png new file mode 100644 index 0000000..4368328 Binary files /dev/null and b/docs/reviews/2026-10-30-ui/proposed-compact.png differ diff --git a/docs/reviews/2026-10-30-ui/proposed-completed.png b/docs/reviews/2026-10-30-ui/proposed-completed.png new file mode 100644 index 0000000..9d7c817 Binary files /dev/null and b/docs/reviews/2026-10-30-ui/proposed-completed.png differ diff --git a/docs/reviews/2026-10-30-ui/proposed-inspector.png b/docs/reviews/2026-10-30-ui/proposed-inspector.png new file mode 100644 index 0000000..8c9f755 Binary files /dev/null and b/docs/reviews/2026-10-30-ui/proposed-inspector.png differ diff --git a/docs/reviews/2026-10-30-ui/proposed-ready.png b/docs/reviews/2026-10-30-ui/proposed-ready.png new file mode 100644 index 0000000..54c246a Binary files /dev/null and b/docs/reviews/2026-10-30-ui/proposed-ready.png differ diff --git a/docs/reviews/2026-10-30-ui/proposed-recovery.png b/docs/reviews/2026-10-30-ui/proposed-recovery.png new file mode 100644 index 0000000..f85191d Binary files /dev/null and b/docs/reviews/2026-10-30-ui/proposed-recovery.png differ diff --git a/docs/reviews/2026-10-30-ui/proposed-review.png b/docs/reviews/2026-10-30-ui/proposed-review.png new file mode 100644 index 0000000..66d13dd Binary files /dev/null and b/docs/reviews/2026-10-30-ui/proposed-review.png differ diff --git a/docs/reviews/2026-10-30-ui/proposed-running.png b/docs/reviews/2026-10-30-ui/proposed-running.png new file mode 100644 index 0000000..1a8fbee Binary files /dev/null and b/docs/reviews/2026-10-30-ui/proposed-running.png differ diff --git a/docs/reviews/2026-10-30-ui/proposed-solid.png b/docs/reviews/2026-10-30-ui/proposed-solid.png new file mode 100644 index 0000000..db6cff8 Binary files /dev/null and b/docs/reviews/2026-10-30-ui/proposed-solid.png differ diff --git a/docs/reviews/2026-10-30-ui/review.md b/docs/reviews/2026-10-30-ui/review.md new file mode 100644 index 0000000..034ce71 --- /dev/null +++ b/docs/reviews/2026-10-30-ui/review.md @@ -0,0 +1,123 @@ +# 当前 UI 审查与设计建议 + +> 当前毛玻璃实现结论已更新为 R5,见 [8 个 GitHub 项目调研与原生实测](github-material-research.md)。下文保留 R4 及更早的布局探索,不作为原生材质已落地的证明。 + +> 当前方案已按反馈修订为 R4:透明玻璃材质与执行流程,详见 [当前修订说明](production-refinement.md)。本文件保留初版审查依据和开源参考;视觉参数、执行交互与验证数量以 R4 为准,下方预览图已更新。 + +日期:2026-10-30。工作分支:`codex/ui-update`,创建自 `codex/dsh` 的 `be382a1`。 + +本轮交付为代码与真实窗口审查、开源参考调研、可交互概念预览。未修改正式应用 UI 或 CAD 执行逻辑。预览使用示例工程和料号,不连接真实任务、模型或 CAD。 + +## 建议采用的方向 + +采用“暖色工程工作台”:Claude 风格的暖白、陶土色强调、克制的边框与留白,加上工程表格所需的紧凑布局、明确作用范围和可追溯状态。这是对用户所述审美的设计解释,并非 Claude 官方视觉规范。 + +当前问题主要在信息结构和操作层级,单改配色收益有限。先让用户一眼确认“哪个工程、改哪些位号、计划是否保存、现在能做什么”,再精修颜色和组件。 + +## 当前窗口证据 + +截图从现有 `TrialTaskCenterWindow` 实例采集,窗口客户区为 1440 × 900。使用临时数据库和模拟工程目录;位号表的六行是直接填入视图的示例数据,未作为真实计划持久化。因此底部执行统计与示例表行不一致属于采集夹具的限制,**不作为产品缺陷报告**。没有启动 CAD,也没有读取用户工程。 + +![当前位号计划界面](current-plan.png) + +![当前料号规则界面](current-rules.png) + +## 按影响排序的发现 + +以下 P1/P2 为设计改进优先级,不表示已证明存在运行错误。 + +| 优先级 | 观察与证据 | 建议 | 预期改善 | +| --- | --- | --- | --- | +| P1 | 工程名称、路径和状态放在表格下面。`main_window.py` 的 `_build_layout()` 先放 `mapping_tabs`,再在下半区放 `project_summary`。 | 将当前工程名称、状态、可复制完整路径置于主区顶部。 | 核对工程无需上下寻找,减少多工程操作中的范围混淆。 | +| P1 | 当前导航两项等分整条顶部宽度,缺少稳定的产品身份和页面锚点。两个导航按钮使用 Expanding。 | 增加紧凑品牌区,两个局部导航靠左;激活状态采用下划线与字重。 | 导航、任务和操作区域各有明确层级。 | +| P1 | 左侧默认约 240px;任务使用“序号 + 名称 + 换行状态”的同一列表项,长名称被截断。截图可见 `Audio_D2128/Audio_D21…`。 | 定制绘制任务项:工程名、文字状态、批次顺序分层;路径放 tooltip/详情;完整任务标题仍可查询。 | 保留身份信息与状态,避免只见长名称前半截。 | +| P1 | `RunPanel` 在同一横排定义执行、重试、恢复、资源清理、诊断、新一轮、历史、暂停、强制结束,再加日志、布局按钮。现有门禁会隐藏部分按钮,并非所有按钮始终同时出现。 | 把执行区改为状态驱动:常驻状态摘要和 1 个主动作;按状态提供辅助动作;低频维护操作放明确命名的菜单。 | 缩短决策路径,保护小窗口空间。 | +| P1 | 本批料号规则、当前工程的位号数据、当前工程执行和本批执行共同出现;教程明确说明批次执行不受搜索影响。 | 料号规则保留“本批”标签;位号表始终标记“当前工程”;两个执行入口写出范围和数量;确认框列明真实任务清单。 | 视觉与实际作用范围一致,不能把筛选结果误解为执行清单。 | +| P2 | Value 策略与“关闭时归档清空列表”两个长复选框位于主编辑区最上方。 | Value 保留短摘要和工程设置入口;关闭归档移到应用设置,并保留原来默认关闭及安全任务筛选语义。 | 主工作区优先显示当前工程与位号。 | +| P2 | 搜索由输入框、查找、下一条、清空四个常驻控件组成;左侧还有搜索、排序、回收站与多行管理按钮。 | 保留回车搜索/下一条能力,提供清空图标;低频管理进入菜单。右侧批量编辑仅在选中行时展开。 | 保留能力,同时减少工具条密度。 | +| P2 | 表头、列表、输入框、按钮普遍有较强蓝灰边框;大面积区域字体统一为 13px,层级较弱。 | 使用一套颜色与字号 token;靠字重、间距和分隔线划分区域;将强色集中于主动作、编辑变化与状态。 | 视觉更安静,状态更容易扫读。 | +| P2 | `target_table.py` 默认十列,料号、Value、图页和多个复选列并列;实际窗口可能出现长编码换行。 | 料号、位号使用等宽字体且不折行;支持列宽持久化与横向滚动;原理图/UID/封装提供详情入口。完整身份字段不能从数据模型中删除。 | 长编码便于比对,保留工程身份与排错能力。 | + +## 检索到的开源参考 + +使用 GitHub 搜索 API 查找 Qt Fluent、桌面数据库工具、AppFlowy 等方向,再获取以下仓库元数据和 README 核对描述、界面示例入口与许可说明。检索日期为 2026-10-30。下表为参考模式的建议,不是对这些项目的现场可用性测试。 + +| 项目与来源 | 可借鉴的部分 | 与本项目的关系 | +| --- | --- | --- | +| [PyQt-Fluent-Widgets](https://github.com/zhiyiYo/PyQt-Fluent-Widgets) · [官方组件文档](https://qfluentwidgets.com/) | 桌面导航、任务卡片、状态反馈、组件一致性。 | 与现有 PySide6 最接近,可研究 QSS、delegate 和控件层次的落地方式。仓库说明为 GPLv3 / 商业许可;本轮未引入其依赖或代码。 | +| [Beekeeper Studio](https://github.com/beekeeper-studio/beekeeper-studio) | 侧栏定位对象、主区承载密集表格、标签区分工作上下文。 | 重点参考“数据工作台”而非普通宣传页。README 区分 GPLv3 社区代码与商业功能。 | +| [AppFlowy](https://github.com/AppFlowy-IO/AppFlowy) | 工作空间侧栏、页面标题层级、任务/数据库视图,以及 AI 与项目上下文的结合。 | 借鉴工作台信息结构;Flutter 组件不直接适用于 Qt。AGPLv3。 | +| [shadcn/ui](https://github.com/shadcn-ui/ui) · [Data Table](https://ui.shadcn.com/docs/components/data-table) | 工具条、数据表、徽标、菜单、对话框的主次关系与组件细节。 | 是网页组件参考,不作为把 PySide6 重写为 React 的理由。MIT。 | + +## 三种可选路线 + +| 路线 | 设计与改动 | 优势 | 代价 / 局限 | +| --- | --- | --- | --- | +| **A · 暖色工程工作台(推荐,已做预览)** | 暖白与陶土色;重排工程标题、侧栏、表格和状态执行区;继续使用 PySide6。 | 符合所需审美,能直接解决身份与范围层级问题,业务流程保持可追溯。 | 需要调整 widget 布局、任务绘制和若干菜单,不能只换一份 QSS。 | +| B · Windows Fluent 原生感 | 中性色、蓝色强调、原生导航和命令区;可先自行实现。 | 熟悉、适合 Windows 工程工具,与当前风格距离较小。 | Claude 式暖感较弱;若采用第三方 Fluent 控件,需要额外依赖与许可评估。 | +| C · AI 优先的双栏工作台 | 助手与任务表长期并排,并强化对话中的计划确认卡。 | 对自然语言建任务、诊断异常更直接。 | 小窗口表格宽度不足;依赖官方 DSH 前端扩展能力,改造范围最大。 | + +推荐先实施 A;DSH 保持独立导航页,按需展示上下文。无需因为 UI 参考来自 Web 就替换现有桌面框架。 + +## 可交互预览 + +打开同目录 [preview.html](preview.html)。顶部浅色栏可切换四种状态;还可切换规则/位号/结果标签、过滤位号、过滤任务、修改勾选观察保存与执行门禁。 + +这是一份设计原型。菜单展示提示,不执行业务;勾选修改后的计数仍为初始示例值,界面提示说明这一点;保存会恢复初始样例。它不替代真实状态机与 UI 回归测试。 + +### 准备执行 + +![推荐方案:准备执行](proposed-ready.png) + +顶部先展示工程身份与数量,主区集中处理位号,底部只保留相关动作。保留 BOM 模板、导入、采集与保存的入口,说明按工程执行与按批次执行的差别。 + +### 执行中 + +![推荐方案:执行中](proposed-running.png) + +编辑和批次启动锁定;底部显示当前位号与实际阶段,主动作变成“完成当前项后暂停”。示意进度条不代表真实运行比例,也不推断已保存成功。正式实现应只展示后端能够确认的阶段与计数。 + +### 待核验 + +![推荐方案:待核验](proposed-recovery.png) + +顶部状态和警告文字共同表达“未确认”,编辑保持锁定,主动作明确指向“核验并恢复”,旁边保留诊断包。强制结束放在运行态的“诊断与异常操作”菜单里,仍需原有确认和恢复门禁。 + +### DSH 助手 + +![推荐方案:DSH 助手](proposed-assistant.png) + +保持任务侧栏,用右侧上下文解释“当前哪个工程、计划是什么、本次是否授权写入”。聊天区把计划摘要与实际执行结果区分开,避免模型文字等同于已核验事实。 + +**实现边界:** 当前 DSH 是 `NativeHarnessView` 嵌入的官方 Harness Web 前端,并不是本项目自有聊天页面。此图为期望的交互与视觉方向,未验证官方前端具备相应主题、卡片或侧栏扩展点。近期可以先统一 Qt 外壳与加载/错误态;聊天区深度改造应先验证官方扩展能力和升级兼容性,不能把效果图当作现成实现。 + +## 建议的视觉规格 + +| 项目 | 建议 | +| --- | --- | +| 页面 / 侧栏 / 内容面 | `#FAF9F6` / `#F0EEE7` / `#FFFEFA` | +| 主文字 / 次文字 / 分隔线 | `#302F2A` / `#747169` / `#E4E1D8` | +| 主动作 / 选中浅底 | `#A74E34` / `#F1E4DA` | +| 成功 / 警告 / 错误文字 | `#426648` / `#805916` / `#9C3D35`;始终配合文字或符号表达状态 | +| 字体 | 中文使用微软雅黑 UI 等系统无衬线;料号、位号使用 Consolas;只在助手引导标题考虑衬线感 | +| 尺寸 | 正文 13–14px,主标题 24–26px,默认表格行高 36–40px,可提供紧凑模式;原型展示行高 44px | +| 形状 | 控件圆角 6–8px,弱化边框;选中任务允许非常轻的阴影,避免大量卡片叠加 | + +## 正式改造的建议顺序 + +1. **工程标题与视觉 token**:`ui/main_window.py`、`project_summary.py`、`styles.py`。保持窗口、对象名和服务接口兼容。 +2. **任务导航与操作层级**:`task_list.py` 定制 delegate;完整任务名与 tooltip 保留;区分真实顺序与显示排序。不要用每项大量子 widget 破坏现有列表性能。 +3. **状态执行区**:`run_panel.py` 配合 `execution_state.py` 与现有门禁,收拢低频维护操作;不能以菜单可见性替代后端权限/状态检查。 +4. **表格工具条与范围标注**:`project_plan.py`、`target_table.py`、`mapping_table.py`;保留代理排序/过滤、UID 绑定、隐藏行不被误改、跨任务草稿等现有约束。 +5. **DSH 外壳统一**:先处理 `dsh_native.py` 的启动、加载、失败与返回任务体验,深度聊天改造另作能力验证。 + +正式实施后应运行已有 `tests/ui` 与 `tests/v1_1` 中相关 UI/状态用例,并截图核对空任务、未保存草稿、BOM 校验失败、运行、安全暂停、待核验、完成与回收站。至少覆盖 980×700、1280×880 和 1440×900,并实测 Windows 125%/150% 缩放;预览截图不代表已经完成这些桌面验收。 + +## 本轮验证记录 + +- 现有窗口成功创建并采集规则页、位号页;仅使用临时数据。 +- 自包含 HTML 经 Qt WebEngine 渲染,四种状态各生成一张 1440×900 PNG;页面无外部字体、CDN 或框架依赖。 +- 检查四种状态的页面根节点均无横向或纵向溢出;表格容器允许自身滚动。 +- 在 1100×800 检查页面无横向溢出;位号搜索 `RV05` 仅保留 1 行;修改勾选禁用执行;恢复示例计划后重新允许执行。 +- 原始结果见 [preview-verification.json](preview-verification.json)。未改动生产代码,因此本轮未运行 CAD 或全量业务测试。 +- 工作期间工作区出现并行的 DSH 生命周期相关修改。本轮交付文件集中在此审查目录,不包含那些源代码改动,也没有替它们做验证或提交。 diff --git a/docs/superpowers/plans/2026-10-30-native-acrylic-ui.md b/docs/superpowers/plans/2026-10-30-native-acrylic-ui.md new file mode 100644 index 0000000..5df120e --- /dev/null +++ b/docs/superpowers/plans/2026-10-30-native-acrylic-ui.md @@ -0,0 +1,13 @@ +# Native Acrylic UI Implementation Plan + +**Goal:** Apply the selected frosted backdrop material to the real PySide6 task center, with SVG controls and readable data surfaces. + +**Approved design:** Second material in `docs/reviews/2026-10-30-ui/material-lab.html`, approved by the user. Native Acrylic for window chrome, opaque data tables, no refraction. Keep existing execution/recovery behavior. + +**Scope:** Existing UI presentation plus a small Windows composition adapter. Keep the native system frame. Preserve concurrent DSH lifecycle changes and stable automation object names. No CAD/service changes, external dependencies, or global Windows setting changes. + +- [x] Add failing tests for material policy, API rejection, opaque fallback, toggling, native handle changes and window integration. +- [x] Implement a small ctypes native Acrylic adapter and Qt controller. Respect high contrast, Windows transparency preference, remote sessions, unsupported platforms and explicit reduced transparency. Recheck policy while the window is open. +- [x] Bring original SVG assets into packaged application assets and add reusable icon rendering. Rework chrome, project identity placement and frosted/opaque stylesheet surfaces without changing execution state gates. +- [x] Run material tests, relevant UI/state tests and native window acceptance. Capture the actual application above owned changing background content; verify blur visually and through image differences. Check solid fallback and 980×700 layout. +- [x] Document exact verification and remaining platform limits. Keep unverified claims out of the completion report. diff --git a/docs/superpowers/plans/2026-10-30-workspace-layout-refinement.md b/docs/superpowers/plans/2026-10-30-workspace-layout-refinement.md new file mode 100644 index 0000000..0bbf347 --- /dev/null +++ b/docs/superpowers/plans/2026-10-30-workspace-layout-refinement.md @@ -0,0 +1,10 @@ +# Workspace layout and right-side Acrylic refinement + +User correction: implement the designed button hierarchy and layout in the real Qt window, including right-side chrome. Existing native Acrylic and SVG assets are already approved. Preserve real execution, recovery, draft and BOM gates. + +- [x] Test live command-menu gates and new layout geometry. +- [x] Replace task management grid with header new-task action and a management menu; draw task title/status/order with a delegate. +- [x] Consolidate plan search and import/collect tools, move save into the table footer, group execution maintenance commands. +- [x] Remove the opaque workspace/pane covering right-side Acrylic; keep table rows and dialogs readable. +- [x] Run relevant regressions and real-window captures. Verify both left and right chrome react to changing background while table data stays opaque. +- [x] Open the updated app after verification, gracefully retaining any existing running work. diff --git a/docs/user/frosted-ui.md b/docs/user/frosted-ui.md new file mode 100644 index 0000000..ae95345 --- /dev/null +++ b/docs/user/frosted-ui.md @@ -0,0 +1,15 @@ +# 磨砂界面 + +任务中心现使用 Windows 原生 Acrylic 处理顶栏与任务侧栏的背景模糊。位号、料号规则、日志和对话框的数据区域保持实色,避免背景干扰读数。界面中的 SVG 图标随源代码一起打包,不需要联网加载。 + +右上角 **减少透明度** 可切换为实色外壳,该选择保存在当前数据目录的布局设置中。系统关闭透明效果、启用高对比度、远程会话、非 Windows 或不支持的环境也会使用实色。程序只读取系统偏好,不修改 Windows 设置。 + +工程名称与完整路径现在位于表格上方。点击 **工程设置** 可展开原有 Value 策略与关闭归档选项。执行、暂停、核验恢复、BOM 校验及任务数据规则继续使用原有机制。 + +本次修改的是源代码运行的正式 PySide6 窗口,不是网页嵌入的演示界面。旧版便携 EXE 不会自动获得此界面;需要重新构建便携包。可在项目已安装依赖的 Python 3.12 环境中使用已安装的 `dx-part-replace-gui` 入口启动。 + +本机验证环境为 Windows 11 build 26200、125% 缩放。Windows 10、其他显卡/驱动、多显示器、远程会话和打包后的原生效果仍需要相应环境验收,不能只根据系统接口返回成功判断视觉效果。 + +任务侧栏顶部提供新建,底部 **任务管理** 菜单提供编辑、恢复、顺序调整与删除。排序从任务数量旁的图标菜单选择。位号工具栏合并搜索、BOM 导入与采集;保存计划位于表格底部。执行区右上角的更多菜单保留诊断、资源清理、轮次证据、布局与强制结束入口,动作仍受原有状态检查与确认控制。 + +搜索使用 `Ctrl+F`,`F3` 跳至下一条,`Ctrl+S` 保存位号计划。搜索会显示匹配数量,清空后恢复全部行;过滤不改变真实执行范围。蓝色行选中用于批量填写,替换复选框才决定计划中的替换项。保存前会提交正在编辑的单元格,按 `Esc` 可取消当前单元格编辑。 diff --git a/src/dx_productivity/trial_task_center/assets/ui-arrow-up.svg b/src/dx_productivity/trial_task_center/assets/ui-arrow-up.svg new file mode 100644 index 0000000..4c8dff1 --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-arrow-up.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-chat.svg b/src/dx_productivity/trial_task_center/assets/ui-chat.svg new file mode 100644 index 0000000..d23aa05 --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-chat.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-check-circle.svg b/src/dx_productivity/trial_task_center/assets/ui-check-circle.svg new file mode 100644 index 0000000..97ed6c5 --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-check-circle.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-check.svg b/src/dx_productivity/trial_task_center/assets/ui-check.svg new file mode 100644 index 0000000..8bd23ec --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-check.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-chevron.svg b/src/dx_productivity/trial_task_center/assets/ui-chevron.svg new file mode 100644 index 0000000..05fd299 --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-chevron.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-circuit.svg b/src/dx_productivity/trial_task_center/assets/ui-circuit.svg new file mode 100644 index 0000000..bf4c1b7 --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-circuit.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-clock.svg b/src/dx_productivity/trial_task_center/assets/ui-clock.svg new file mode 100644 index 0000000..e9d2683 --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-clock.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-close.svg b/src/dx_productivity/trial_task_center/assets/ui-close.svg new file mode 100644 index 0000000..f3b08d5 --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-close.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-columns.svg b/src/dx_productivity/trial_task_center/assets/ui-columns.svg new file mode 100644 index 0000000..ffaf0ea --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-columns.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-copy.svg b/src/dx_productivity/trial_task_center/assets/ui-copy.svg new file mode 100644 index 0000000..da41446 --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-copy.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-download.svg b/src/dx_productivity/trial_task_center/assets/ui-download.svg new file mode 100644 index 0000000..3b19f38 --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-download.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-folder.svg b/src/dx_productivity/trial_task_center/assets/ui-folder.svg new file mode 100644 index 0000000..94c86aa --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-folder.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-grid.svg b/src/dx_productivity/trial_task_center/assets/ui-grid.svg new file mode 100644 index 0000000..1e868b8 --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-grid.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-info.svg b/src/dx_productivity/trial_task_center/assets/ui-info.svg new file mode 100644 index 0000000..beddf6f --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-info.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-log.svg b/src/dx_productivity/trial_task_center/assets/ui-log.svg new file mode 100644 index 0000000..b979f01 --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-log.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-more.svg b/src/dx_productivity/trial_task_center/assets/ui-more.svg new file mode 100644 index 0000000..62fbcc3 --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-more.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-pause.svg b/src/dx_productivity/trial_task_center/assets/ui-pause.svg new file mode 100644 index 0000000..2dead18 --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-pause.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-play.svg b/src/dx_productivity/trial_task_center/assets/ui-play.svg new file mode 100644 index 0000000..fabe332 --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-play.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-plus.svg b/src/dx_productivity/trial_task_center/assets/ui-plus.svg new file mode 100644 index 0000000..3bc1f9d --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-plus.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-project.svg b/src/dx_productivity/trial_task_center/assets/ui-project.svg new file mode 100644 index 0000000..fea1423 --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-project.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-refresh.svg b/src/dx_productivity/trial_task_center/assets/ui-refresh.svg new file mode 100644 index 0000000..8e81330 --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-refresh.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-rules.svg b/src/dx_productivity/trial_task_center/assets/ui-rules.svg new file mode 100644 index 0000000..5d06bc3 --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-rules.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-save.svg b/src/dx_productivity/trial_task_center/assets/ui-save.svg new file mode 100644 index 0000000..dbe32e3 --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-save.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-scan.svg b/src/dx_productivity/trial_task_center/assets/ui-scan.svg new file mode 100644 index 0000000..1531a24 --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-scan.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-search.svg b/src/dx_productivity/trial_task_center/assets/ui-search.svg new file mode 100644 index 0000000..7bfa287 --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-search.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-sidebar.svg b/src/dx_productivity/trial_task_center/assets/ui-sidebar.svg new file mode 100644 index 0000000..6321435 --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-sidebar.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-sliders.svg b/src/dx_productivity/trial_task_center/assets/ui-sliders.svg new file mode 100644 index 0000000..41062b7 --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-sliders.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-sort.svg b/src/dx_productivity/trial_task_center/assets/ui-sort.svg new file mode 100644 index 0000000..cdf05fc --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-sort.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-table.svg b/src/dx_productivity/trial_task_center/assets/ui-table.svg new file mode 100644 index 0000000..ad4740f --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-table.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-trash.svg b/src/dx_productivity/trial_task_center/assets/ui-trash.svg new file mode 100644 index 0000000..2d73a2c --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-trash.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-upload.svg b/src/dx_productivity/trial_task_center/assets/ui-upload.svg new file mode 100644 index 0000000..56920db --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-upload.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/assets/ui-warning.svg b/src/dx_productivity/trial_task_center/assets/ui-warning.svg new file mode 100644 index 0000000..728eb99 --- /dev/null +++ b/src/dx_productivity/trial_task_center/assets/ui-warning.svg @@ -0,0 +1 @@ + diff --git a/src/dx_productivity/trial_task_center/ui/command_menu.py b/src/dx_productivity/trial_task_center/ui/command_menu.py new file mode 100644 index 0000000..ec0a56d --- /dev/null +++ b/src/dx_productivity/trial_task_center/ui/command_menu.py @@ -0,0 +1,32 @@ +"""Menu presentation for existing buttons, preserving their live business gates.""" +from PySide6.QtWidgets import QMenu,QWidget + + +class CommandMenu(QMenu): + def __init__(self,parent=None): + super().__init__(parent) + self.storage=QWidget(parent) + self.storage.setObjectName('menuCommandStorage') + self.storage.hide() + self._commands=[] + self.aboutToShow.connect(self.sync) + + def add_button(self,button): + button.setParent(self.storage) + # Only the parent is hidden. Explicit visibility remains the state gate. + button.show() + action=self.addAction(button.text()) + def invoke(): + if button.isEnabled() and not button.isHidden(): + button.click() + action.triggered.connect(invoke) + self._commands.append((action,button)) + return action + + def sync(self): + for action,button in self._commands: + action.setText(button.text()) + action.setIcon(button.icon()) + action.setEnabled(button.isEnabled()) + action.setVisible(not button.isHidden()) + action.setToolTip(button.toolTip()) diff --git a/src/dx_productivity/trial_task_center/ui/icons.py b/src/dx_productivity/trial_task_center/ui/icons.py new file mode 100644 index 0000000..52d9a32 --- /dev/null +++ b/src/dx_productivity/trial_task_center/ui/icons.py @@ -0,0 +1,64 @@ +"""Original SVG icons rendered in consistent normal, disabled and primary colors.""" +from functools import lru_cache +from pathlib import Path + +from PySide6.QtCore import QByteArray, QRectF, Qt,QSize +from PySide6.QtGui import QIcon, QPainter, QPixmap +from PySide6.QtSvg import QSvgRenderer +from PySide6.QtWidgets import QAbstractButton, QLineEdit, QToolButton + +ASSETS = Path(__file__).resolve().parents[1] / 'assets' + + +@lru_cache(maxsize=128) +def icon(name: str, primary: bool = False) -> QIcon: + source = (ASSETS / f'ui-{name}.svg').read_text(encoding='utf-8') + result = QIcon() + for mode, color in ((QIcon.Mode.Normal, '#ffffff' if primary else '#61758e'), + (QIcon.Mode.Disabled, '#a7b0bd')): + renderer = QSvgRenderer(QByteArray(source.replace('currentColor', color).encode())) + for size in (16, 20, 24, 32, 40, 48): + pixmap = QPixmap(size, size) + pixmap.fill(Qt.GlobalColor.transparent) + painter = QPainter(pixmap) + renderer.render(painter, QRectF(0, 0, size, size)) + painter.end() + result.addPixmap(pixmap, mode) + return result + + +BUTTON_ICONS = { + 'task_center_navigation': 'grid', 'dsh_navigation': 'chat', + 'newTaskButton': 'plus', 'editTaskButton': 'sliders', 'deleteTaskButton': 'trash', + 'restoreTaskButton': 'refresh', 'taskRecycleBin': 'trash', + 'moveTaskUp': 'arrow-up', 'moveTaskDown': 'sort', 'executeProjectTasks': 'play', + 'addMappingButton': 'plus', 'editMappingButton': 'sliders', 'deleteMappingButton': 'trash', + 'collectTargetInventory': 'scan', 'saveTargetPlan': 'save', + 'exportBomTemplate': 'download', 'importBomPlan': 'upload', + 'importTargetPlan': 'upload', 'exportTargetPlan': 'download', + 'quickRunButton': 'play', 'stopQueueButton': 'pause', 'forceStopButton': 'warning', + 'retryTaskItems': 'refresh', 'recoverQuickRunButton': 'refresh', + 'cleanupBatchResources': 'refresh', 'exportDiagnosticBundle': 'download', + 'startNewRoundButton': 'plus', 'roundHistoryButton': 'folder', + 'toggleLogButton': 'log', 'resetLayoutButton': 'columns', 'refreshBoundProject': 'refresh', + 'findTargets': 'search', 'cancelInventoryOperation': 'close', +} + + +def apply_icons(window): + for button in window.findChildren(QAbstractButton): + name = BUTTON_ICONS.get(button.objectName()) + if name: + button.setIconSize(QSize(16,16)) + button.setIcon(icon(name, primary=button.objectName() in { + 'quickRunButton','recoverQuickRunButton','retryTaskItems','startNewRoundButton','stopQueueButton'})) + if isinstance(button, QToolButton): + if button.defaultAction() is not None: + button.defaultAction().setIcon(icon(name)) + button.setToolTip(button.text()) + if button.objectName() == 'toggleLogButton': + button.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon) + for name in ('taskSearch', 'findTargetText'): + edit = window.findChild(QLineEdit, name) + if edit: + edit.addAction(icon('search'), QLineEdit.ActionPosition.LeadingPosition) diff --git a/src/dx_productivity/trial_task_center/ui/main_window.py b/src/dx_productivity/trial_task_center/ui/main_window.py index 041e020..cb5a9de 100644 --- a/src/dx_productivity/trial_task_center/ui/main_window.py +++ b/src/dx_productivity/trial_task_center/ui/main_window.py @@ -19,6 +19,8 @@ from .project_plan import DirectoryTaskDialog, ProjectPlanPanel from .project_summary import ProjectSummary from .run_panel import RunPanel from .styles import APP_STYLESHEET +from .material import AcrylicController, MaterialMainWindow +from .icons import apply_icons, icon from .task_list import TaskList from .workers import ServiceWorker from .queries import LatestQuery @@ -29,9 +31,10 @@ from ...dsh.service_adapter import DshServiceAdapter from ...dsh.snapshot import TaskSnapshot from ...dsh.supervisor import DshSupervisor -class TrialTaskCenterWindow(QMainWindow): +class TrialTaskCenterWindow(MaterialMainWindow): def __init__(self, service, directory_picker=None, quick_run_confirmer=None, close_plan_confirmer=None): super().__init__() + self._material = AcrylicController(self) self.service = service self._dsh = DshSupervisor(DshServiceAdapter(service).execute) self._dsh_view = None @@ -51,6 +54,9 @@ class TrialTaskCenterWindow(QMainWindow): navigation_layout = QHBoxLayout(navigation) navigation_layout.setContentsMargins(12, 6, 12, 6) navigation_layout.setSpacing(8) + brand = QLabel('DxPartReplace', objectName='applicationBrand') + navigation_layout.addWidget(brand) + navigation_layout.addSpacing(24) for name, action in (('task_center_navigation', self.task_center_action), ('dsh_navigation', self.dsh_action)): action.setCheckable(True) self._navigation_actions.addAction(action) @@ -58,10 +64,18 @@ class TrialTaskCenterWindow(QMainWindow): button = QToolButton(navigation) button.setObjectName(name) button.setDefaultAction(action) - button.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed) - navigation_layout.addWidget(button, 1) + button.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon) + button.setSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Fixed) + navigation_layout.addWidget(button) setattr(self, name, button) self.task_center_action.setChecked(True) + navigation_layout.addStretch() + self.reduced_transparency_button = QToolButton(objectName='reduceTransparency') + self.reduced_transparency_button.setText('减少透明度') + self.reduced_transparency_button.setCheckable(True) + self.reduced_transparency_button.setIcon(icon('sliders')) + self.reduced_transparency_button.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon) + navigation_layout.addWidget(self.reduced_transparency_button) self.setMenuWidget(navigation) self._close_plan_confirmer = close_plan_confirmer or self._confirm_close_plans self._close_pending = False @@ -139,6 +153,11 @@ class TrialTaskCenterWindow(QMainWindow): self.archive_on_close_check.setToolTip('默认关闭。仅归档安全任务,保留计划、日志和文件;待核验或资源未释放的任务保留在当前列表。') self._build_layout() self._layout_settings = QSettings(str(service.layout_settings_path), QSettings.Format.IniFormat) + self.reduced_transparency_button.setChecked(self._layout_settings.value( + 'appearance/reduced_transparency', False, type=bool)) + self._material.set_reduced_transparency(self.reduced_transparency_button.isChecked()) + self.reduced_transparency_button.toggled.connect(self._set_reduced_transparency) + apply_icons(self) self.archive_on_close_check.setChecked(self._layout_settings.value( 'tasks/archive_on_close', False, type=bool)) self.archive_on_close_check.toggled.connect(self._set_archive_on_close) @@ -163,12 +182,13 @@ class TrialTaskCenterWindow(QMainWindow): return self._context_phase is ContextReadPhase.LOADING def _build_layout(self): - rule_page = QWidget() + rule_page = QWidget(objectName='rulePage') rules_layout = QVBoxLayout(rule_page) rules_layout.setContentsMargins(0, 0, 0, 0) rules_help = QLabel('规则提供采集条件和位号默认值;位号计划模式实际执行已保存的每行计划。' '修改默认值仅更新仍等于旧默认值的字段,保留手动覆盖和替换勾选。') rules_help.setWordWrap(True) + rules_help.setObjectName('ruleHelp') rules_layout.addWidget(rules_help) rules_layout.addWidget(self.mapping_table, 1) commands = QHBoxLayout() @@ -180,29 +200,45 @@ class TrialTaskCenterWindow(QMainWindow): self.mapping_tabs = QTabWidget(objectName='batchPlanTabs') self.mapping_tabs.addTab(rule_page, '本批料号规则') self.mapping_tabs.addTab(self.plan_panel, '本批位号计划') + self.mapping_tabs.setCurrentIndex(1) self.detail_splitter = QSplitter(Qt.Orientation.Vertical) self.detail_splitter.setChildrenCollapsible(False) self.detail_splitter.addWidget(self.mapping_tabs) - execution_area = QWidget() + execution_area = QWidget(objectName='executionSurface') execution_layout = QVBoxLayout(execution_area) execution_layout.setContentsMargins(0, 0, 0, 0) - execution_layout.addWidget(self.project_summary) execution_layout.addWidget(self.run_panel) self.detail_splitter.addWidget(execution_area) self.detail_splitter.setStretchFactor(0, 5) self.detail_splitter.setStretchFactor(1, 1) - details = QWidget() + details = QWidget(objectName='workspace') details_layout = QVBoxLayout(details) - details_layout.setContentsMargins(0, 0, 0, 0) - details_layout.addWidget(self.run_panel.copy_value_check) - details_layout.addWidget(self.archive_on_close_check) + details_layout.setContentsMargins(16, 14, 16, 10) + details_layout.setSpacing(12) + details_layout.addWidget(self.project_summary) + self.project_options_button = QToolButton(objectName='projectOptionsToggle') + self.project_options_button.setText('工程设置') + self.project_options_button.setToolTip('Value 策略与关闭归档选项') + self.project_options_button.setProperty('appearance','quiet') + self.project_options_button.setIcon(icon('sliders')) + self.project_options_button.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon) + self.project_options_button.setCheckable(True) + self.project_summary.heading_layout.insertWidget(1, self.project_options_button) + options = QWidget(objectName='projectOptions') + options_layout = QVBoxLayout(options) + options_layout.setContentsMargins(8, 4, 8, 4) + options_layout.addWidget(self.run_panel.copy_value_check) + options_layout.addWidget(self.archive_on_close_check) + options.hide() + self.project_options_button.toggled.connect(options.setVisible) + details_layout.addWidget(options) details_layout.addWidget(self.detail_splitter, 1) self.workspace_splitter = QSplitter(Qt.Orientation.Horizontal) self.workspace_splitter.setChildrenCollapsible(False) self.workspace_splitter.addWidget(self.task_list) self.workspace_splitter.addWidget(details) self.workspace_splitter.setStretchFactor(1, 1) - container = QWidget() + container = QWidget(objectName='taskCenterSurface') layout = QHBoxLayout(container) layout.setContentsMargins(8, 8, 8, 8) layout.addWidget(self.workspace_splitter) @@ -219,7 +255,7 @@ class TrialTaskCenterWindow(QMainWindow): def _reset_layout(self): self.workspace_splitter.setSizes((240, 1040)) - self.detail_splitter.setSizes((590, 170)) + self.detail_splitter.setSizes((650, 110)) self.run_panel.toggle_log_button.setChecked(False) def _confirm_close_plans(self): @@ -237,6 +273,11 @@ class TrialTaskCenterWindow(QMainWindow): self._layout_settings.setValue('tasks/archive_on_close', bool(enabled)) self._layout_settings.sync() + def _set_reduced_transparency(self, enabled): + self._layout_settings.setValue('appearance/reduced_transparency', bool(enabled)) + self._layout_settings.sync() + self._material.set_reduced_transparency(enabled) + def _session_archived(self, report): self._close_archived = True self._close_pending = True @@ -375,7 +416,8 @@ class TrialTaskCenterWindow(QMainWindow): resources_pending = bool(self.service.pending_batch_resources()) self.run_panel.cleanup_resources_button.setVisible(resources_pending) self.run_panel.cleanup_resources_button.setEnabled(resources_pending and not busy) - state = execution_state(self._context, busy=busy, dirty=self.plan_panel.table.dirty) + state = execution_state(self._context, busy=busy, + dirty=self.plan_panel.table.dirty or self.plan_panel.table.has_pending_editor()) group_unsaved = self._group_has_unsaved_plans() if state.editable or state.new_round else False context = self._context self.run_panel.quick_run_button.setText(state.execute_text) @@ -394,6 +436,9 @@ class TrialTaskCenterWindow(QMainWindow): self.run_panel.force_stop_button.setVisible(self._batch_stop is not None) self.run_panel.force_stop_button.setEnabled(bool(self._batch_stop and not self._batch_stop.force_event.is_set())) + self.run_panel.quick_run_button.setVisible(self._batch_stop is None + and not bool(context and (context.interrupted or context.phase=='retry' + or context.task.status is TaskStatus.COMPLETED))) self.run_panel.diagnostics_button.setEnabled(self._diagnostic_worker is None) self.run_panel.copy_value_check.setEnabled(state.editable) rule_editable = state.editable and not group_unsaved @@ -968,7 +1013,8 @@ class TrialTaskCenterWindow(QMainWindow): def _run_async(self, operation, callback, button=None, *, expected_task_id=None, retain_result=False, operation_area='', **_unused): - if self._workers or self._closed or (self._dsh_task_creation is not None and self._dsh_task_creation.dialog is not None): + if (self._workers or self._closed or (self._dsh_task_creation is not None and self._dsh_task_creation.dialog is not None) + ): return worker = ServiceWorker(operation) self._workers.add(worker) diff --git a/src/dx_productivity/trial_task_center/ui/mapping_table.py b/src/dx_productivity/trial_task_center/ui/mapping_table.py index dfcf96c..2202800 100644 --- a/src/dx_productivity/trial_task_center/ui/mapping_table.py +++ b/src/dx_productivity/trial_task_center/ui/mapping_table.py @@ -84,13 +84,24 @@ class MappingTable(QTableView): self.setAlternatingRowColors(True) self._model = RuleTableModel(self) self.setModel(self._model) + self.setHorizontalScrollMode(QAbstractItemView.ScrollMode.ScrollPerPixel) + self.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAsNeeded) + self.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAsNeeded) if on_enabled_changed is not None: self._model.enabled_requested.connect(on_enabled_changed) header = self.horizontalHeader() + header.setSectionsMovable(True) + header.setSectionsClickable(True) + header.setHighlightSections(True) + header.setStretchLastSection(False) + header.setMinimumSectionSize(48) + header.setDefaultAlignment(Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignVCenter) for section, width in ((0, 220), (1, 220), (2, 180), (3, 80), (4, 70), (5, 65), (6, 210)): header.setSectionResizeMode(section, QHeaderView.ResizeMode.Interactive) header.resizeSection(section, width) - header.setStretchLastSection(True) + # Keep the last section interactive so the horizontal scrollbar and + # header/body coordinate stay predictable in narrow workspaces. + header.setStretchLastSection(False) def set_rules_editable(self, editable: bool): if self._model.editable != editable: diff --git a/src/dx_productivity/trial_task_center/ui/material.py b/src/dx_productivity/trial_task_center/ui/material.py new file mode 100644 index 0000000..62547ae --- /dev/null +++ b/src/dx_productivity/trial_task_center/ui/material.py @@ -0,0 +1,166 @@ +"""Owned-window Acrylic composition with an opaque, accessible fallback. + +The data views never use window opacity or background screenshots. Windows +composes the live backdrop. Non-Windows/offscreen rendering stays solid. +""" +from __future__ import annotations + +import ctypes +from ctypes import wintypes +import sys + +from PySide6.QtCore import QEvent, QObject, QTimer, Qt +from PySide6.QtGui import QColor, QGuiApplication, QPainter +from PySide6.QtWidgets import QMainWindow + + +class MaterialMainWindow(QMainWindow): + """An alpha-capable HWND needs explicit opaque painting when Acrylic is off.""" + def paintEvent(self, event): + if not self.property('acrylicEnabled'): + painter = QPainter(self) + painter.fillRect(event.rect(), QColor('#edf1f5')) + painter.end() + super().paintEvent(event) + + +class WindowsAcrylic: + def __init__(self): + self._user = None + if sys.platform == 'win32': + self._user = ctypes.WinDLL('user32', use_last_error=True) + + def available(self) -> bool: + if self._user is None or QGuiApplication.platformName() != 'windows': + return False + if sys.getwindowsversion().build < 17763: + return False + try: + import winreg + class HighContrast(ctypes.Structure): + _fields_ = [('size', wintypes.UINT), ('flags', wintypes.DWORD), + ('scheme', wintypes.LPWSTR)] + contrast = HighContrast() + contrast.size = ctypes.sizeof(contrast) + if not self._user.SystemParametersInfoW(0x0042, contrast.size, + ctypes.byref(contrast), 0): + return False + if contrast.flags & 1 or self._user.GetSystemMetrics(0x1000): + return False + try: + with winreg.OpenKey(winreg.HKEY_CURRENT_USER, + r'Software\Microsoft\Windows\CurrentVersion\Themes\Personalize') as key: + enabled = winreg.QueryValueEx(key, 'EnableTransparency')[0] + return bool(enabled) + except FileNotFoundError: + return True + except OSError: + return False + + def _configure(self, hwnd: int, state: int) -> bool: + if self._user is None: + return False + class AccentPolicy(ctypes.Structure): + _fields_ = [('state', ctypes.c_int), ('flags', ctypes.c_int), + ('color', ctypes.c_uint32), ('animation', ctypes.c_int)] + class CompositionData(ctypes.Structure): + _fields_ = [('attribute', ctypes.c_int), ('data', ctypes.c_void_p), + ('size', ctypes.c_size_t)] + # WCA_ACCENT_POLICY, ACCENT_ENABLE_ACRYLICBLURBEHIND. Color is AABBGGRR. + policy = AccentPolicy(state, 0, 0x30F4F4F4, 0) + data = CompositionData(19, ctypes.cast(ctypes.pointer(policy), ctypes.c_void_p), + ctypes.sizeof(policy)) + configure = self._user.SetWindowCompositionAttribute + configure.argtypes = [wintypes.HWND, ctypes.POINTER(CompositionData)] + configure.restype = wintypes.BOOL + return bool(configure(hwnd, ctypes.byref(data))) + + def enable(self, hwnd: int) -> bool: + return self._configure(hwnd, 4) + + def disable(self, hwnd: int) -> None: + self._configure(hwnd, 0) + + +class AcrylicController(QObject): + """Only owns the composition state of its parent window, never system settings.""" + def __init__(self, window, *, backend=None): + super().__init__(window) + self.window = window + self.backend = backend if backend is not None else WindowsAcrylic() + self.reduced = False + self._enabled = False + self._handle = None + self._signature = None + window.setProperty('acrylicEnabled', False) + # Set up an alpha surface before creating HWND; keep the native frame. + if QGuiApplication.platformName() == 'windows': + window.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground) + window.installEventFilter(self) + self._timer = QTimer(self) + self._timer.setInterval(2000) + self._timer.timeout.connect(self._poll) + self._timer.start() + + def _poll(self): + if self.window.isVisible(): + self.refresh() + + def set_reduced_transparency(self, reduced: bool): + self.reduced = bool(reduced) + self.refresh() + + def _surface(self, enabled, *, repaint=True): + self._enabled = bool(enabled) + self.window.setProperty('acrylicEnabled', bool(enabled)) + # Dynamic ancestor selectors affect chrome children as well as the root. + self.window.setStyleSheet(self.window.styleSheet()) + if repaint: + self.window.update() + + def refresh(self): + try: + allowed = not self.reduced and self.backend.available() + except (OSError, AttributeError): + allowed = False + handle = int(self.window.winId()) if allowed else self._handle + signature = (handle, allowed) + if signature == self._signature: + return + self._signature = signature + # Native composition changes can briefly expose the intermediate Qt + # surface. Batch the property/style update and Windows API call while + # painting is paused, then present the final surface in one repaint. + updates_enabled = self.window.updatesEnabled() + self.window.setUpdatesEnabled(False) + try: + if self._enabled: + # Paint opaque before removing native blur; avoids an unreadable alpha surface. + self._surface(False, repaint=False) + try: + self.backend.disable(self._handle) + except (OSError, AttributeError): + pass + self._handle = handle + if not allowed: + return + try: + enabled = self.backend.enable(handle) + except (OSError, AttributeError): + enabled = False + self._surface(enabled, repaint=False) + if not enabled: + try: + self.backend.disable(handle) + except (OSError, AttributeError): + pass + finally: + self.window.setUpdatesEnabled(updates_enabled) + if updates_enabled: + self.window.update() + + def eventFilter(self, watched, event): + if event.type() in (QEvent.Type.Show, QEvent.Type.WinIdChange, + QEvent.Type.WindowActivate): + QTimer.singleShot(0, self.refresh) + return super().eventFilter(watched, event) diff --git a/src/dx_productivity/trial_task_center/ui/project_plan.py b/src/dx_productivity/trial_task_center/ui/project_plan.py index c1c592e..47be139 100644 --- a/src/dx_productivity/trial_task_center/ui/project_plan.py +++ b/src/dx_productivity/trial_task_center/ui/project_plan.py @@ -6,6 +6,7 @@ from threading import Event from time import monotonic from PySide6.QtCore import Qt, QThreadPool, QObject, Signal, QSignalBlocker +from PySide6.QtGui import QAction,QKeySequence from PySide6.QtWidgets import (QDialog, QDialogButtonBox, QFileDialog, QHBoxLayout, QLabel, QLineEdit, QListWidget, QListWidgetItem, QMessageBox, QPushButton, QVBoxLayout, QWidget, QToolButton, QMenu) @@ -14,6 +15,8 @@ from .detail_windows import BomReportDialog from .target_table import TargetTable from .workers import ServiceWorker from .operation_state import OperationPhase +from .command_menu import CommandMenu +from .icons import icon from ..bom_import_state import BomImportMachine, BomImportPhase, BomImportState @@ -169,6 +172,8 @@ class DirectoryTaskDialog(QDialog): class ProjectPlanPanel(QWidget): def __init__(self, window): super().__init__() + self.setObjectName('projectPlanPanel') + self.setAttribute(Qt.WidgetAttribute.WA_StyledBackground,True) self.window = window self.task_id = None self._drafts = {} @@ -183,7 +188,7 @@ class ProjectPlanPanel(QWidget): self.stop_button.hide() self.stop_button.clicked.connect(self.cancel_operation) self.table = TargetTable(self) - self.collect_button = QPushButton('采集所有匹配位号', objectName='collectTargetInventory') + self.collect_button = QPushButton('采集位号', objectName='collectTargetInventory') self.save_button = QPushButton('保存位号计划', objectName='saveTargetPlan') self.import_button = QPushButton('导入位号计划', objectName='importTargetPlan') self.export_button = QPushButton('导出位号计划', objectName='exportTargetPlan') @@ -196,12 +201,17 @@ class ProjectPlanPanel(QWidget): self.bulk_part.setPlaceholderText('对选中行批量填写新料号') self.bulk_apply = QPushButton('填入选中行') self.find_text = QLineEdit(objectName='findTargetText') - self.find_text.setPlaceholderText('查找位号 / UID / 料号 / 图页 / Value') + self.find_text.setPlaceholderText('搜索位号、料号或图页') + self.find_text.setToolTip('支持位号、UID、料号、图页和 Value。过滤不改变真实执行范围。') + self.find_text.setClearButtonEnabled(True) + self.find_text.setMinimumWidth(140) + self.find_text.setMaximumWidth(340) self.find_button = QPushButton('查找', objectName='findTargets') self.find_next_button = QPushButton('下一条') self.clear_find_button = QPushButton('清空查找') self.find_result = QLabel() self.summary = QLabel('先添加旧、新料号规则,再采集位号;可直接在这里编辑,也可选用 Excel。') + self.summary.setObjectName('planSummary') self.summary.setWordWrap(True) self.report_text = '' self.report_dialog = None @@ -210,37 +220,48 @@ class ProjectPlanPanel(QWidget): self.report_toggle.hide() self.report_toggle.toggled.connect(self._toggle_report) self.last_bom_report = None - actions = QHBoxLayout() - for button in (self.collect_button, self.save_button, self.import_bom_button, self.export_bom_button): + toolbar=QWidget(objectName='planToolbar') + actions=QHBoxLayout(toolbar) + actions.setContentsMargins(0,3,0,3);actions.setSpacing(8) + actions.addWidget(self.find_text,1) + actions.addStretch() + for button in (self.export_bom_button,self.import_bom_button,self.collect_button): actions.addWidget(button) - excel_menu = QMenu(self) - for button in (self.import_button, self.export_button): - button.setParent(self) - button.hide() - action = excel_menu.addAction(button.text(), button.click) - excel_menu.aboutToShow.connect(lambda a=action, b=button: a.setEnabled(b.isEnabled())) - self.excel_button = QToolButton() - self.excel_button.setText('位号 Excel') - self.excel_button.setMenu(excel_menu) + self.export_bom_button.setProperty('appearance','quiet') + self.more_menu=CommandMenu(self) + for button in (self.import_button,self.export_button):self.more_menu.add_button(button) + self.more_menu.addSeparator() + for button in (self.find_button,self.find_next_button,self.clear_find_button):self.more_menu.add_button(button) + self.excel_button = QToolButton(objectName='planMoreMenu') + self.excel_button.setText('更多工具') + self.excel_button.setToolTip('位号计划导入导出与搜索工具') + self.excel_button.setIcon(icon('more')) + self.excel_button.setProperty('appearance','quiet') + self.excel_button.setMenu(self.more_menu) self.excel_button.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup) actions.addWidget(self.excel_button) actions.addWidget(self.stop_button) - actions.addStretch() selection = QHBoxLayout() + selection.setSpacing(7) + for button in (self.select_all,self.select_none,self.bulk_apply):button.setProperty('appearance','quiet') selection.addWidget(self.select_all) selection.addWidget(self.select_none) selection.addWidget(self.bulk_part, 1) selection.addWidget(self.bulk_apply) + self.save_state=QLabel(objectName='planSaveState') + selection.addWidget(self.save_state) + selection.addWidget(self.save_button) layout = QVBoxLayout(self) - layout.setContentsMargins(0, 0, 0, 0) - layout.addLayout(actions) - layout.addWidget(self.summary) + layout.setContentsMargins(0,4,0,0) + layout.setSpacing(9) + layout.addWidget(toolbar) + summary_row=QHBoxLayout() + summary_row.addWidget(self.summary,1) + summary_row.addWidget(self.find_result) + self.find_result.setObjectName('planFindResult') + self.find_result.hide() + layout.addLayout(summary_row) layout.addWidget(self.report_toggle) - search = QHBoxLayout() - for widget in (self.find_text, self.find_button, self.find_next_button, - self.clear_find_button, self.find_result): - search.addWidget(widget) - layout.addLayout(search) layout.addWidget(self.table, 1) layout.addLayout(selection) self.collect_button.clicked.connect(self.collect) @@ -255,8 +276,24 @@ class ProjectPlanPanel(QWidget): self.table.changed.connect(self._changed) self.find_button.clicked.connect(self.find) self.find_text.returnPressed.connect(self.find) + self.find_text.textEdited.connect(self.find) + self.next_match_action=self.find_text.addAction(icon('chevron'),QLineEdit.ActionPosition.TrailingPosition) + self.next_match_action.setToolTip('下一条匹配位号 · F3') + self.next_match_action.triggered.connect(self.table.find_next) self.find_next_button.clicked.connect(self.table.find_next) self.clear_find_button.clicked.connect(self.clear_find) + self.bulk_part.textChanged.connect(self._edit_feedback) + self.table.selectionModel().selectionChanged.connect(self._edit_feedback) + self.table.editor_activity.connect(self._editor_feedback) + def shortcut(key,callback): + action=QAction(self);action.setShortcut(QKeySequence(key)) + action.setShortcutContext(Qt.ShortcutContext.WidgetWithChildrenShortcut) + action.triggered.connect(callback);self.addAction(action);return action + self.find_shortcut=shortcut('Ctrl+F',self._focus_find) + self.save_shortcut=shortcut('Ctrl+S',self._save_from_shortcut) + self.next_shortcut=shortcut('F3',lambda:self.table.find_next()if self.next_match_action.isEnabled()else None) + self.save_button.setToolTip('保存当前作用范围的位号计划 · Ctrl+S') + self._edit_feedback() def bind_task(self, task_id, rows=None): self._restore_bom_report(self._report_scope(task_id)) @@ -278,10 +315,10 @@ class ProjectPlanPanel(QWidget): def find(self): count = self.table.set_find_text(self.find_text.text()) - self.find_result.setText(f'{count} 条匹配') self.select_all.setText('替换可见行' if self.find_text.text().strip() else '替换当前工程') self.select_none.setText('保留可见行' if self.find_text.text().strip() else '保留当前工程') self.table.find_next() + self._edit_feedback() def clear_find(self): self.find_text.clear() @@ -289,16 +326,56 @@ class ProjectPlanPanel(QWidget): self.find_result.clear() self.select_all.setText('替换当前工程') self.select_none.setText('保留当前工程') + self._edit_feedback() + + def _focus_find(self): + self.find_text.setFocus() + self.find_text.selectAll() + + def _editor_feedback(self): + self._edit_feedback() + if not getattr(self.window,'_closed',False):self.window._update_gates() + + def _save_from_shortcut(self): + if not self._editable or not self.task_id:return + # Leaving the delegate editor commits its text before the save snapshot. + self.table.setFocus(Qt.FocusReason.ShortcutFocusReason) + self._edit_feedback() + if self.save_button.isEnabled():self.save_button.click() + + def _edit_feedback(self,*_): + count=self.table.plan_model.rowCount() + pending=bool(self.table.dirty or self._active_bom_batch() or self.table.has_pending_editor()) + self.save_state.setText('未保存'if pending else '已保存') + self.save_state.setVisible(bool(count or pending)) + tone='pending'if pending else 'saved' + if self.save_state.property('tone')!=tone: + self.save_state.setProperty('tone',tone) + self.save_state.style().unpolish(self.save_state) + self.save_state.style().polish(self.save_state) + self.save_button.setEnabled(self._editable and bool(self.task_id) and pending) + selected=len(self.table.selectionModel().selectedRows()) + self.bulk_apply.setText(f'填入 {selected} 行'if selected else'填入选中行') + self.bulk_apply.setToolTip('先选中表格行,再输入新料号;行选中与替换勾选是两种操作。') + self.bulk_apply.setEnabled(self._editable and bool(self.task_id) and selected>0 and bool(self.bulk_part.text().strip())) + query=bool(self.find_text.text().strip()) + visible=self.table.rowCount() + self.find_result.setVisible(query) + self.find_result.setText(f'匹配 {visible} / {count}'if visible else'没有匹配结果') + self.next_match_action.setVisible(query) + self.next_match_action.setEnabled(query and visible>0) + self.find_next_button.setEnabled(query and visible>0) def has_unsaved_plan(self, task_ids): return any(task_id in self._drafts or - (task_id == self.task_id and self.table.dirty) for task_id in task_ids) + (task_id == self.task_id and (self.table.dirty or self.table.has_pending_editor())) for task_id in task_ids) def has_unsaved_plans(self): - return bool(self._drafts or self._bom_batches or self._orphaned_bom_batches or self.table.dirty) + return bool(self._drafts or self._bom_batches or self._orphaned_bom_batches or self.table.dirty or self.table.has_pending_editor()) def prepare_save_all(self): # Snapshot widgets only on the GUI thread; the returned operation uses plain data. + if self.table.has_pending_editor():self.table.setFocus(Qt.FocusReason.ShortcutFocusReason) drafts = dict(self._drafts) if self.task_id and self.table.dirty: drafts[self.task_id] = self.table.rows() @@ -339,6 +416,7 @@ class ProjectPlanPanel(QWidget): self.table.populate(()) def discard_all(self): + self.table.cancel_editor() self._drafts.clear() self._bom_batches.clear() self._orphaned_bom_batches.clear() @@ -445,6 +523,7 @@ class ProjectPlanPanel(QWidget): self._summary() def _summary(self): + self._edit_feedback() count = self.table.plan_model.rowCount() batch = self._active_bom_batch() self.save_button.setText('保存本批位号计划' if batch else '保存位号计划') @@ -488,6 +567,7 @@ class ProjectPlanPanel(QWidget): self.export_button.setEnabled(self._editable and bool(self.task_id) and bool(self.table.plan_model.rowCount()) and not self.table.dirty) self.export_bom_button.setEnabled(not busy) + self._edit_feedback() def _dispatch(self, operation, callback, button, *, retain_result=False): self.window._run_async(operation, callback, button, expected_task_id=self.task_id, diff --git a/src/dx_productivity/trial_task_center/ui/project_summary.py b/src/dx_productivity/trial_task_center/ui/project_summary.py index c8a07e8..36e790a 100644 --- a/src/dx_productivity/trial_task_center/ui/project_summary.py +++ b/src/dx_productivity/trial_task_center/ui/project_summary.py @@ -5,8 +5,9 @@ from PySide6.QtWidgets import QApplication, QHBoxLayout, QLabel, QPushButton, QT class ProjectPathLabel(QLabel): """One line of context; the full path remains selectable and copyable.""" - def __init__(self): - super().__init__(objectName='boundProjectPath') + def __init__(self,object_name='boundProjectPath',elide=Qt.TextElideMode.ElideMiddle): + super().__init__(objectName=object_name) + self._elide_mode=elide self.full_path = '' self.setSizePolicy(QSizePolicy.Policy.Ignored, QSizePolicy.Policy.Fixed) self.setTextInteractionFlags(Qt.TextInteractionFlag.TextSelectableByMouse) @@ -27,23 +28,43 @@ class ProjectPathLabel(QLabel): self._elide() def _elide(self): - super().setText(self.fontMetrics().elidedText(self.full_path, Qt.TextElideMode.ElideMiddle, max(0, self.width()))) + super().setText(self.fontMetrics().elidedText(self.full_path, self._elide_mode, max(0, self.width()))) class ProjectSummary(QWidget): def __init__(self, parent=None): super().__init__(parent) - self.name = QLabel('未选择任务') + self.setObjectName('projectSummary') + self.name = ProjectPathLabel('projectTitle',Qt.TextElideMode.ElideRight) + self.name.setText('未选择任务') + self.name.setMinimumHeight(34) self.path = ProjectPathLabel() self.copy_path = QToolButton() self.copy_path.setText('复制路径') + from .icons import icon + self.copy_path.setIcon(icon('copy')) + self.copy_path.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonIconOnly) + self.copy_path.setToolTip('复制完整工程路径') + self.copy_path.setProperty('appearance','quiet') self.copy_path.clicked.connect(lambda: QApplication.clipboard().setText(self.path.full_path)) - self.state = QLabel() - self.state.setWordWrap(True) + self.state = QLabel(objectName='projectState') + self.state.setWordWrap(False) + self.state.setMinimumWidth(130) + self.state.setMaximumWidth(310) + self.state.setAlignment(Qt.AlignmentFlag.AlignRight|Qt.AlignmentFlag.AlignVCenter) self.refresh_button = QPushButton('重新读取工程', objectName='refreshBoundProject') + from .command_menu import CommandMenu + self.more_menu=CommandMenu(self) + self.more_menu.add_button(self.refresh_button) + more=QToolButton(objectName='projectMoreMenu') + more.setText('工程操作');more.setToolTip('重新读取工程') + more.setIcon(icon('more'));more.setProperty('appearance','quiet') + more.setMenu(self.more_menu);more.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup) heading = QHBoxLayout() + self.heading_layout = heading heading.addWidget(self.name, 1) - heading.addWidget(self.refresh_button) + heading.addWidget(self.state) + heading.addWidget(more) layout = QVBoxLayout(self) layout.setContentsMargins(0, 0, 0, 0) layout.addLayout(heading) @@ -51,13 +72,13 @@ class ProjectSummary(QWidget): path_row.addWidget(self.path, 1) path_row.addWidget(self.copy_path) layout.addLayout(path_row) - layout.addWidget(self.state) def populate(self, context): if context is None: self.name.setText('未选择任务') self.path.clear() self.state.setText('点击新建,在弹窗中读取并选择工程。') + self.state.setToolTip(self.state.text()) return project = context.project self.name.setText(project.display_name if project else context.task.name) @@ -72,4 +93,5 @@ class ProjectSummary(QWidget): progress = context.progress result = (f' · 已保存 {progress.saved_items} / 失败 {progress.failed_items} / 未命中 {progress.no_match_items}' if progress.completed_items else '') - self.state.setText(f'当前工程 · {labels.get(context.task.status.value, context.task.status.value)}{result}') + self.state.setText(f'{labels.get(context.task.status.value, context.task.status.value)}{result}') + self.state.setToolTip(self.state.text()) diff --git a/src/dx_productivity/trial_task_center/ui/run_panel.py b/src/dx_productivity/trial_task_center/ui/run_panel.py index d5149c4..ee0ed12 100644 --- a/src/dx_productivity/trial_task_center/ui/run_panel.py +++ b/src/dx_productivity/trial_task_center/ui/run_panel.py @@ -1,9 +1,11 @@ """Explicit single-task execution, recovery and safe pause controls.""" -from PySide6.QtCore import Signal +from PySide6.QtCore import Signal,Qt from PySide6.QtWidgets import (QCheckBox, QHBoxLayout, QLabel, QProgressBar, QPushButton, QToolButton, QVBoxLayout, QWidget) from .detail_windows import TaskLogDialog +from .command_menu import CommandMenu +from .icons import icon class RunPanel(QWidget): @@ -11,6 +13,8 @@ class RunPanel(QWidget): def __init__(self): super().__init__() + self.setObjectName('runPanel') + self.setAttribute(Qt.WidgetAttribute.WA_StyledBackground,True) self.queue_summary = QLabel('未选择任务', objectName='queueSummary') self.execution_status = QLabel('空闲', objectName='executionStatus') self.execution_status.setWordWrap(True) @@ -42,18 +46,33 @@ class RunPanel(QWidget): self.reset_layout_button.setText('重置布局') self.log_dialog = None self.toggle_log_button.toggled.connect(self._toggle_log) - buttons = QHBoxLayout() - for button in (self.quick_run_button, self.retry_button, self.recover_button, self.cleanup_resources_button, self.diagnostics_button, - self.new_round_button, self.history_button, self.stop_queue_button, self.force_stop_button): + self.more_menu=CommandMenu(self) + for button in (self.diagnostics_button,self.cleanup_resources_button,self.history_button,self.reset_layout_button): + self.more_menu.add_button(button) + self.more_menu.addSeparator() + self.more_menu.add_button(self.force_stop_button) + self.more_button=QToolButton(objectName='executionMoreMenu') + self.more_button.setText('更多操作') + self.more_button.setToolTip('诊断、轮次证据、布局与异常操作') + self.more_button.setIcon(icon('more')) + self.more_button.setMenu(self.more_menu) + self.more_button.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup) + self.more_button.setProperty('appearance','quiet') + self.toggle_log_button.setProperty('appearance','quiet') + heading=QHBoxLayout() + heading.addWidget(self.queue_summary,1) + heading.addWidget(self.toggle_log_button) + heading.addWidget(self.more_button) + buttons=QHBoxLayout() + buttons.addWidget(self.operator_band,1) + for button in (self.retry_button,self.recover_button,self.new_round_button,self.stop_queue_button,self.quick_run_button): buttons.addWidget(button) - buttons.addStretch() - buttons.addWidget(self.toggle_log_button) - buttons.addWidget(self.reset_layout_button) layout = QVBoxLayout(self) - layout.setContentsMargins(0, 0, 0, 0) - for widget in (self.queue_summary, self.execution_status, self.busy_indicator, - self.operator_band): - layout.addWidget(widget) + layout.setContentsMargins(12,8,12,9) + layout.setSpacing(5) + layout.addLayout(heading) + layout.addWidget(self.execution_status) + layout.addWidget(self.busy_indicator) layout.addLayout(buttons) def _toggle_log(self, visible): diff --git a/src/dx_productivity/trial_task_center/ui/styles.py b/src/dx_productivity/trial_task_center/ui/styles.py index 13deaa4..92c6d2b 100644 --- a/src/dx_productivity/trial_task_center/ui/styles.py +++ b/src/dx_productivity/trial_task_center/ui/styles.py @@ -1,44 +1,111 @@ -"""Restrained, work-focused styling for the trial task center.""" +"""Frosted window chrome and opaque, readable engineering data surfaces.""" APP_STYLESHEET = """ -QWidget { background: #f4f6f8; color: #17212b; font-size: 13px; } +QWidget { background: transparent; color: #344359; font-family: "Segoe UI", "Microsoft YaHei UI"; font-size: 13px; } +QMainWindow { background: #edf1f5; } +QMainWindow[acrylicEnabled="true"] { background: transparent; } +QDialog, QMessageBox, QMenu { background: #f8fafc; } +QToolTip { background: #ffffff; color: #344359; border: 1px solid #ccd6e2; padding: 5px; } QLabel#taskSectionTitle { color: #5d6873; font-size: 12px; font-weight: 600; padding: 2px 4px; } -QWidget#taskNavigation, QWidget#workspace, QTextEdit { background: #ffffff; border: 1px solid #cbd5df; } -QPushButton, QComboBox, QLineEdit, QTableView { border: 1px solid #aebdca; border-radius: 6px; background: #ffffff; } -QPushButton { min-height: 30px; padding: 2px 9px; } -QPushButton:hover { background: #edf4fa; } +QWidget#taskNavigation { background: #e9eef4; border: 1px solid #dbe3ed; border-radius: 10px; } +QMainWindow[acrylicEnabled="true"] QWidget#taskNavigation { background: rgba(255,255,255,26); border: 1px solid rgba(255,255,255,165); } +QWidget#workspace { background: #f1f5f9; border: 1px solid #dce5ef; border-radius: 14px; } +QMainWindow[acrylicEnabled="true"] QWidget#workspace { background: rgba(255,255,255,42); border: 1px solid rgba(255,255,255,145); } +QWidget#executionSurface { background: transparent; border: none; } +QWidget#runPanel { background: #f8fafc; border: 1px solid #dde6f0; border-radius: 12px; } +QMainWindow[acrylicEnabled="true"] QWidget#runPanel { background: rgba(255,255,255,65); border: 1px solid rgba(255,255,255,185); } +QWidget#projectOptions { background: #f2f5f9; border: 1px solid #e3e9f0; border-radius: 7px; } +QLabel#projectTitle { font-size: 23px; font-weight: 600; color: #344b67; padding: 3px 0; } +QLabel#applicationBrand { font-size: 15px; font-weight: 600; color: #455b77; padding: 0 8px; } +QLabel#boundProjectPath { font-family: Consolas; font-size: 12px; color: #71839b; } +QLabel#projectState { font-size: 12px; color: #6d829c; padding: 0 2px; } +QLabel#ruleHelp { color: #71839b; font-size: 12px; padding: 2px 2px 4px; } +QPushButton, QComboBox, QLineEdit, QTableView { border: 1px solid #d1dce9; border-radius: 7px; background: #ffffff; } +QPushButton { min-height: 28px; padding: 3px 11px; } +QPushButton:hover { background: #edf3fa; border-color: #aebfd4; } QPushButton:disabled { color: #81909c; background: #e8edf1; } -QPushButton#quickRunButton { background: #1769aa; color: white; border-color: #1769aa; font-weight: 600; } -QPushButton#quickRunButton:hover { background: #12588f; } +QPushButton#quickRunButton, QPushButton#recoverQuickRunButton, QPushButton#retryTaskItems, QPushButton#startNewRoundButton, QPushButton#stopQueueButton { background: #4e6783; color: white; border-color: #4e6783; font-weight: 600; padding: 5px 16px; border-radius: 8px; } +QPushButton#quickRunButton:hover, QPushButton#recoverQuickRunButton:hover, QPushButton#retryTaskItems:hover, QPushButton#startNewRoundButton:hover, QPushButton#stopQueueButton:hover { background: #3d5570; } QPushButton#quickRunButton:disabled { background: #d9e2e9; color: #667784; border-color: #cbd5df; } QPushButton#deleteTaskButton, QPushButton#deleteMappingButton { color: #9f2018; border-color: #d5a29d; } QPushButton#deleteTaskButton:hover, QPushButton#deleteMappingButton:hover { background: #fff0ee; } QPushButton#deleteTaskButton:disabled, QPushButton#deleteMappingButton:disabled { color: #81909c; border-color: #cbd5df; background: #e8edf1; } QLineEdit, QComboBox { min-height: 28px; padding: 0 6px; } -QTableView { gridline-color: #e4e9ee; selection-background-color: #e0edfa; selection-color: #17212b; alternate-background-color: #f8fafc; } -QHeaderView::section { background: #e8edf1; border: 0; border-bottom: 1px solid #cbd5df; padding: 5px; font-weight: 600; } -QListWidget { background: #ffffff; border: 1px solid #cbd5df; } +QTableView { background: #ffffff; gridline-color: #edf1f6; selection-background-color: #e7f0fc; selection-color: #304864; alternate-background-color: #fafcff; font-family: Consolas, "Microsoft YaHei UI"; } +QTableView::item { padding: 4px; } +QHeaderView { background: #f1f5fa; border: 0; } +QHeaderView::section { background: #f1f5fa; color: #61758f; border: 0; border-right: 1px solid #e2e9f1; border-bottom: 1px solid #d6e0eb; padding: 7px 9px; font-weight: 600; } +QHeaderView::section:hover { background: #eaf1f8; color: #456587; } +QHeaderView::section:pressed, QHeaderView::section:checked { background: #dde9f5; color: #355a80; } +QMainWindow[acrylicEnabled="true"] QHeaderView { background: rgba(245,249,253,235); } +QMainWindow[acrylicEnabled="true"] QHeaderView::section { background: rgba(245,249,253,235); border-right-color: rgba(211,224,238,220); border-bottom-color: rgba(202,216,232,235); } +QMainWindow[acrylicEnabled="true"] QHeaderView::section:hover { background: rgba(232,242,251,245); } +QMainWindow[acrylicEnabled="true"] QHeaderView::section:pressed, QMainWindow[acrylicEnabled="true"] QHeaderView::section:checked { background: rgba(216,232,247,250); } +QListWidget { background: transparent; border: none; outline: none; } QListWidget::item { padding: 8px 10px; border-radius: 6px; margin: 2px 0; } -QListWidget::item:selected { background: #e0edfa; color: #17212b; border: 1px solid #b4cce6; } +QListWidget::item:selected { background: #ffffff; color: #385a82; border: 1px solid #d9e4f2; } +QMainWindow[acrylicEnabled="true"] QListWidget::item:selected { background: rgba(255,255,255,120); border: 1px solid rgba(255,255,255,210); } QListWidget::item:hover:!selected { background: #f1f5f9; } -QLabel#operatorBand { background: #fff8d9; border: 1px solid #dfbf4b; padding: 7px; color: #5a4600; } +QLabel#operatorBand { background: transparent; border: none; padding: 4px 0; color: #6c809a; font-size: 12px; } QLabel#operatorBand[state="success"] { background: #edf8f1; border-color: #71a982; color: #245b35; } QLabel#operatorBand[state="error"] { background: #fff0ee; border-color: #d58b84; color: #84251e; } QLabel#operatorBand[state="busy"] { background: #edf4fa; border-color: #83abc9; color: #234f70; } QLabel#operatorBand[state="info"] { background: #edf4fa; border-color: #83abc9; color: #234f70; } QLabel#operatorBand[state="warning"] { background: #fff8d9; border-color: #dfbf4b; color: #5a4600; } -QLabel#queueSummary { color: #263b49; font-weight: 600; } -QLabel#executionStatus { color: #49616f; } +QLabel#queueSummary { color: #73869e; font-size: 11px; font-weight: 500; } +QLabel#executionStatus { color: #536d8c; font-size: 12px; } QProgressBar#quickRunBusyIndicator { border: 0; background: #dbe4ea; } QProgressBar#quickRunBusyIndicator::chunk { background: #1769aa; } -QSplitter::handle { background: #bccbd8; border: 1px solid #e7edf2; } +QSplitter::handle { background: transparent; } QSplitter::handle:hover { background: #83abc9; } -QToolButton { background: #ffffff; border: 1px solid #aebdca; border-radius: 4px; padding: 4px 7px; } +QToolButton { background: rgba(255,255,255,155); border: 1px solid #d4dfec; border-radius: 7px; padding: 4px 7px; } QToolButton:hover { background: #edf4fa; } -QWidget#toolNavigation { background: #ffffff; border-bottom: 1px solid #e1e5ea; } -QWidget#toolNavigation QToolButton { min-height: 32px; border: 0; border-radius: 7px; padding: 2px 18px; color: #637083; } -QWidget#toolNavigation QToolButton:checked { background: #edf3ff; color: #2864d7; font-weight: 600; } +QWidget#toolNavigation { background: #eaf0f6; border-bottom: 1px solid #d9e3ee; } +QMainWindow[acrylicEnabled="true"] QWidget#toolNavigation { background: rgba(255,255,255,30); border-bottom: 1px solid rgba(255,255,255,150); } +QWidget#toolNavigation QToolButton { min-height: 32px; border: 1px solid transparent; border-radius: 8px; padding: 2px 14px; color: #657b97; } +QWidget#toolNavigation QToolButton:checked { background: rgba(255,255,255,180); border-color: rgba(255,255,255,230); color: #3f6087; font-weight: 600; } QWidget#toolNavigation QToolButton:hover { background: #f0f4fa; } QLabel#statusLabel { color: #49616f; } QTextEdit { padding: 5px; font-family: Consolas, "Courier New", monospace; } +QTextEdit, QPlainTextEdit { background: #ffffff; border: 1px solid #dce5ef; border-radius: 6px; } +QTabWidget::pane { border: none; background: transparent; padding: 0; } +QTabBar::tab { background: transparent; color: #7d8fa7; padding: 9px 15px; border-bottom: 2px solid transparent; } +QTabBar::tab:selected { color: #466c98; border-bottom-color: #86a4c7; } +QMenu::item { padding: 7px 20px; } +QMenu::item:selected { background: #e9f1fb; } +QScrollBar:vertical { background: #f8fafd; width: 12px; } +QScrollBar::handle:vertical { background: #ccd7e5; min-height: 25px; border-radius: 5px; } +QScrollBar:horizontal { background: #f6f8fb; height: 10px; border: none; margin: 0; } +QScrollBar::handle:horizontal { background: #c9d6e7; min-width: 28px; border-radius: 4px; } +QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal { width: 0; height: 0; border: none; } +QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { background: transparent; } +QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical { width: 0; height: 0; border: none; } +QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { background: transparent; } +QTableCornerButton::section { background: #f1f5fa; border: none; } +QPushButton[appearance="quiet"], QToolButton[appearance="quiet"] { background: transparent; border: 1px solid transparent; color: #6a809d; padding: 3px 6px; } +QPushButton[appearance="quiet"]:hover, QToolButton[appearance="quiet"]:hover { background: rgba(255,255,255,115); border-color: rgba(255,255,255,180); } +QPushButton[appearance="quiet"]:disabled { background: transparent; color: #a1adbc; } +QToolButton::menu-indicator { width: 0; height: 0; } +QPushButton[appearance="batch"] { background: rgba(255,255,255,120); border: 1px solid rgba(255,255,255,190); border-radius: 9px; color: #617c9e; min-height: 30px; } +QPushButton[appearance="batch"]:disabled { background: rgba(255,255,255,40); border-color: rgba(255,255,255,100); color: #9aabba; } +QLabel#taskCount, QLabel#planSummary { color: #7e91aa; font-size: 11px; } +QLabel#planFindResult { color: #657f9f; font-size: 11px; padding: 0 4px; } +QLabel#planSaveState { color: #81968d; font-size: 11px; padding: 3px 5px; } +QLabel#planSaveState[tone="pending"] { color: #9c7a43; background: rgba(255,247,226,170); border-radius: 5px; } +QLabel#tableEmptyState { color: #8a9cb2; font-family: "Segoe UI", "Microsoft YaHei UI"; font-size: 12px; background: #ffffff; padding: 12px; } +QWidget#planToolbar { background: transparent; border: none; } +QLineEdit#findTargetText, QLineEdit#taskSearch { background: rgba(255,255,255,125); border: 1px solid rgba(255,255,255,190); border-radius: 8px; padding: 0 8px; } +QPushButton#saveTargetPlan { color: #56759b; background: rgba(255,255,255,160); border: 1px solid #cfdaea; font-weight: 600; } +QPushButton#saveTargetPlan:disabled { color: #7f8e9f; border-color: #d2dce7; background: rgba(242,246,250,220); } +QListWidget::item { margin: 3px 0; border-radius: 10px; padding: 0; } +QMainWindow[acrylicEnabled="true"] QListWidget::item:selected { background: rgba(255,255,255,100); border: 1px solid rgba(255,255,255,210); } +QLineEdit:focus, QComboBox:focus { border: 1px solid #8da8ca; background: rgba(255,255,255,225); selection-background-color: #dce9f8; selection-color: #355576; } +QLineEdit#findTargetText:focus, QLineEdit#taskSearch:focus { border-color: #93acca; background: rgba(255,255,255,210); } +QPushButton:focus, QToolButton:focus { border: 1px solid #8da8ca; } +QPushButton:pressed, QToolButton:pressed { background: #dde7f3; } +QPushButton#quickRunButton:pressed, QPushButton#recoverQuickRunButton:pressed, QPushButton#retryTaskItems:pressed, QPushButton#startNewRoundButton:pressed, QPushButton#stopQueueButton:pressed { background: #334b66; } +QTableView { outline: none; } +QTableView::item:selected { background: #e6eef8; color: #294969; } +QTableView::item:focus { border: 1px solid #9bb3d0; } +QToolButton[appearance="quiet"]:checked { background: rgba(255,255,255,155); border-color: rgba(255,255,255,220); color: #3f638e; } """ diff --git a/src/dx_productivity/trial_task_center/ui/target_table.py b/src/dx_productivity/trial_task_center/ui/target_table.py index 3cc914b..b77eb88 100644 --- a/src/dx_productivity/trial_task_center/ui/target_table.py +++ b/src/dx_productivity/trial_task_center/ui/target_table.py @@ -1,7 +1,7 @@ """Model-based editable target plan; filtering never changes saved identities.""" from dataclasses import replace -from PySide6.QtCore import QAbstractTableModel, QModelIndex, QSortFilterProxyModel, Qt, Signal -from PySide6.QtWidgets import QAbstractItemView, QHeaderView, QTableView +from PySide6.QtCore import QAbstractTableModel, QModelIndex, QSortFilterProxyModel, Qt, Signal,QPersistentModelIndex +from PySide6.QtWidgets import QAbstractItemView, QHeaderView, QTableView,QLabel,QStyledItemDelegate,QLineEdit,QAbstractItemDelegate HEADERS = ('替换', '原理图', '图页', '位号', '旧料号', '原 Value', '新料号', '自定义 Value', '自定义内容', '同步 NC') CHECK_FIELDS = {0: 'enabled', 7: 'custom_value_enabled', 9: 'sync_nc'} @@ -33,6 +33,12 @@ class TargetPlanModel(QAbstractTableModel): def headerData(self, section, orientation, role=Qt.ItemDataRole.DisplayRole): if role == Qt.ItemDataRole.DisplayRole: return HEADERS[section] if orientation == Qt.Orientation.Horizontal else section + 1 + if role == Qt.ItemDataRole.ToolTipRole and orientation==Qt.Orientation.Horizontal: + return ('勾选的位号会纳入已保存的替换计划;行选中用于批量编辑。', + '原理图名称,只读。','图页编号,只读。','器件位号,只读;完整 UID 在单元格提示中。', + '当前工程的原料号,只读。','原始 Value,只读。','可编辑的新料号;修改后需要保存计划。', + '启用本行自定义 Value,优先于工程级 Value 策略。', + '本行自定义 Value 内容。','按本行配置是否同步 NC。')[section] def data(self, index, role=Qt.ItemDataRole.DisplayRole): if not index.isValid(): return None @@ -45,7 +51,10 @@ class TargetPlanModel(QAbstractTableModel): return ('', t.schematic_name, t.sheet_number, t.refdes, t.old_part_number, t.old_value, row.new_part_number, '', row.custom_value, '')[col] if role == Qt.ItemDataRole.ToolTipRole: - return f'{t.project_path}\n{t.schematic_name}:{t.sheet_number} | {t.refdes} | UID {t.uid}' + content=self.data(index,Qt.ItemDataRole.DisplayRole) + if col in CHECK_FIELDS:content='开启'if getattr(row,CHECK_FIELDS[col])else'关闭' + return (f'{HEADERS[col]}:{content or "未设置"}\n' + f'{t.schematic_name}:{t.sheet_number} | {t.refdes} | UID {t.uid}\n{t.project_path}') def flags(self, index): if not index.isValid(): return Qt.ItemFlag.NoItemFlags @@ -108,11 +117,32 @@ class TargetFilter(QSortFilterProxyModel): def filterAcceptsRow(self, row, parent): return not self.query or self.query in self.sourceModel().search_text[row] + +class PlanEditorDelegate(QStyledItemDelegate): + """Expose uncommitted editor text without changing Escape/cancel semantics.""" + def createEditor(self,parent,option,index): + editor=super().createEditor(parent,option,index) + if isinstance(editor,QLineEdit): + view=self.parent() + view._active_editor=(editor,QPersistentModelIndex(index)) + editor.textChanged.connect(lambda _:view.editor_activity.emit()) + return editor + + def destroyEditor(self,editor,index): + view=self.parent() + if view._active_editor and view._active_editor[0]is editor: + view._active_editor=None + view.editor_activity.emit() + super().destroyEditor(editor,index) + class TargetTable(QTableView): changed = Signal() + editor_activity=Signal() def __init__(self, parent=None): super().__init__(parent) self.setObjectName('targetPlanTable') + self._active_editor=None + self.setItemDelegate(PlanEditorDelegate(self)) self.plan_model = TargetPlanModel(self) self.proxy = TargetFilter(self) self.proxy.setSourceModel(self.plan_model) @@ -120,16 +150,34 @@ class TargetTable(QTableView): self.setSortingEnabled(True) self.sortByColumn(-1, Qt.SortOrder.AscendingOrder) self.setAlternatingRowColors(True) + self.setShowGrid(False) + self.verticalHeader().setDefaultSectionSize(34) self.setMinimumHeight(160) self.setEditTriggers(QAbstractItemView.EditTrigger.DoubleClicked | QAbstractItemView.EditTrigger.EditKeyPressed) self.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows) self.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection) - self.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Interactive) + self.setHorizontalScrollMode(QAbstractItemView.ScrollMode.ScrollPerPixel) + self.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAsNeeded) + self.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAsNeeded) + header = self.horizontalHeader() + # Keep the header and body in one scrollable coordinate system. The + # stored header state also preserves a user's column widths/order. + header.setSectionResizeMode(QHeaderView.ResizeMode.Interactive) + header.setSectionsMovable(True) + header.setSectionsClickable(True) + header.setHighlightSections(True) + header.setStretchLastSection(False) + header.setMinimumSectionSize(48) + header.setDefaultAlignment(Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignVCenter) for col, width in enumerate((55, 90, 50, 70, 145, 115, 145, 90, 125, 75)): self.setColumnWidth(col, width) self.dirty = False self._next_match = -1 self.plan_model.changed.connect(self._changed) + self.empty_hint=QLabel(self.viewport(),objectName='tableEmptyState') + self.empty_hint.setAlignment(Qt.AlignmentFlag.AlignCenter) + self.empty_hint.setAttribute(Qt.WidgetAttribute.WA_TransparentForMouseEvents) + self._update_empty_hint() def _changed(self): self.dirty = True self.changed.emit() @@ -137,8 +185,16 @@ class TargetTable(QTableView): self.plan_model.populate(rows) self._next_match = -1 self.dirty = False + self._update_empty_hint() def rows(self): return tuple(self.plan_model.rows) + def has_pending_editor(self): + if not self._active_editor:return False + editor,index=self._active_editor + return index.isValid()and editor.isVisible()and editor.text()!=str(index.data(Qt.ItemDataRole.EditRole)or'') + def cancel_editor(self): + if self._active_editor: + self.itemDelegate().closeEditor.emit(self._active_editor[0],QAbstractItemDelegate.EndEditHint.RevertModelCache) def rowCount(self): return self.proxy.rowCount() @@ -156,7 +212,18 @@ class TargetTable(QTableView): else: self.proxy.invalidateFilter() self._next_match = -1 + self._update_empty_hint() return self.rowCount() + + def _update_empty_hint(self): + self.empty_hint.setText('没有匹配的位号\n换个关键词,或清空搜索。'if self.proxy.query else + '暂无位号计划\n导入 BOM,或添加规则后采集位号。') + self.empty_hint.setGeometry(self.viewport().rect()) + self.empty_hint.setVisible(self.rowCount()==0) + + def resizeEvent(self,event): + super().resizeEvent(event) + if hasattr(self,'empty_hint'):self._update_empty_hint() def find_next(self): if not self.rowCount(): return None diff --git a/src/dx_productivity/trial_task_center/ui/task_list.py b/src/dx_productivity/trial_task_center/ui/task_list.py index 62ed35d..e26d0fd 100644 --- a/src/dx_productivity/trial_task_center/ui/task_list.py +++ b/src/dx_productivity/trial_task_center/ui/task_list.py @@ -6,8 +6,49 @@ from collections.abc import Callable import re from typing import Iterable -from PySide6.QtCore import Qt, QSignalBlocker, Signal -from PySide6.QtWidgets import QComboBox, QGridLayout, QLabel, QLineEdit, QListWidget, QListWidgetItem, QPushButton, QVBoxLayout, QWidget +from PySide6.QtCore import Qt, QSignalBlocker, Signal, QSize, QRect +from PySide6.QtGui import QColor,QFont,QIcon +from PySide6.QtWidgets import (QComboBox,QHBoxLayout,QLabel,QLineEdit,QListWidget, + QListWidgetItem,QPushButton,QVBoxLayout,QWidget,QToolButton,QMenu, + QStyledItemDelegate,QStyleOptionViewItem,QStyle,QApplication) +from .command_menu import CommandMenu + + +class TaskItemDelegate(QStyledItemDelegate): + def sizeHint(self,option,index): + return QSize(180,76) + + def paint(self,painter,option,index): + opt=QStyleOptionViewItem(option) + self.initStyleOption(opt,index) + text=str(index.data(Qt.ItemDataRole.DisplayRole)or'').splitlines() + title=text[0]if text else '';status=text[1]if len(text)>1 else '' + parts=title.split('. ',1) + order=parts[0]if len(parts)==2 and parts[0].isdigit()else '' + name=parts[1]if order else title + names=name.replace('\\','/').split('/') + if len(names)>1: + leaf=names[-1][:-4]if names[-1].lower().endswith('.prj')else names[-1] + if leaf==names[-2]:name=leaf + picture=QIcon(index.data(Qt.ItemDataRole.DecorationRole));opt.text='';opt.icon=QIcon() + style=option.widget.style()if option.widget else QApplication.style() + style.drawControl(QStyle.ControlElement.CE_ItemViewItem,opt,painter,option.widget) + painter.save() + rect=option.rect.adjusted(12,11,-12,-10) + picture.paint(painter,QRect(rect.left(),rect.top()+7,20,20)) + left=rect.left()+31;available=rect.right()-left-(24 if order else 0) + font=QFont(option.font);font.setWeight(QFont.Weight.DemiBold);painter.setFont(font) + painter.setPen(QColor('#35577d')if option.state&QStyle.StateFlag.State_Selected else QColor('#526983')) + label=painter.fontMetrics().elidedText(name,Qt.TextElideMode.ElideRight,available) + painter.drawText(QRect(left,rect.top(),available,23),Qt.AlignmentFlag.AlignVCenter,label) + font.setWeight(QFont.Weight.Normal);font.setPointSizeF(max(8,option.font.pointSizeF()-1));painter.setFont(font) + colors={'执行中':'#8a744d','失败':'#a15f59','已完成':'#638775','待执行':'#6b8ba8'} + painter.setPen(QColor(colors.get(status,'#8999ac'))) + painter.drawText(QRect(left,rect.top()+27,available,19),Qt.AlignmentFlag.AlignVCenter,status) + if order: + painter.setPen(QColor('#94a4b8')) + painter.drawText(QRect(rect.right()-20,rect.top()+2,20,19),Qt.AlignmentFlag.AlignRight,order) + painter.restore() class TaskList(QWidget): @@ -16,8 +57,11 @@ class TaskList(QWidget): def __init__(self, on_open: Callable[[str], None]) -> None: super().__init__() self.setObjectName("taskNavigation") + self.setAttribute(Qt.WidgetAttribute.WA_StyledBackground, True) self._tasks = () self._selected_task_id = None + from .icons import icon + self._project_icon = icon('project') self.search = QLineEdit(objectName='taskSearch') self.search.setPlaceholderText('搜索任务名称、目录、备注') self.search.setClearButtonEnabled(True) @@ -34,6 +78,7 @@ class TaskList(QWidget): self.filter.setVisible(False) self.filter.setMaximumHeight(0) self.list = QListWidget(objectName="taskList") + self.list.setItemDelegate(TaskItemDelegate(self.list)) self.list.setTextElideMode(Qt.TextElideMode.ElideRight) self.list.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.new_button = QPushButton("新建", objectName="newTaskButton") @@ -44,23 +89,46 @@ class TaskList(QWidget): self.queue_button.setToolTip('按保存的执行顺序执行本批全部任务,不受搜索和显示排序影响。') self.up_button = QPushButton("上移任务", objectName="moveTaskUp") self.down_button = QPushButton("下移任务", objectName="moveTaskDown") - actions = QGridLayout() - actions.addWidget(self.new_button, 0, 0) - actions.addWidget(self.edit_button, 0, 1) - actions.addWidget(self.delete_button, 1, 0) - actions.addWidget(self.restore_button, 1, 1) - actions.addWidget(self.up_button, 2, 0) - actions.addWidget(self.down_button, 2, 1) - actions.addWidget(self.queue_button, 3, 0, 1, 2) + self.new_button.setProperty('appearance','quiet') + self.new_button.setText('新建任务') + self.new_button.setToolTip('从目录创建工程任务') + self.manage_menu=CommandMenu(self) + for button in (self.edit_button,self.restore_button,self.up_button,self.down_button): + self.manage_menu.add_button(button) + self.manage_menu.addSeparator() + self.manage_menu.add_button(self.delete_button) + self.manage_button=QToolButton(objectName='taskManageMenu') + self.manage_button.setText('任务管理') + self.manage_button.setIcon(icon('more')) + self.manage_button.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon) + self.manage_button.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup) + self.manage_button.setMenu(self.manage_menu) + self.manage_button.setProperty('appearance','quiet') + self.sort_menu=QMenu(self) + for i in range(self.sort.count()): + action=self.sort_menu.addAction(self.sort.itemText(i));action.setCheckable(True) + action.triggered.connect(lambda checked=False,index=i:self.sort.setCurrentIndex(index)if self.sort.isEnabled()else None) + self.sort_menu.aboutToShow.connect(lambda a=action,index=i:(a.setChecked(self.sort.currentIndex()==index),a.setEnabled(self.sort.isEnabled()))) + self.sort.setParent(self) + self.sort.hide() + sort_button=QToolButton(objectName='taskSortMenu');sort_button.setIcon(icon('sort')) + sort_button.setToolTip('显示排序不改变实际执行顺序') + sort_button.setMenu(self.sort_menu);sort_button.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup) + sort_button.setProperty('appearance','quiet') + heading=QHBoxLayout();heading.addWidget(QLabel('工程任务',objectName='taskSectionTitle'));heading.addStretch();heading.addWidget(self.new_button) + batch=QHBoxLayout();batch.addWidget(self.count,1);batch.addWidget(sort_button) + footer=QHBoxLayout();footer.addWidget(self.recycle_button);footer.addStretch();footer.addWidget(self.manage_button) + self.recycle_button.setProperty('appearance','quiet') + self.queue_button.setProperty('appearance','batch') layout = QVBoxLayout(self) - layout.setContentsMargins(8, 8, 8, 8) - layout.addWidget(QLabel('任务', objectName='taskSectionTitle')) + layout.setContentsMargins(10, 14, 10, 10) + layout.setSpacing(11) + layout.addLayout(heading) layout.addWidget(self.search) - layout.addWidget(self.sort) - layout.addWidget(self.recycle_button) - layout.addWidget(self.count) + layout.addLayout(batch) layout.addWidget(self.list, 1) - layout.addLayout(actions) + layout.addWidget(self.queue_button) + layout.addLayout(footer) def selected(): self._selected_task_id = self.current_task_id() on_open(self._selected_task_id or '') @@ -111,6 +179,7 @@ class TaskList(QWidget): 'completed': '已完成', 'failed': '失败', 'deleted': '已删除'} item = QListWidgetItem(prefix + str(getattr(task, "name")) + f"\n{labels.get(status, status)}") item.setData(Qt.ItemDataRole.UserRole, str(getattr(task, "task_id"))) + item.setIcon(self._project_icon) item.setToolTip(f'{task.name}\n{task.discovery_root or ""}\n{task.note}'.strip()) self.list.addItem(item) if getattr(task, "task_id") == selected: diff --git a/tests/ui/test_acrylic_material.py b/tests/ui/test_acrylic_material.py new file mode 100644 index 0000000..d6f48dc --- /dev/null +++ b/tests/ui/test_acrylic_material.py @@ -0,0 +1,160 @@ +"""Material policy and fallback must not leave a transparent, unreadable window.""" +import sys +import pytest +from PySide6.QtWidgets import QWidget +from dx_productivity.trial_task_center.ui.material import AcrylicController + + +class Backend: + def __init__(self, allowed=True, succeeds=True): + self.allowed=allowed + self.succeeds=succeeds + self.calls=[] + def available(self): + return self.allowed + def enable(self, hwnd): + self.calls.append(('enable',hwnd)) + return self.succeeds + def disable(self, hwnd): + self.calls.append(('disable',hwnd)) + + +def test_disabled_system_policy_never_enables_native_blur(qtbot): + window=QWidget();qtbot.addWidget(window) + backend=Backend(allowed=False) + material=AcrylicController(window,backend=backend) + material.refresh() + assert not window.property('acrylicEnabled') + assert not backend.calls + + +def test_native_api_rejection_keeps_an_opaque_fallback(qtbot): + window=QWidget();qtbot.addWidget(window) + backend=Backend(succeeds=False) + material=AcrylicController(window,backend=backend) + material.refresh() + assert backend.calls[0][0]=='enable' + assert not window.property('acrylicEnabled') + + +def test_reducing_transparency_disables_native_composition_and_can_restore(qtbot): + window=QWidget();qtbot.addWidget(window) + backend=Backend() + material=AcrylicController(window,backend=backend) + material.refresh() + assert window.property('acrylicEnabled') + material.set_reduced_transparency(True) + assert not window.property('acrylicEnabled') + assert backend.calls[-1][0]=='disable' + material.set_reduced_transparency(False) + assert window.property('acrylicEnabled') + assert backend.calls[-1][0]=='enable' + + +def test_transparency_toggle_batches_native_transition_without_intermediate_repaint(qtbot): + window=QWidget();qtbot.addWidget(window) + observed=[] + class ObservingBackend(Backend): + def enable(self, hwnd): + observed.append(('enable',window.updatesEnabled())) + return super().enable(hwnd) + def disable(self, hwnd): + observed.append(('disable',window.updatesEnabled())) + return super().disable(hwnd) + backend=ObservingBackend() + material=AcrylicController(window,backend=backend) + material.refresh() + observed.clear() + material.set_reduced_transparency(True) + assert observed==[('disable',False)] + observed.clear() + material.set_reduced_transparency(False) + assert observed==[('enable',False)] + + +def test_live_system_policy_change_falls_back_without_touching_business_state(qtbot): + window=QWidget();qtbot.addWidget(window) + window.setProperty('selectedTask','task-a') + backend=Backend() + material=AcrylicController(window,backend=backend) + material.refresh() + backend.allowed=False + material.refresh() + assert not window.property('acrylicEnabled') + assert window.property('selectedTask')=='task-a' + assert backend.calls[-1][0]=='disable' + + +def test_repeated_refresh_does_not_reconfigure_composition(qtbot): + window=QWidget();qtbot.addWidget(window) + backend=Backend() + material=AcrylicController(window,backend=backend) + material.refresh();material.refresh() + assert len(backend.calls)==1 + + +def test_backend_exception_uses_solid_surface(qtbot): + window=QWidget();qtbot.addWidget(window) + class Broken(Backend): + def enable(self, hwnd): + raise OSError('composition unavailable') + material=AcrylicController(window,backend=Broken()) + material.refresh() + assert not window.property('acrylicEnabled') + + +def test_recreated_native_handle_releases_old_composition(qtbot,monkeypatch): + window=QWidget();qtbot.addWidget(window) + handle=[123] + monkeypatch.setattr(window,'winId',lambda:handle[0]) + backend=Backend() + material=AcrylicController(window,backend=backend) + material.refresh() + handle[0]=456 + material.refresh() + assert backend.calls==[('enable',123),('disable',123),('enable',456)] + + +@pytest.mark.skipif(sys.platform!='win32',reason='Windows policy API') +def test_windows_material_respects_transparency_high_contrast_and_remote(monkeypatch): + import winreg + from types import SimpleNamespace + from dx_productivity.trial_task_center.ui import material + class User: + high_contrast=False + remote=False + def SystemParametersInfoW(self,action,size,pointer,flags): + pointer._obj.flags=int(self.high_contrast) + return True + def GetSystemMetrics(self,index): + return int(self.remote) + user=User() + native=material.WindowsAcrylic.__new__(material.WindowsAcrylic) + native._user=user + monkeypatch.setattr(material.sys,'getwindowsversion',lambda:SimpleNamespace(build=26200)) + monkeypatch.setattr(material.QGuiApplication,'platformName',lambda:'windows') + monkeypatch.setattr(winreg,'QueryValueEx',lambda *args:(1,winreg.REG_DWORD)) + assert native.available() + user.high_contrast=True + assert not native.available() + user.high_contrast=False;user.remote=True + assert not native.available() + user.remote=False + monkeypatch.setattr(winreg,'QueryValueEx',lambda *args:(0,winreg.REG_DWORD)) + assert not native.available() + + +def test_real_window_has_svg_controls_and_persistent_material_preference(ui): + window=ui.window + assert not window.run_panel.quick_run_button.icon().isNull() + assert not window.task_center_navigation.icon().isNull() + assert window.project_summary.parent() is not window.run_panel.parent() + window.reduced_transparency_button.setChecked(True) + assert not window.property('acrylicEnabled') + assert window._layout_settings.value('appearance/reduced_transparency',False,type=bool) + surface=window.grab().toImage().pixelColor(2,window.menuWidget().height()+2) + assert surface.alpha()==255 and surface.blue()>=235 + window.mapping_tabs.setCurrentIndex(1) + image=window.plan_panel.table.viewport().grab().toImage() + color=image.pixelColor(image.width()-8,image.height()-8) + assert color.alpha()==255 and min(color.red(),color.green(),color.blue())>=245 diff --git a/tests/ui/test_ui_polish.py b/tests/ui/test_ui_polish.py new file mode 100644 index 0000000..f82d4e2 --- /dev/null +++ b/tests/ui/test_ui_polish.py @@ -0,0 +1,169 @@ +"""Visible feedback and keyboard actions obey the existing plan gates.""" +from PySide6.QtCore import Qt +from PySide6.QtWidgets import QLineEdit +from dx_productivity.trial_task_center.target_plan import ComponentTarget,TargetPlanRow + + +def seed_plan(ui): + task=ui.tasks[0] + project=ui.store.list_projects(task.task_id)[0].path + rows=tuple(TargetPlanRow(ComponentTarget(project,'MAIN','1',f'polish-{i}',ref,'OLD','100nF'),i==0,'NEW') + for i,ref in enumerate(('RV05','RV11','C103'))) + ui.store.record_target_inventory(task.task_id,tuple(row.target for row in rows)) + ui.service.replace_target_plan(task.task_id,rows) + ui.open(task);ui.settle() + ui.window.mapping_tabs.setCurrentIndex(1) + return ui.window.plan_panel + + +def test_search_feedback_and_no_match_state_are_visible(ui): + panel=seed_plan(ui) + panel.find_text.setText('RV');panel.find() + assert panel.find_result.isVisible() + assert '2 / 3'in panel.find_result.text() + assert panel.next_match_action.isEnabled() + panel.find_text.setText('NOT-PRESENT');panel.find() + assert not panel.next_match_action.isEnabled() + assert panel.table.empty_hint.isVisible() + assert '没有匹配'in panel.table.empty_hint.text() + panel.clear_find() + assert not panel.find_result.isVisible() + assert panel.table.rowCount()==3 + assert not panel.table.empty_hint.isVisible() + + +def test_clean_plan_cannot_be_resaved_and_dirty_plan_can(ui): + panel=seed_plan(ui) + assert not panel.save_button.isEnabled() + assert '已保存'in panel.save_state.text() + panel.table.model().setData(panel.table.model().index(0,6),'NEW-EDIT') + assert panel.save_button.isEnabled() + assert '未保存'in panel.save_state.text() + panel.save_shortcut.trigger();ui.settle() + assert not panel.table.dirty + assert not panel.save_button.isEnabled() + assert any(row.new_part_number=='NEW-EDIT'for row in ui.service.target_plan(ui.tasks[0].task_id)) + + +def test_bulk_edit_requires_selected_rows_and_nonempty_input(ui): + panel=seed_plan(ui) + panel.table.clearSelection();panel.bulk_part.setText('BULK') + assert not panel.bulk_apply.isEnabled() + panel.table.selectRow(1) + assert panel.bulk_apply.isEnabled() + assert '1'in panel.bulk_apply.text() + panel.bulk_part.clear() + assert not panel.bulk_apply.isEnabled() + assert all(row.new_part_number=='NEW'for row in panel.table.rows()) + + +def test_keyboard_save_does_not_bypass_readonly_state(ui): + panel=seed_plan(ui) + panel.table.model().setData(panel.table.model().index(0,6),'UNSAVED') + panel.set_plan_editable(False) + panel.save_shortcut.trigger();ui.settle() + assert panel.table.dirty + assert all(row.new_part_number=='NEW'for row in ui.service.target_plan(ui.tasks[0].task_id)) + panel.discard_all() + + +def test_find_shortcut_focuses_existing_search(ui,qtbot): + panel=seed_plan(ui) + panel.find_shortcut.trigger() + assert panel.find_text.hasFocus() + assert panel.find_shortcut.shortcut().toString()=='Ctrl+F' + + +def test_keyboard_save_commits_current_cell_editor_before_saving(ui,qtbot): + panel=seed_plan(ui) + index=panel.table.model().index(0,6) + panel.table.setCurrentIndex(index);panel.table.setFocus();panel.table.edit(index) + editor=panel.table.findChild(QLineEdit) + assert editor is not None + editor.setText('NEW-TYPED') + assert not panel.table.dirty + panel.save_shortcut.trigger();ui.settle() + assert any(row.new_part_number=='NEW-TYPED'for row in ui.service.target_plan(ui.tasks[0].task_id)) + + +def test_active_cell_enables_save_but_escape_cancels_without_dirtying(ui,qtbot): + panel=seed_plan(ui) + index=panel.table.model().index(0,6) + panel.table.setCurrentIndex(index);panel.table.setFocus();panel.table.edit(index) + editor=panel.table.findChild(QLineEdit) + editor.setText('NOT-COMMITTED') + assert not panel.table.dirty + assert panel.save_button.isEnabled() + assert panel.has_unsaved_plans() + qtbot.keyClick(editor,Qt.Key.Key_Escape);qtbot.wait(20) + assert not panel.table.dirty + assert not panel.save_button.isEnabled() + + +def test_discard_closes_active_editor_without_committing_it(ui): + panel=seed_plan(ui) + index=panel.table.model().index(0,6) + panel.table.setCurrentIndex(index);panel.table.setFocus();panel.table.edit(index) + panel.table.findChild(QLineEdit).setText('DISCARD-ME') + panel.discard_all() + assert not panel.table.has_pending_editor() + assert not panel.has_unsaved_plans() + assert all(row.new_part_number=='NEW'for row in panel.table.rows()) + + +def test_mouse_save_commits_active_cell_text(ui,qtbot): + panel=seed_plan(ui) + index=panel.table.model().index(0,6) + panel.table.setCurrentIndex(index);panel.table.setFocus();panel.table.edit(index) + panel.table.findChild(QLineEdit).setText('NEW-MOUSE') + qtbot.mouseClick(panel.save_button,Qt.MouseButton.LeftButton);ui.settle() + assert any(row.new_part_number=='NEW-MOUSE'for row in ui.service.target_plan(ui.tasks[0].task_id)) + + +def test_full_project_title_remains_available_when_narrow(ui,qtbot): + title=ui.window.project_summary.name + value='Very long project name with a distinctive suffix '*8 + title.setText(value) + ui.window.resize(980,700);qtbot.wait(30) + assert ui.window.width()==980 + assert title.text()==value + assert title.toolTip()==value + + +def test_project_summary_status_does_not_repeat_current_project_scope(ui): + ui.open(ui.tasks[0]); ui.settle() + status=ui.window.project_summary.state.text() + assert not status.startswith('当前工程') + + +def test_target_table_header_stays_connected_and_supports_horizontal_layout(ui,qtbot): + panel=seed_plan(ui) + table=panel.table + header=table.horizontalHeader() + ui.window.resize(980,700); qtbot.wait(30) + assert header.sectionsMovable() + assert not header.stretchLastSection() + assert table.horizontalScrollMode()==table.ScrollMode.ScrollPerPixel + assert table.horizontalScrollBarPolicy()==Qt.ScrollBarPolicy.ScrollBarAsNeeded + assert table.horizontalScrollBar().maximum()>0 + original=header.sectionSize(6) + header.resizeSection(6,original+40) + assert header.sectionSize(6)==original+40 + header.moveSection(0,2) + assert header.visualIndex(0)==2 + assert table.horizontalHeader().logicalIndex(2)==0 + + +def test_rule_table_header_supports_the_same_horizontal_layout(ui,qtbot): + table=ui.window.mapping_table + ui.window.resize(980,700); qtbot.wait(30) + header=table.horizontalHeader() + assert header.sectionsMovable() + assert not header.stretchLastSection() + assert table.horizontalScrollMode()==table.ScrollMode.ScrollPerPixel + assert table.horizontalScrollBar().maximum()>0 + original=header.sectionSize(0) + header.resizeSection(0,original+24) + assert header.sectionSize(0)==original+24 + header.moveSection(0,1) + assert header.visualIndex(0)==1 diff --git a/tests/ui/test_workspace_redesign.py b/tests/ui/test_workspace_redesign.py new file mode 100644 index 0000000..5bb139c --- /dev/null +++ b/tests/ui/test_workspace_redesign.py @@ -0,0 +1,61 @@ +"""The redesigned chrome keeps real command gates and data surfaces intact.""" +from PySide6.QtCore import Qt +from PySide6.QtWidgets import QPushButton,QWidget + + +def test_menu_commands_follow_live_enabled_and_visible_state(qtbot): + from dx_productivity.trial_task_center.ui.command_menu import CommandMenu + owner=QWidget();qtbot.addWidget(owner) + button=QPushButton('诊断',owner) + called=[];button.clicked.connect(lambda:called.append(True)) + menu=CommandMenu(owner) + action=menu.add_button(button) + menu.sync() + assert action.isEnabled()and action.isVisible() + action.trigger();assert called==[True] + button.setEnabled(False);menu.sync() + assert not action.isEnabled() + action.trigger();assert called==[True] + button.setEnabled(True);button.hide();menu.sync() + assert not action.isVisible() + action.trigger();assert called==[True] + + +def test_task_management_is_a_menu_and_new_task_is_at_the_top(ui): + panel=ui.window.task_list + assert panel.new_button.geometry().top()plan.table.geometry().bottom() + assert not plan.find_button.isVisible() + assert plan.find_text.isClearButtonEnabled() + + +def test_execution_maintenance_menu_keeps_diagnostics_available(ui): + run=ui.window.run_panel + assert run.more_button.isVisible() + assert not run.diagnostics_button.isVisible() + run.more_menu.sync() + diagnostic=next(a for a in run.more_menu.actions()if a.text()==run.diagnostics_button.text()) + assert diagnostic.isVisible()and diagnostic.isEnabled() + assert run.quick_run_button.isVisible() + assert run.toggle_log_button.isVisible() + + +def test_redesign_small_window_keeps_save_and_execute_visible(ui,qtbot): + window=ui.window;window.mapping_tabs.setCurrentIndex(1);window.resize(980,700);qtbot.wait(40) + assert window.width()==980 and window.height()==700 + assert window.plan_panel.table.viewport().height()>=100 + for button in [window.plan_panel.save_button,window.run_panel.quick_run_button,window.task_list.new_button]: + rect=button.rect();point=button.mapTo(window,rect.bottomRight()) + assert point.x()sidebar[1] and table[3]>table[1] + a=captures['native-app-backdrop-a'];b=captures['native-app-backdrop-b'] + mean=lambda image:sum(ImageStat.Stat(image).mean)/3 + difference=ImageChops.difference(a,b) + report['sidebar_backdrop_difference']=mean(difference.crop(sidebar)) + report['opaque_table_backdrop_difference']=mean(difference.crop(table)) + report['right_header_backdrop_difference']=mean(difference.crop(header)) + report['right_execution_backdrop_difference']=mean(difference.crop(execution)) + assert report['sidebar_backdrop_difference']>2,report + assert report['right_header_backdrop_difference']>2,report + assert report['right_execution_backdrop_difference']>2,report + assert report['opaque_table_backdrop_difference']<1.5,report + window.plan_panel.find_text.setText('RV');window.plan_panel.find() + report['visible_search_feedback']=window.plan_panel.find_result.isVisible() + assert '2 / 6'in window.plan_panel.find_result.text() + capture('native-app-search') + window.plan_panel.find_text.setText('NO-MATCH');window.plan_panel.find() + report['empty_search_feedback']=window.plan_panel.table.empty_hint.isVisible() + assert report['empty_search_feedback'] + capture('native-app-empty-search') + window.plan_panel.clear_find();window.plan_panel.table.clearSelection() + window.reduced_transparency_button.setChecked(True);capture('native-app-solid') + assert not window.property('acrylicEnabled') + solid=captures['native-app-solid'] + report['solid_sidebar_mean']=ImageStat.Stat(solid.crop(sidebar)).mean + assert min(report['solid_sidebar_mean'])>200,report + report['solid_fallback']=True + window.reduced_transparency_button.setChecked(False);settle(.3) + window.resize(980,700);capture('native-app-compact') + report['compact_size']=[window.width(),window.height()] + report['compact_table_height']=window.plan_panel.table.viewport().height() + assert report['compact_size']==[980,700] + assert report['compact_table_height']>=100 + window.project_options_button.setChecked(True);settle(.2) + report['options_exposed']=window.run_panel.copy_value_check.isVisible() + window.plan_panel.discard_all();window.close();settle(.3);store.close();logging.shutdown() + background.close();app.processEvents() + (out/'acceptance.json').write_text(json.dumps(report,ensure_ascii=False,indent=2)+'\n',encoding='utf-8') + print(json.dumps(report,ensure_ascii=True)) +if __name__=='__main__':main()