Wire manifest workbench menus into project shell
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -75,6 +75,7 @@ const pythonCalls = (text, name) => {
|
||||
const calls = [];
|
||||
let index = 0;
|
||||
while ((index = text.indexOf(`${name}(`, index)) >= 0) {
|
||||
const callIndex = index;
|
||||
let cursor = index + name.length + 1;
|
||||
let depth = 1; let quote = "";
|
||||
for (; cursor < text.length; cursor++) {
|
||||
@@ -85,7 +86,7 @@ const pythonCalls = (text, name) => {
|
||||
if (char === ")" || char === "]") depth--;
|
||||
if (depth === 0) break;
|
||||
}
|
||||
calls.push(text.slice(index + name.length + 1, cursor));
|
||||
calls.push({ body: text.slice(callIndex + name.length + 1, cursor), index: callIndex });
|
||||
index = cursor + 1;
|
||||
}
|
||||
return calls;
|
||||
@@ -106,16 +107,24 @@ const splitPythonArgs = value => {
|
||||
};
|
||||
|
||||
const parsePythonGui = text => {
|
||||
const vars = new Map();
|
||||
const assignments = new Map();
|
||||
const push = (name, entry) => {
|
||||
if (!assignments.has(name)) assignments.set(name, []);
|
||||
assignments.get(name).push(entry);
|
||||
};
|
||||
for (const match of text.matchAll(/^\s*(?:self\.)?(\w+)\s*=\s*\[([\s\S]*?)\]\s*$/gm)) {
|
||||
vars.set(match[1], { type: "list", value: [...match[2].matchAll(/["']([^"']+)["']/g)].map(item => item[1]) });
|
||||
push(match[1], { pos: match.index, type: "list",
|
||||
value: [...match[2].matchAll(/["']([^"']+)["']/g)].map(item => item[1]) });
|
||||
}
|
||||
for (const match of text.matchAll(/^\s*(?:self\.)?(\w+)\s*=\s*QT_TRANSLATE_NOOP\([^,]+,\s*"([^"]*)"\)/gm)) {
|
||||
vars.set(match[1], { type: "label", value: match[2] });
|
||||
push(match[1], { pos: match.index, type: "label", value: match[2] });
|
||||
}
|
||||
const resolve = expr => {
|
||||
const variable = (name, at) => (assignments.get(name) ?? [])
|
||||
.filter(entry => entry.pos <= at).sort((a, b) => a.pos - b.pos).at(-1) ?? null;
|
||||
const resolve = (expr, at) => {
|
||||
const value = expr.trim();
|
||||
if (vars.has(value)) return vars.get(value);
|
||||
const found = variable(value.replace(/^self\./, ""), at);
|
||||
if (found) return found;
|
||||
if (/^\[/.test(value)) return { type: "list", value: [...value.matchAll(/["']([^"']+)["']/g)].map(item => item[1]) };
|
||||
const translated = /QT_TRANSLATE_NOOP\([^,]+,\s*"([^"]*)"\)/.exec(value);
|
||||
if (translated) return { type: "label", value: translated[1] };
|
||||
@@ -123,27 +132,27 @@ const parsePythonGui = text => {
|
||||
if (quoted) return { type: "label", value: quoted[1] };
|
||||
return null;
|
||||
};
|
||||
const resolveList = expr => {
|
||||
if (expr.includes("+")) return splitPythonArgs(expr.replace(/\+/g, ",")).flatMap(resolveList);
|
||||
const resolved = resolve(expr);
|
||||
const resolveList = (expr, at) => {
|
||||
if (expr.includes("+")) return splitPythonArgs(expr.replace(/\+/g, ",")).flatMap(part => resolveList(part, at));
|
||||
const resolved = resolve(expr, at);
|
||||
if (!resolved) return [];
|
||||
return resolved.type === "list" ? resolved.value : [resolved.value];
|
||||
};
|
||||
const menus = [];
|
||||
for (const body of pythonCalls(text, "appendMenu")) {
|
||||
const args = splitPythonArgs(body);
|
||||
for (const call of pythonCalls(text, "appendMenu")) {
|
||||
const args = splitPythonArgs(call.body);
|
||||
if (args.length < 2) continue;
|
||||
const labels = resolveList(args[0]);
|
||||
const items = resolveList(args.at(-1));
|
||||
const labels = resolveList(args[0], call.index);
|
||||
const items = resolveList(args.at(-1), call.index);
|
||||
for (const label of labels) menus.push({ label: label.replace(/^&/, ""), items: items.map(id =>
|
||||
({ type: id === "Separator" ? "separator" : "command", id })) });
|
||||
}
|
||||
const toolbars = [];
|
||||
for (const body of pythonCalls(text, "appendToolbar")) {
|
||||
const args = splitPythonArgs(body);
|
||||
for (const call of pythonCalls(text, "appendToolbar")) {
|
||||
const args = splitPythonArgs(call.body);
|
||||
if (args.length < 2) continue;
|
||||
const names = resolveList(args[0]);
|
||||
const items = resolveList(args[1]);
|
||||
const names = resolveList(args[0], call.index);
|
||||
const items = resolveList(args[1], call.index);
|
||||
for (const name of names) toolbars.push({ name: name.replace(/^&/, ""), items });
|
||||
}
|
||||
return { menus, toolbars };
|
||||
|
||||
@@ -39,7 +39,15 @@
|
||||
- 页面检查:`http://127.0.0.1:5181/shell-preview.html` 29 个 workbench、3 个工具栏、
|
||||
0 pageError、0 横向溢出;截图
|
||||
`web/docs/current/desktop-parity-evidence/shell-preview.png`。
|
||||
- 说明:预览页仅渲染清单与命令回调(记录 last command),尚未接入统一文档/执行路由。
|
||||
- **project-shell 已接入 manifest 工作台菜单**:
|
||||
- `web/src/shell/workbench-menu.tsx`:非 Part 工作台显示 manifest 菜单/子菜单;
|
||||
- Workbench 选择器扩展到 29 个模块(Part 保持原有 `PartWorkbenchMenu`);
|
||||
- 选中 BIM 后菜单显示 2D Drafting / 3D/BIM / Annotation / Manage / Flamingo /
|
||||
Fasteners / Utils;截图 `BIM-web-menu.png`;
|
||||
- Part 回归审计仍 0 错误/0 溢出;命令点击当前只写状态(execution wiring pending)。
|
||||
- Python InitGui 解析改为位置感知变量解析(`self.*`、重赋值、`+` 拼接),
|
||||
菜单命令 513、工具栏命令 362,gui-missing 降至 623。
|
||||
- 说明:preview 页仅渲染清单与命令回调;统一执行路由尚待 P2/P3。
|
||||
|
||||
## 真实残余
|
||||
|
||||
|
||||
BIN
web/docs/current/desktop-parity-evidence/BIM-web-menu.png
Normal file
BIN
web/docs/current/desktop-parity-evidence/BIM-web-menu.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 92 KiB |
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"schema": "freecad-web-desktop-gui-manifest/v1",
|
||||
"generatedAt": "2026-11-13T07:01:04.677Z",
|
||||
"generatedAt": "2026-11-13T08:14:19.076Z",
|
||||
"sourceRevision": {
|
||||
"matrix": "0f467b45c2ed0105bc3f9d58a6149f18a6dc65dd86a93fc6b4f53cd1a39cfe5c",
|
||||
"routes": "6b21e4b2a7b06f5516433771bba06d61d1e7f3daa0e9a68c83aad6e000b4a25a"
|
||||
@@ -161,6 +161,250 @@
|
||||
"id": "BIM",
|
||||
"source": "freecad-source/src/Mod/BIM/InitGui.py",
|
||||
"menus": [
|
||||
{
|
||||
"label": "2D Drafting",
|
||||
"items": [
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_Sketch"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Draft_Line"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Draft_Wire"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Draft_Rectangle"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_ArcTools"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Draft_Circle"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Draft_Ellipse"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Draft_Polygon"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_SplineTools"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Draft_Point"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Draft_Fillet"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "3D/BIM",
|
||||
"items": [
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_Site"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_Building"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_Level"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_Space"
|
||||
},
|
||||
{
|
||||
"type": "separator",
|
||||
"id": "Separator"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_Wall"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_CurtainWall"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_Column"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_Beam"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_Slab"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_Door"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_Window"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_Pipe"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_PipeConnector"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_Stairs"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_Roof"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_Panel"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_Frame"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_Fence"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_Truss"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_Equipment"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_Rebar"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_GenericTools"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Annotation",
|
||||
"items": [
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_DimensionAligned"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_DimensionHorizontal"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_DimensionVertical"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_Text"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_Leader"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Draft_Label"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Draft_Hatch"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_AxisTools"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_Grid"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_SectionPlane"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_Create2DViews"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_TDPage"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_TDView"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Manage",
|
||||
"items": [
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_Setup"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_ProjectManager"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_Windows"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_IfcManageTools"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_Layers"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_Material"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_ReportTools"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_Preflight"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Draft_AnnotationStyleEditor"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Flamingo",
|
||||
"items": [
|
||||
@@ -290,9 +534,245 @@
|
||||
"id": "screws"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Utils",
|
||||
"items": [
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_TogglePanels"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_Trash"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_WPView"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Draft_SelectGroup"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Draft_Slope"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Draft_WorkingPlaneProxy"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Draft_AddConstruction"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_SplitMesh"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_MeshToShape"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_SelectNonSolidMeshes"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_RemoveShape"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_CloseHoles"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_MergeWalls"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_Check"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_ToggleIfcBrepFlag"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_ToggleSubs"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_Survey"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_Diff"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_IfcExplorer"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_IfcSpreadsheet"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_ImagePlane"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_Unclone"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_Rewire"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_Glue"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_Reextrude"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_PanelTools"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Arch_StructureTools"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "BIM_Project"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"toolbars": [
|
||||
{
|
||||
"name": "Drafting Tools",
|
||||
"items": [
|
||||
"BIM_Sketch",
|
||||
"Draft_Line",
|
||||
"Draft_Wire",
|
||||
"Draft_Rectangle",
|
||||
"BIM_ArcTools",
|
||||
"Draft_Circle",
|
||||
"Draft_Ellipse",
|
||||
"Draft_Polygon",
|
||||
"BIM_SplineTools",
|
||||
"Draft_Point",
|
||||
"Draft_Fillet"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "3D/BIM Tools",
|
||||
"items": [
|
||||
"Arch_Site",
|
||||
"Arch_Building",
|
||||
"Arch_Level",
|
||||
"Arch_Space",
|
||||
"Separator",
|
||||
"Arch_Wall",
|
||||
"Arch_CurtainWall",
|
||||
"BIM_Column",
|
||||
"BIM_Beam",
|
||||
"BIM_Slab",
|
||||
"BIM_Door",
|
||||
"Arch_Window",
|
||||
"Arch_Pipe",
|
||||
"Arch_PipeConnector",
|
||||
"Arch_Stairs",
|
||||
"Arch_Roof",
|
||||
"Arch_Panel",
|
||||
"Arch_Frame",
|
||||
"Arch_Fence",
|
||||
"Arch_Truss",
|
||||
"Arch_Equipment",
|
||||
"Arch_Rebar",
|
||||
"BIM_GenericTools"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Annotation Tools",
|
||||
"items": [
|
||||
"BIM_DimensionAligned",
|
||||
"BIM_DimensionHorizontal",
|
||||
"BIM_DimensionVertical",
|
||||
"BIM_Text",
|
||||
"BIM_Leader",
|
||||
"Draft_Label",
|
||||
"Draft_Hatch",
|
||||
"BIM_AxisTools",
|
||||
"Arch_Grid",
|
||||
"Arch_SectionPlane",
|
||||
"BIM_Create2DViews",
|
||||
"BIM_TDPage",
|
||||
"BIM_TDView"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "General Tools",
|
||||
"items": [
|
||||
"Draft_Move",
|
||||
"Draft_Rotate",
|
||||
"Draft_Scale",
|
||||
"Draft_Mirror",
|
||||
"BIM_CloneTools",
|
||||
"BIM_Copy",
|
||||
"BIM_SimpleCopy",
|
||||
"BIM_Compound"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "2D Tools",
|
||||
"items": [
|
||||
"BIM_OffsetTools",
|
||||
"Draft_Trimex",
|
||||
"Draft_Join",
|
||||
"Draft_Split",
|
||||
"Draft_Stretch",
|
||||
"Draft_Draft2Sketch"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Object Tools",
|
||||
"items": [
|
||||
"Draft_Upgrade",
|
||||
"Draft_Downgrade",
|
||||
"Arch_Add",
|
||||
"Arch_Remove"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "3D Tools",
|
||||
"items": [
|
||||
"BIM_ArrayTools",
|
||||
"Arch_CutPlane",
|
||||
"BIM_Extrude",
|
||||
"BIM_BooleanTools"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Manage Tools",
|
||||
"items": [
|
||||
"BIM_Setup",
|
||||
"BIM_ProjectManager",
|
||||
"BIM_Windows",
|
||||
"BIM_IfcManageTools",
|
||||
"BIM_Layers",
|
||||
"BIM_Material",
|
||||
"BIM_ReportTools",
|
||||
"BIM_Preflight",
|
||||
"Draft_AnnotationStyleEditor"
|
||||
]
|
||||
}
|
||||
],
|
||||
"toolbars": [],
|
||||
"docks": []
|
||||
},
|
||||
{
|
||||
@@ -4254,15 +4734,133 @@
|
||||
"items": [
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Std_ViewExample1"
|
||||
"id": "Std_TestQM"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Std_ViewExample2"
|
||||
"id": "Std_TestReloadQM"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Std_ViewExample3"
|
||||
"id": "Test_Test"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Test_TestAll"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Test_TestDoc"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Test_TestBase"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "TestToolsGui",
|
||||
"items": [
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Std_TestQM"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Std_TestReloadQM"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Test_Test"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Test_TestAll"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Test_TestDoc"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Test_TestBase"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "TestToolsText",
|
||||
"items": [
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Test_TestAllText"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Test_TestDocText"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Test_TestBaseText"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "TestToolsMenu",
|
||||
"items": [
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Test_TestCreateMenu"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Test_TestDeleteMenu"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Test_TestWork"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "TestFeatureMenu",
|
||||
"items": [
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Test_InsertFeature"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Progress bar",
|
||||
"items": [
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Std_TestProgress1"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Std_TestProgress2"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Std_TestProgress3"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Std_TestProgress4"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Std_TestProgress5"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Console",
|
||||
"items": [
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Std_TestConsoleOutput"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -4271,15 +4869,15 @@
|
||||
"items": [
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Std_ViewExample1"
|
||||
"id": "Std_MDITest1"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Std_ViewExample2"
|
||||
"id": "Std_MDITest2"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"id": "Std_ViewExample3"
|
||||
"id": "Std_MDITest3"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -4305,9 +4903,10 @@
|
||||
{
|
||||
"name": "TestTools",
|
||||
"items": [
|
||||
"Std_ViewExample1",
|
||||
"Std_ViewExample2",
|
||||
"Std_ViewExample3"
|
||||
"Test_Test",
|
||||
"Test_TestAll",
|
||||
"Test_TestDoc",
|
||||
"Test_TestBase"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -8800,6 +9399,6 @@
|
||||
}
|
||||
},
|
||||
"commandCount": 1492,
|
||||
"menuCommandCount": 408,
|
||||
"toolbarCommandCount": 284
|
||||
"menuCommandCount": 513,
|
||||
"toolbarCommandCount": 362
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -82,6 +82,7 @@ import { readImportExportSettings } from "./import-export-preferences.js";
|
||||
import { RecoveryController } from "./recovery-controller.js";
|
||||
import { mountQueueRecoveryPanel } from "./queue-recovery-panel.js";
|
||||
import { PartDesignWorkspace } from "./partdesign-workspace-component.js";
|
||||
import { ParityWorkbenchMenu } from "./shell/workbench-menu.js";
|
||||
import { DocumentTree, type DocumentTreeNode } from "./document-tree.js";
|
||||
import { PARTDESIGN_DOCUMENT_COMMAND, PARTDESIGN_DOCUMENT_SCHEMA, type DesignAction, type DesignPayload, type DesignResult } from "./partdesign-document-facade.js";
|
||||
|
||||
@@ -1893,6 +1894,8 @@ function App() {
|
||||
<label><input type="checkbox" checked={developerMode} onChange={event => setDeveloperMode(event.target.checked)} />Developer mode</label>
|
||||
</div></details>
|
||||
{workbench === "Part" && <PartWorkbenchMenu disabled={partActionDisabled} activate={activatePartAction} currentTask={workspaceTask} />}
|
||||
{workbench !== "Part" && <ParityWorkbenchMenu workbench={workbench}
|
||||
onCommand={command => setStatus(`${command}: selected (desktop menu; execution wiring pending)`)} />}
|
||||
{workbench !== "Part" && <WorkbenchParityMenu workbench={workbench} />}
|
||||
</nav>
|
||||
<PersistentToolbarWorkspace router={router} documentId={nativeName(active || initialDocumentId)} workbench={workbench}>
|
||||
@@ -1935,7 +1938,7 @@ function App() {
|
||||
}
|
||||
setWorkspaceTask(""); setViewCommand(""); setWorkbenches(previous => ({ ...previous, [active]: next }));
|
||||
void startParameters(router, { LastModule: `${next}Workbench` }, true).catch(error => setStatus(String(error)));
|
||||
}}><option>Part</option><option>Sketcher</option><option>PartDesign</option><option>Spreadsheet</option><option>Surface</option><option>Assembly</option><option>Draft</option><option>Architecture</option><option disabled={!nativeDocuments.current.has(active)}>TemplatePyMod</option></select></label>
|
||||
}}><option>Part</option><option>Sketcher</option><option>PartDesign</option><option>Spreadsheet</option><option>Surface</option><option>Assembly</option><option>Draft</option><option>Architecture</option><option>BIM</option><option>CAM</option><option>Cloud</option><option>Fem</option><option>Help</option><option>Import</option><option>Inspection</option><option>JtReader</option><option>Material</option><option>Measure</option><option>Mesh</option><option>MeshPart</option><option>OpenSCAD</option><option>Points</option><option>ReverseEngineering</option><option>Robot</option><option>Sandbox</option><option>Start</option><option>TechDraw</option><option>Test</option><option>Tux</option><option disabled={!nativeDocuments.current.has(active)}>TemplatePyMod</option></select></label>
|
||||
</ToolbarGroup>
|
||||
{csvPanel && <SpreadsheetCsvPanel mode={csvPanel.mode} selected={csvPanel.selected}
|
||||
sheets={Object.values(store.list().find(document => document.id === csvPanel.id)?.objects ?? {}).filter(object => object.type === "Spreadsheet::Sheet").map(object => ({ name: String(object.properties.NativeName), label: String(object.properties.Label) }))}
|
||||
|
||||
67
web/src/shell/workbench-menu.tsx
Normal file
67
web/src/shell/workbench-menu.tsx
Normal file
@@ -0,0 +1,67 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { commandLabel, commandTooltip, loadDesktopManifest, workbenchById,
|
||||
type DesktopManifest, type DesktopMenuItem, type DesktopWorkbench } from "./command-registry.js";
|
||||
|
||||
function Items({ items, manifest, onCommand }: {
|
||||
items: DesktopMenuItem[];
|
||||
manifest: DesktopManifest;
|
||||
onCommand: (id: string) => void;
|
||||
}) {
|
||||
return <div className="parity-menu-items">
|
||||
{items.map((item, index) => {
|
||||
if (item.type === "separator") return <hr key={`sep-${index}`} />;
|
||||
if (item.type === "submenu") return <details key={`sub-${index}`}>
|
||||
<summary>{item.label}</summary>
|
||||
<Items items={item.items ?? []} manifest={manifest} onCommand={onCommand} />
|
||||
</details>;
|
||||
if (!item.id) return null;
|
||||
return <button key={item.id} type="button" title={commandTooltip(manifest, item.id)}
|
||||
onClick={() => onCommand(item.id!)}>
|
||||
<span>{commandLabel(manifest, item.id)}</span>
|
||||
{manifest.commandMetadata[item.id]?.accel ? <kbd>{manifest.commandMetadata[item.id].accel}</kbd> : null}
|
||||
</button>;
|
||||
})}
|
||||
</div>;
|
||||
}
|
||||
|
||||
export function ParityWorkbenchMenu({ workbench, onCommand }: {
|
||||
workbench: string;
|
||||
onCommand: (id: string) => void;
|
||||
}) {
|
||||
const [manifest, setManifest] = useState<DesktopManifest | null>(null);
|
||||
const [desktop, setDesktop] = useState<DesktopWorkbench | null>(null);
|
||||
const [open, setOpen] = useState(false);
|
||||
useEffect(() => {
|
||||
if (workbench === "Part") return;
|
||||
let cancelled = false;
|
||||
loadDesktopManifest().then(data => {
|
||||
if (cancelled) return;
|
||||
setManifest(data);
|
||||
setDesktop(workbenchById(data, workbench) ?? null);
|
||||
}).catch(() => { if (!cancelled) setDesktop(null); });
|
||||
return () => { cancelled = true; };
|
||||
}, [workbench]);
|
||||
useEffect(() => setOpen(false), [workbench]);
|
||||
if (workbench === "Part" || !manifest || !desktop) return null;
|
||||
return <details className="parity-workbench-menu" open={open}>
|
||||
<style>{`
|
||||
.parity-workbench-menu{position:relative;display:inline-block}
|
||||
.parity-workbench-menu>summary{list-style:none;cursor:pointer;padding:4px 10px;border-radius:3px;color:#dbe6ee}
|
||||
.parity-workbench-menu>summary::-webkit-details-marker{display:none}
|
||||
.parity-workbench-menu[open]>summary,.parity-workbench-menu>summary:hover{background:#3d4a52}
|
||||
.parity-workbench-menu .parity-menu-items{position:absolute;top:100%;left:0;min-width:280px;max-height:72vh;overflow:auto;background:#0f1419;border:1px solid #3f3f3f;box-shadow:0 12px 32px #0009;padding:6px;z-index:40;border-radius:0 0 6px 6px}
|
||||
.parity-menu-items>button{display:flex;width:100%;justify-content:space-between;gap:16px;background:transparent;border:0;color:#dbe6ee;padding:3px 7px;text-align:left;border-radius:3px;font-size:12.5px;cursor:pointer}
|
||||
.parity-menu-items>button:hover{background:#29444b}
|
||||
.parity-menu-items kbd{color:#93a6b3;font-size:11px}
|
||||
.parity-menu-items summary{cursor:pointer;padding:3px 7px;border-radius:3px;font-size:12.5px}
|
||||
.parity-menu-items summary:hover{background:#22313b}
|
||||
.parity-menu-items details .parity-menu-items{padding-left:12px;border-left:1px solid #2a3a45;margin-left:8px}
|
||||
.parity-menu-items hr{border:0;border-top:1px solid #2a3a45;margin:4px 0}
|
||||
`}</style>
|
||||
<summary aria-label={`${workbench} menu`} onClick={event => { event.preventDefault(); setOpen(value => !value); }}>
|
||||
{workbench}
|
||||
</summary>
|
||||
<Items items={desktop.menus.map(menu => ({ type: "submenu" as const, label: menu.label, items: menu.items }))}
|
||||
manifest={manifest} onCommand={id => { setOpen(false); onCommand(id); }} />
|
||||
</details>;
|
||||
}
|
||||
Reference in New Issue
Block a user