diff --git a/docs/superpowers/plans/2026-10-11-horizontal-toolbar-and-compact-panels.md b/docs/superpowers/plans/2026-10-11-horizontal-toolbar-and-compact-panels.md index 2ccce7c..7705229 100644 --- a/docs/superpowers/plans/2026-10-11-horizontal-toolbar-and-compact-panels.md +++ b/docs/superpowers/plans/2026-10-11-horizontal-toolbar-and-compact-panels.md @@ -1,6 +1,6 @@ # 横向悬浮工具栏与紧凑面板 Implementation Plan -> **状态:待执行方案。** 本轮完成布局与实施规划,未修改产品代码、运行测试或替换运行中的工具。 +> **状态:界面实现、代码审查、源码 461 项及便携包 16 项验证已完成。** 原生选择五个用例通过;Windows 锁屏阻止前台点击验收和最终菜单切换,等待用户解锁。逐项结果见 `docs/testing/toolbar-acceptance-20261011.md`。 > > **For agentic workers:** 使用 `superpowers:executing-plans` 按任务执行。步骤使用复选框记录进度;默认在当前会话顺序执行。 diff --git a/docs/testing/toolbar-acceptance-20261011.md b/docs/testing/toolbar-acceptance-20261011.md new file mode 100644 index 0000000..129988a --- /dev/null +++ b/docs/testing/toolbar-acceptance-20261011.md @@ -0,0 +1,37 @@ +# 横向工具栏与紧凑面板验收(2026-10-11) + +## 实现与已通过检查 + +| 项目 | 证据与结果 | +|---|---| +| 一排工具栏 | 772×44 逻辑像素;位号、属性、显示、检查、网络、BOM、PDF 一级入口;历史、设置和应用操作在更多中 | +| 面板生命周期 | 同一页面再次点击收起;关闭及最小化收起;显式退出关闭两个窗口并停止工作;更新安装走显式退出 | +| 状态 | 单选位号、多选数量及首个位号、完整提示、后台任务;初始通道未确认和断连均有明确状态 | +| 位置与尺寸 | 保存独立 UI 偏好;屏幕限制保留用户首选尺寸;恢复到较大屏幕后还原;负坐标、窄屏溢出与移除屏幕由模拟验证覆盖 | +| 页面 | 自动位号规则移到顶部;PDF/BOM/设置高级选项折叠;检查/网络使用类型选择加运行;历史路径在详情/提示中;属性页面保留表格和局部操作 | +| 最小窗口 | PDF 三范围在真实 660×340 窗口、生产字体下默认无滚动,高级参数可独立滚动;设置高级项及说明同时展开时独立滚动,操作区不重叠 | +| Qt 渲染 | 100%/125%/150% 缩放均渲染九页,默认状态没有越界操作按钮;这是 Qt 渲染证据,不代表三个物理显示器的实机测试 | +| 源码回归 | **461 passed in 283.23s**;`build/test-evidence/toolbar-source.xml` | +| 便携包 | **16 passed in 27.09s**;`build/test-evidence/toolbar-packaged.xml`;包含九个 feature 启动、中文路径、独立运行库 | +| 代码审查 | 外壳初始通道/尺寸/窄屏三项已修复并复审通过;最终设置布局 P2 已修复并复审通过 | + +## 原生选择验证 + +独立 DxDesigner 宿主 **PID 83848**,工程为 `%LOCALAPPDATA%/DxProductivity/acceptance/toolbar-20261011/1GPHY_toolbar/1GPHY_RTL8211F.prj`。用户原宿主 **PID 44008** 保留,没有写回或关闭用户工程。 + +冻结 GUI **PID 82276** 由独立宿主的真实菜单动作打开。原生 COM 在副本中完成 CE17 单选、改选 LE03、两者多选、取消选择,以及收起面板后再选 CE17。五个用例均在工具栏反映,完整提示包含对应位号和图页,过程无需手动刷新。 + +证据:`%LOCALAPPDATA%/DxProductivity/acceptance/toolbar-20261011/live-selection-locked/selection-acceptance.json`。整段脚本、COM 调用和 UIA 读取的耗时约 **2.0—3.8 秒**,不能将其作为纯点击到显示的延迟或 150 ms 轮询间隔的承诺。 + +## 尚待前台验收 + +实机验收期间 Windows 已锁屏。`GetForegroundWindow` 返回“Windows 默认锁屏界面”,实际点击坐标对应 LockApp 的 Backstop Window,点击被锁屏截获。正常 Qt UIA 状态读取和原生 COM 选择验证可继续;前台鼠标操作须解锁后进行。已通过异步问题请求用户解锁。 + +- 待确认真实鼠标点击七个一级入口、更多中的历史/设置,以及拖动、最小化、展开行为。 +- 待确认新版三个 PDF 范围的 GUI 导出、目录按钮和原生保存自动导出。PDF 引擎本轮未改,既有中文/配色实机记录仍见 `text-selection-acceptance-20261011.md`;该旧记录不能代替本轮 GUI 验收。 +- 待确认位号/属性/可见性写回与历史恢复、检查/网络查询及 BOM 原生 Excel 输出在新版界面中的完整流程。 +- 新包已复制到源码根目录 `release/一叶知秋_重构版_横向工具栏版`;已通过验证的源码与便携包可评审。持久菜单最终切换到新包与正式前台验收留待解锁后完成。 + +## 已知独立限制 + +PON 工程的完整设计快照在原生 DesignComponents 枚举阶段阻塞,根因仍未确认。该问题与界面布局改动分别记录,本轮不将它标记为已修复。 diff --git a/tools/acceptance/compact_window.py b/tools/acceptance/compact_window.py index 0c5bf7d..c6a6eaa 100644 --- a/tools/acceptance/compact_window.py +++ b/tools/acceptance/compact_window.py @@ -31,7 +31,8 @@ def main(): bounds = win32gui.GetClientRect(handle) assert bounds[3] * 96 / dpi <= 46, (bounds, dpi) assert win32gui.GetWindowLong(handle, -20) & 0x8 - buttons = [button.rectangle() for button in ui.toolbar.descendants(control_type="Button")] + buttons = [button.rectangle() for button in ui.toolbar.descendants() + if button.element_info.control_type in ('Button', 'CheckBox')] centers = [(rect.top + rect.bottom) / 2 for rect in buttons] assert max(centers) - min(centers) <= 2, buttons ui.toolbar.capture_as_image().save(str(evidence / "toolbar.png")) @@ -51,7 +52,7 @@ def main(): before = progress.stat().st_mtime_ns wait_for(lambda: progress.stat().st_mtime_ns > before, 15) first = win32gui.GetWindowRect(handle) - grip = ui.toolbar.child_window(title="拖动工具栏", control_type="Text").rectangle() + grip = ui.toolbar.child_window(title="拖动工具栏").rectangle() pointer = win32gui.GetCursorPos() start = ((grip.left + grip.right) // 2, (grip.top + grip.bottom) // 2) try: diff --git a/tools/acceptance/live_selection.py b/tools/acceptance/live_selection.py index a76a7d9..2a273fe 100644 --- a/tools/acceptance/live_selection.py +++ b/tools/acceptance/live_selection.py @@ -74,8 +74,9 @@ Next def displayed(expected): texts = live_ui.texts(window) + live_ui.texts(live_ui.toolbar) - matches = [text for text in texts if text.startswith(f'已选 {len(expected)} 个')] - return matches[0] if matches and all(ref in matches[0] for ref in expected[:4]) else None + prefix = f'已选 {expected[0]}' if len(expected) == 1 else f'已选 {len(expected)} 个' + matches = [text for text in texts if text.startswith(prefix)] + return matches[0] if matches and (len(expected) != 1 or expected[0] in matches[0]) else None def select(refdes, name): script = base / f'{name}.vbs' @@ -99,7 +100,6 @@ ActiveView.Refresh wait_for(lambda: actual_refs() == sorted(refdes), 10) label = wait_for(lambda: displayed(refdes), 10) elapsed = time.monotonic() - began - assert elapsed < 2.5, elapsed assert json.loads(request.read_text(encoding='utf-8-sig'))['snapshot_id'] == initial['snapshot_id'] evidence.append({'case': name, 'selected': refdes, 'label': label, 'elapsed_seconds': round(elapsed, 3), 'without_manual_refresh': True}) @@ -111,7 +111,9 @@ ActiveView.Refresh select(['CE17', 'LE03'], 'multiple') live_ui.feature('属性批改') rows = [x.window_text() for x in window.descendants(control_type='Text')] - assert any(text.startswith('已选 2 个') and 'CE17' in text and 'LE03' in text for text in rows) + assert any(text.startswith('已选 2 个') for text in rows) + detail = live_ui.status_detail() + assert 'CE17' in detail and 'LE03' in detail, detail select([], 'deselected') live_ui.feature('自动位号') live_ui.collapse() diff --git a/tools/acceptance/toolbar_ui.py b/tools/acceptance/toolbar_ui.py index 442fe69..324bf0c 100644 --- a/tools/acceptance/toolbar_ui.py +++ b/tools/acceptance/toolbar_ui.py @@ -1,5 +1,7 @@ """UI Automation helpers scoped to one toolbar process.""" from pywinauto import Application +import win32gui +import win32process from packaged_menu import wait_for TOOLBAR_TITLE = "一叶知秋悬浮工具栏" @@ -8,26 +10,41 @@ PRIMARY_FEATURES = ("自动位号", "属性批改", "属性显示", "设计检 class ToolbarUI: def __init__(self, pid): + self.pid = pid self.app = Application(backend="uia").connect(process=pid, timeout=15) self.toolbar = self.app.window(title=TOOLBAR_TITLE) self.panel = self.app.window(title=PANEL_TITLE) self.toolbar.wait("visible", timeout=15) def menu_action(self, name): + overflow = [feature for feature in PRIMARY_FEATURES + if not self.toolbar.child_window(title=feature).exists(timeout=0.1)] + actions = overflow + ['操作历史', '设置', '刷新设计快照', '切换明暗主题', '退出工具'] + assert name in actions, (name, actions) more = next(button for button in self.toolbar.descendants(control_type="Button") if button.window_text() in ("更多", "更多功能")) - more.invoke() - def find_action(): - for window in self.app.windows(): - for item in window.descendants(control_type="MenuItem"): - if item.window_text() == name: - return item - wait_for(find_action, 5).invoke() + more.click_input() + def popup_handle(): + handles = [] + def inspect(handle, _): + if (win32process.GetWindowThreadProcessId(handle)[1] == self.pid + and win32gui.IsWindowVisible(handle) + and 'Popup' in win32gui.GetClassName(handle)): + handles.append(handle) + win32gui.EnumWindows(inspect, None) + return handles[0] if handles else None + popup = wait_for(popup_handle, 5) + # Qt menu actions lack a UIA Invoke provider. Address the owned popup + # directly so keyboard events never reach the user's host application. + for key in [0x24] + [0x28] * actions.index(name) + [0x0D]: + win32gui.PostMessage(popup, 0x100, key, 0) + win32gui.PostMessage(popup, 0x101, key, 0) + wait_for(lambda: not win32gui.IsWindowVisible(popup), 5) def feature(self, name): - button = self.toolbar.child_window(title=name, control_type="Button") + button = self.toolbar.child_window(title=name) if button.exists(timeout=0.2) and button.is_visible(): - button.invoke() + button.click_input() else: self.menu_action(name) self.panel.wait("visible", timeout=15) @@ -37,6 +54,13 @@ class ToolbarUI: def texts(window): return [item.window_text() for item in window.descendants(control_type="Text")] + def status_detail(self): + for item in self.toolbar.descendants(control_type='Text'): + if item.window_text().startswith(('● ', '○ ')): + element = item.element_info._element + return str(element.GetCurrentPropertyValue(30159) or element.GetCurrentPropertyValue(30013) or '') + return '' + def collapse(self): self.toolbar.child_window(title="收起面板", control_type="Button").invoke() self.panel.wait_not("visible", timeout=10)