Files
wangdequan 789e18ca3e
Some checks failed
FreeCAD master CI / Prepare (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
FreeCAD master CI / Pixi (push) Has been cancelled
FreeCAD master CI / Ubuntu (push) Has been cancelled
FreeCAD master CI / Windows (push) Has been cancelled
FreeCAD master CI / Lint (push) Has been cancelled
FreeCAD master CI / WrapUp (push) Has been cancelled
Stale Issues / stale (push) Has been cancelled
CodeQL Advanced (c-cpp) / Analyze (c-cpp) (push) Has been cancelled
Push Crowdin Translations / update-crowdin (push) Has been cancelled
Fetch Crowdin Translations / update-crowdin (push) Has been cancelled
Build Release / upload_src (push) Has been cancelled
Build Release / build (10.13, macos-15-intel, osx-64) (push) Has been cancelled
Build Release / build (11.0, macos-latest, osx-arm64) (push) Has been cancelled
Build Release / build (15.0, macos-latest, osx-arm64) (push) Has been cancelled
Build Release / build (ubuntu-22.04, linux-64) (push) Has been cancelled
Build Release / build (ubuntu-22.04-arm, linux-arm64) (push) Has been cancelled
Build Release / build (windows-latest, win-64) (push) Has been cancelled
Monthly issue metrics / issue metrics (push) Has been cancelled
Continue FreeCAD Web UI parity repairs
2026-09-23 14:03:56 +08:00

47 lines
3.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 共享工具栏偏好持久化与失败恢复补漏
状态:本次具体缺口已实现,未验证。属于原任务 `operator-gap-tux-persistent-toolbars-enabled-startup`,不新增孤立任务。
## 源码差异与修改
桌面依据:`freecad-source/src/Mod/Tux/InitGui.py` 以 `Tux/PersistentToolbars/Enabled` 原生 Bool 决定是否加载持久工具栏,缺省为 true。
原 Web 实现虽然在 restoreToolbars/saveToolbars 中读取 Enabled,但 `toolbarParameters` 只导出/恢复 User 子组。此前任务记录声称快照已携带根 Bool,与本轮读取到的代码不一致。只有偏好开关读写路由,无法保证关闭后重载仍关闭。
本次在 `web/src/toolbar-preferences.ts` 集中修复:
- 共同保存根 Enabled 和原生 User FCParam 内容。内部快照带 schema,保存为 `Std_DlgParameter-PersistentToolbars.json`,继续使用现有 OPFS saved/persist 和广播通道,不向用户暴露 JSON 操作。
- 首次恢复优先读新快照,兼容已有 `Std_DlgParameter-PersistentToolbars.FCParam`;旧 User-only 快照不覆盖当前原生 Enabled。开关缺省、显式 false/0 均按原生语义处理。
- 导入、保存失败时恢复 User 和 Enabled。快照不导出 System/addTop/addLeft/addRight/addBottom,因此这些原生会话预设保留。
- 仅快照真正变化时落盘/广播。关闭持久化后临时调整布局不会写入保存布局,也不再触发一次无意义的广播刷新将临时排列立刻恢复。
- 原生请求仍使用 requestOwnerParameters;保存、参数面板和恢复共享同一串行参数入口。
在 `web/src/persistent-toolbar-workspace.tsx` 补齐同一工作流:
- 偏好恢复失败后提供 Retry toolbar preferences,避免按钮一直 disabled 且只能刷新页面。
- 每次恢复清除旧错误,沿用 revision 防止旧异步回调覆盖新文档/工作台。
- 排列面板打开时聚焦首个控件;Cancel/Escape 返回 Arrange toolbars 按钮。
- 旧工作台保存失败不覆盖当前工作台反馈。
## 复用与边界
复用包:
1. 既有原生 Enabled 默认值和布局排序/Break 逻辑,记录 `docs/current/operator-gap-tux-persistent-toolbars-enabled-startup-20260921/README.md`。
2. 既有 `view-navigation-preferences.ts::requestOwnerParameters`、OPFS saved/persist 及工具栏广播通道。
3. 既有 `persistent-toolbar-workspace.tsx` 的宿主、revision 和布局预览;不改变建模文档、任务草稿或历史。
路由:Std_DlgParameter → requestToolbarParameters → toolbarParameters → requestOwnerParameters → 已有 DocumentProbe/PartBox 原生参数接口。这里只处理 UI 偏好,无几何算法/OCCT/Three.js 计算变更。
## 本轮构建和接续
- 修改位置:上述两个 Web 源文件。无原生源码修改,无需原生构建。
- 必要前端构建:项目目录执行 `python3 tools/build_web_frontend.py`;使用现有 web 配置、依赖与快速链接产物。
- 日志:`docs/current/desktop-ui-toolbar-preferences-repair-20260923/build.log`;退出码 0;built in 1.63s,保留已有 chunk 大小提示。
- 未执行测试、类型检查、烟测、浏览器、截图或验收;不以构建成功宣称全部 UI 对标完成。
- 无本轮遗留构建进程。原单一调度器第 10783 轮继续处理 Part 当前文档 New Sketch,未启动第二调度器,未修改其正在开发的 project-shell 或原生源码。
- 本范围后续直接复用;剩余整体验收等待用户明确授权,不能自动启动。后续功能按原调度器队列继续。
处理模块 | 对标项 | 源码落点 | 路由入口 | OCCT 边界 | 状态 | 结论
--- | --- | --- | --- | --- | --- | ---
共享工具栏/Tux | Enabled 与布局保存、失败回滚、重试与焦点 | toolbar-preferences.ts;persistent-toolbar-workspace.tsx | Std_DlgParameter 与既有 toolbarParameters | 仅原生参数;无几何变更 | 已补漏(未验证) | 保留