diff --git a/web/docs/current/desktop-gui-build-fixes.patch b/web/docs/current/desktop-gui-build-fixes.patch new file mode 100644 index 00000000..d189e2ef --- /dev/null +++ b/web/docs/current/desktop-gui-build-fixes.patch @@ -0,0 +1,231 @@ +From 00e0097969bfb0b0490525bbcee449a6a371e4c7 Mon Sep 17 00:00:00 2001 +From: wangdequan +Date: Sat, 14 Nov 2026 06:10:38 +0800 +Subject: [PATCH] Pause parity work: handoff, parameter sync, Python console + scaffold + +Co-Authored-By: Claude Code +--- + .../current/desktop-parity-continuation.md | 16 +++++++ + web/src/project-shell.tsx | 23 +++++++-- + web/src/shell/bottom-dock.tsx | 33 +++++++++---- + web/src/shell/preferences-dialog.tsx | 7 ++- + web/src/shell/python-console.tsx | 48 +++++++++++++++++++ + 5 files changed, 112 insertions(+), 15 deletions(-) + create mode 100644 web/src/shell/python-console.tsx + +diff --git a/web/docs/current/desktop-parity-continuation.md b/web/docs/current/desktop-parity-continuation.md +index f08e5188..27e8fdde 100644 +--- a/web/docs/current/desktop-parity-continuation.md ++++ b/web/docs/current/desktop-parity-continuation.md +@@ -113,6 +113,22 @@ + - TemplatePyMod 选择后 workbenchValue 为空(特殊工作台); + - 证据:`desktop-parity-evidence/-web{,-audit}.png/json`。 + ++## 最新增量(2026-11-14,暂停前) ++ ++- **PartDesign/Sketcher ownership handoff 已实现(真实动作)**:Part 文档切换到 ++ PartDesign/Sketcher 时不再只报错,而是调用 `launchSpecialized("ParametricBody")` ++ 创建 PartDesign 拥有的新文档。实测选择 PartDesign 后 `workbench=PartDesign`, ++ 状态栏 “PartDesign document created for PartDesign ownership handoff”。 ++- **原生参数同步**:Preferences `onApply` 通过 `requestOwnerParameters` 写入 ++ `BaseApp/Preferences/General/UnitSchema` 与 `View/NavigationStyle`; ++ 后台验证因 5181 导航前置失败(exit 1)未完成,属于前置未满足。 ++- **Python 控制台**:`shell/python-console.tsx` 已加入底停靠 Python tab, ++ 使用 `python-runtime.worker.ts`;首次冒烟返回 `ready` 错误包,**尚未验证成功执行**。 ++- **浮动/全屏停靠**:BottomDock 增加“浮动/停靠”“全屏”按钮;尚未截图验收。 ++- **Measure/MassProperties 原生桥**:命令面板/快捷键命中时直接打开原生任务, ++ 实测 `Std_MassProperties` 状态为 “opened native measure task”。 ++- **命令面板**:默认包含 Web/Std/Show/Measure/Material,`Std_MassProperties` 可检索。 ++ + ## 真实残余 + + - 统一桌面壳尚未实现:project-shell 仍只支持 9 个 workbench、菜单仅 Start/File/Edit/View/Part; +diff --git a/web/src/project-shell.tsx b/web/src/project-shell.tsx +index b3439bc4..c62ea14f 100644 +--- a/web/src/project-shell.tsx ++++ b/web/src/project-shell.tsx +@@ -76,7 +76,7 @@ import { DeltaReferencePanel, LineReferencePanel } from "./delta-reference-panel + import type { MeshPayload } from "./worker-protocol.js"; + import { ImportRenderBridge } from "./import-render-bridge.js"; + import { registerTestMdiHost } from "./test-desktop-adapter.js"; +-import { navigationPreferenceSource, requestOwnerParameters, SPREADSHEET_PARAMETER_PATH } from "./view-navigation-preferences.js"; ++import { navigationPreferenceSource, requestOwnerParameters, GENERAL_PARAMETER_PATH, VIEW_PARAMETER_PATH, SPREADSHEET_PARAMETER_PATH } from "./view-navigation-preferences.js"; + import { IMPORT_DESKTOP_COMMANDS, importDesktopPayload, type ImportDesktopCommand } from "./import-desktop-adapter.js"; + import { readImportExportSettings } from "./import-export-preferences.js"; + import { RecoveryController } from "./recovery-controller.js"; +@@ -2005,7 +2005,11 @@ function App() { + } + if ((next === "Sketcher" || next === "PartDesign") && !designDocuments.current.has(active)) { + if (nativeDocuments.current.has(active) || objects.length) { +- setStatus("This Part document needs a native ownership handoff before editing in PartDesign. Create a new document for Sketcher/PartDesign."); return; ++ setStatus(`Creating a PartDesign-owned document for ${next} ownership handoff…`); ++ void launchSpecialized("ParametricBody").then(created => { ++ if (created) setStatus(`PartDesign document created for ${next} ownership handoff`); ++ }); ++ return; + } + designDocuments.current.add(active); + } +@@ -3201,7 +3205,20 @@ function App() { + {referenceOpen && setReferenceOpen(false)} />} + {parityTask && setParityTask(null)} />} +- {preferencesOpen && setPreferencesOpen(false)} />} ++ {preferencesOpen && setPreferencesOpen(false)} onApply={async preferences => { ++ if (!active) return; ++ const unitSchema = preferences.unitSystem.startsWith("MKS") ? 1 ++ : preferences.unitSystem.startsWith("Imperial") ? 3 ++ : preferences.unitSystem.startsWith("Building US") ? 7 ++ : preferences.unitSystem.startsWith("Building cm") ? 4 : 0; ++ try { ++ await requestOwnerParameters(router, "DocumentProbe", nativeName(active), { path: GENERAL_PARAMETER_PATH, ++ operation: "set", name: "UnitSchema", type: "Int", value: unitSchema }); ++ await requestOwnerParameters(router, "DocumentProbe", nativeName(active), { path: VIEW_PARAMETER_PATH, ++ operation: "set", name: "NavigationStyle", type: "String", value: preferences.navigationStyle }); ++ setStatus("Preferences synced to BaseApp/Preferences"); ++ } catch (error) { setStatus(`Preferences native sync failed: ${String((error as Error)?.message ?? error)}`); } ++ }} />} + {shortcutsOpen && setShortcutsOpen(false)} />} + {paletteOpen && setPaletteOpen(false)} />} + {bottomDockOpen && void; + }) { +- const [tab, setTab] = useState<"selection" | "report">("selection"); +- return
++ const [tab, setTab] = useState<"selection" | "report" | "python">("selection"); ++ const [floating, setFloating] = useState(false); ++ const section = useRef(null); ++ const floatStyle = floating ? { left: "auto", right: 20, width: 560, height: 300, bottom: 46 } : undefined; ++ return
+ +
+ + +- ++ ++
++ ++ ++ ++
+
+-
+- {tab === "selection" +- ? (selection.length ? selection.map(item =>

{item}

) :

No selection

) +- : (report.length ? report.map((item, index) =>

{item}

) :

No messages

)} +-
++ {tab === "python" ?
++ :
++ {tab === "selection" ++ ? (selection.length ? selection.map(item =>

{item}

) :

No selection

) ++ : (report.length ? report.map((item, index) =>

{item}

) :

No messages

)} ++
} +
; + } +diff --git a/web/src/shell/preferences-dialog.tsx b/web/src/shell/preferences-dialog.tsx +index 4f504cac..fda35e87 100644 +--- a/web/src/shell/preferences-dialog.tsx ++++ b/web/src/shell/preferences-dialog.tsx +@@ -24,7 +24,7 @@ export const loadWebPreferences = (): WebPreferences => { + } + }; + +-export function PreferencesDialog({ onClose }: { onClose: () => void }) { ++export function PreferencesDialog({ onClose, onApply }: { onClose: () => void; onApply?: (preferences: WebPreferences) => void | Promise }) { + const [preferences, setPreferences] = useState(loadWebPreferences); + const hydrated = useRef(false); + useEffect(() => { +@@ -35,7 +35,10 @@ export function PreferencesDialog({ onClose }: { onClose: () => void }) { + }, []); + useEffect(() => { + localStorage.setItem(KEY, JSON.stringify(preferences)); +- if (hydrated.current) void saveSettings("web-preferences.json", preferences); ++ if (hydrated.current) { ++ void saveSettings("web-preferences.json", preferences); ++ void onApply?.(preferences); ++ } + window.dispatchEvent(new Event("freecad-preferences-changed")); + }, [preferences]); + const update = (key: K, value: WebPreferences[K]) => +diff --git a/web/src/shell/python-console.tsx b/web/src/shell/python-console.tsx +new file mode 100644 +index 00000000..f670419e +--- /dev/null ++++ b/web/src/shell/python-console.tsx +@@ -0,0 +1,48 @@ ++import React, { useEffect, useState } from "react"; ++import { createPythonRuntimeRequest, type PythonRuntimeResponse } from "../python-runtime-facade.js"; ++import { createCancel } from "../facade-envelope.js"; ++ ++export function PythonConsole() { ++ const [expression, setExpression] = useState("6 * 7"); ++ const [response, setResponse] = useState(null); ++ const [status, setStatus] = useState("正在加载 Python WASM runtime…"); ++ const [ready, setReady] = useState(false); ++ const [running, setRunning] = useState(null); ++ const [worker] = useState(() => new Worker(new URL("../python-runtime.worker.ts", import.meta.url), { type: "module" })); ++ useEffect(() => { ++ worker.onmessage = (event: MessageEvent) => { ++ const message = event.data; ++ if (message.kind === "ready") { setReady(true); setStatus("Python WASM runtime ready"); return; } ++ if (message.kind === "reset") { setResponse(null); setRunning(null); setStatus("Python runtime reset"); return; } ++ setResponse(message); setRunning(null); ++ setStatus(message.kind === "result" ? "Python expression complete" : message.error.code); ++ }; ++ return () => worker.terminate(); ++ }, [worker]); ++ const run = () => { ++ if (!ready || !expression.trim()) return; ++ const requestId = `shell-python-${Date.now()}`; ++ setRunning(requestId); setStatus("Executing Python expression…"); ++ worker.postMessage(createPythonRuntimeRequest(requestId, { schema: "freecad-web-python/runtime-eval/v1", module: "Python", action: "eval", expression })); ++ }; ++ return
++ ++