From 1750949afd591b078eda57a3a592833f622fb195 Mon Sep 17 00:00:00 2001 From: forbes Date: Sat, 7 Feb 2026 21:29:05 -0600 Subject: [PATCH] fix(gui): merge Silo toolbar into File toolbar via origin system (#65) - Remove separate Silo workbench toolbar (now redundant) - Remove SiloMenuManipulator (Std commands already delegate to origins) - Remove Silo_ToggleMode (origin selector handles mode switching) - Register Silo origin at startup via Create module - Update docs to reflect unified origin architecture --- docs/ARCHITECTURE.md | 4 ++-- docs/COMPONENTS.md | 8 ++++---- docs/INTEGRATION_PLAN.md | 8 ++++---- docs/KNOWN_ISSUES.md | 2 +- mods/silo | 2 +- src/Mod/Create/InitGui.py | 35 ++++++++--------------------------- 6 files changed, 20 insertions(+), 39 deletions(-) diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 79f9138cec..5348924410 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -17,8 +17,8 @@ FreeCAD startup │ └─ exec(mods/silo/freecad/InitGui.py) │ └─ registers SiloWorkbench └─ Deferred setup (QTimer): - ├─ 1500ms: _setup_silo_auth_panel() → "Database Auth" dock - ├─ 2000ms: _setup_silo_menu() → SiloMenuManipulator + ├─ 1500ms: _register_silo_origin() → registers Silo FileOrigin + ├─ 2000ms: _setup_silo_auth_panel() → "Database Auth" dock ├─ 3000ms: _check_silo_first_start() → settings prompt └─ 4000ms: _setup_silo_activity_panel() → "Database Activity" dock ``` diff --git a/docs/COMPONENTS.md b/docs/COMPONENTS.md index 4d2be85220..39dd791166 100644 --- a/docs/COMPONENTS.md +++ b/docs/COMPONENTS.md @@ -62,12 +62,12 @@ These appear in the File menu and "Origin Tools" toolbar across all workbenches | `Silo_Rollback` | Rollback to previous revision | | `Silo_SetStatus` | Set revision status (draft/review/released/obsolete) | | `Silo_Settings` | Configure API URL, projects dir, SSL certificates | -| `Silo_ToggleMode` | Swap Ctrl+O/S/N between FreeCAD and Silo commands | | `Silo_Auth` | Login/logout authentication panel | -**Global integration** via `SiloMenuManipulator` in `src/Mod/Create/InitGui.py`: -- File menu: Silo_New, Silo_Open, Silo_Save, Silo_Commit, Silo_Pull, Silo_Push, Silo_BOM -- File toolbar: Silo_ToggleMode button +**Global integration** via the origin system in `src/Gui/`: +- File toolbar: `Std_Origin` selector widget + `Std_New`/`Std_Open`/`Std_Save` (delegate to current origin) +- Origin Tools toolbar: `Origin_Commit`/`Origin_Pull`/`Origin_Push`/`Origin_Info`/`Origin_BOM` (auto-disable by capability) +- Silo origin registered at startup by `src/Mod/Create/InitGui.py` **Server architecture:** Go REST API (38+ routes) + PostgreSQL + MinIO S3. Authentication via local (bcrypt), LDAP, or OIDC backends. See `mods/silo/docs/` for server documentation. diff --git a/docs/INTEGRATION_PLAN.md b/docs/INTEGRATION_PLAN.md index 1f706de2b1..1dc40342ab 100644 --- a/docs/INTEGRATION_PLAN.md +++ b/docs/INTEGRATION_PLAN.md @@ -58,11 +58,11 @@ The Python API provides everything needed for feature creation, command registra The Create module is a thin Python loader that: - Adds `mods/` addon paths to `sys.path` and executes their `Init.py`/`InitGui.py` files -- Installs `SiloMenuManipulator` for global File menu/toolbar injection +- Registers the Silo FileOrigin so the origin selector can offer it at startup - Sets up deferred Silo dock panels (auth, activity) via `QTimer` - Handles first-start configuration -This layer does not contain C++ code. It uses FreeCAD's `WorkbenchManipulator` API for menu/toolbar injection. +This layer does not contain C++ code. ### Layer 4: Kindred Workbenches -- `mods/` @@ -116,9 +116,9 @@ Pure Python workbenches following FreeCAD's addon pattern. Self-contained with ` **Goal:** Silo commands available globally, not just in the Silo workbench. -**Implementation:** `SiloMenuManipulator` in `src/Mod/Create/InitGui.py` uses `FreeCADGui.addWorkbenchManipulator()` to inject Silo commands into the File menu and toolbar across all workbenches. `Silo_ToggleMode` provides a one-click swap of Ctrl+O/S/N between standard FreeCAD and Silo file commands. +**Implementation:** The unified origin system (`FileOrigin`, `OriginManager`, `OriginSelectorWidget`) in `src/Gui/` delegates all file operations (New/Open/Save) to the selected origin. Standard commands (`Std_New`, `Std_Open`, `Std_Save`) and origin commands (`Origin_Commit`, `Origin_Pull`, `Origin_Push`, `Origin_Info`, `Origin_BOM`) are built into the File toolbar and menu. The Silo workbench no longer has its own toolbar — it only provides a menu with admin/management commands. -**Dock panels:** Database Auth (1500ms) and Database Activity (4000ms) panels are created via deferred QTimers and docked in the right panel area. +**Dock panels:** Database Auth (2000ms) and Database Activity (4000ms) panels are created via deferred QTimers and docked in the right panel area. ### Phase 6: Build system integration -- PARTIAL diff --git a/docs/KNOWN_ISSUES.md b/docs/KNOWN_ISSUES.md index 4c9738aff1..fd0ab3b647 100644 --- a/docs/KNOWN_ISSUES.md +++ b/docs/KNOWN_ISSUES.md @@ -8,7 +8,7 @@ 2. **WorkbenchManipulator timing.** The `_ZToolsPartDesignManipulator` appends commands by name. If ZToolsWorkbench hasn't been activated when the user switches to PartDesign, the commands may not be registered. The manipulator API tolerates missing commands silently, but buttons won't appear. -3. **Silo shortcut persistence.** `Silo_ToggleMode` stores original shortcuts in a module-level dict. If FreeCAD crashes with Silo mode on, original shortcuts are lost on next launch. +3. ~~**Silo shortcut persistence.**~~ Resolved. `Silo_ToggleMode` removed; file operations now delegate to the selected origin via the unified origin system. ### High diff --git a/mods/silo b/mods/silo index 3228ef5f79..fcb0a214e2 160000 --- a/mods/silo +++ b/mods/silo @@ -1 +1 @@ -Subproject commit 3228ef5f79f6e63b84e825ec5fe5127016ac8d82 +Subproject commit fcb0a214e22cfe1730507d6756aa275f0b81f2f5 diff --git a/src/Mod/Create/InitGui.py b/src/Mod/Create/InitGui.py index be2e27b480..c3da4592be 100644 --- a/src/Mod/Create/InitGui.py +++ b/src/Mod/Create/InitGui.py @@ -65,34 +65,15 @@ def _check_silo_first_start(): FreeCAD.Console.PrintLog(f"Create: Silo first-start check skipped: {e}\n") -def _setup_silo_menu(): - """Inject Silo commands into the File menu and toolbar across all workbenches.""" +def _register_silo_origin(): + """Register Silo as a file origin so the origin selector can offer it.""" try: - # Import silo_commands eagerly so commands are registered before the - # manipulator tries to add them to toolbars/menus. - import silo_commands # noqa: F401 + import silo_commands # noqa: F401 - registers Silo commands + import silo_origin - class SiloMenuManipulator: - def modifyMenuBar(self): - return [ - {"insert": "Silo_New", "menuItem": "Std_New", "after": ""}, - {"insert": "Silo_Open", "menuItem": "Std_Open", "after": ""}, - {"insert": "Silo_Save", "menuItem": "Std_Save", "after": ""}, - {"insert": "Silo_Commit", "menuItem": "Silo_Save", "after": ""}, - {"insert": "Silo_Pull", "menuItem": "Silo_Commit", "after": ""}, - {"insert": "Silo_Push", "menuItem": "Silo_Pull", "after": ""}, - {"insert": "Silo_BOM", "menuItem": "Silo_Push", "after": ""}, - ] - - def modifyToolBars(self): - return [ - {"append": "Silo_ToggleMode", "toolBar": "File"}, - ] - - FreeCADGui.addWorkbenchManipulator(SiloMenuManipulator()) - FreeCAD.Console.PrintLog("Create: Silo menu manipulator installed\n") + silo_origin.register_silo_origin() except Exception as e: - FreeCAD.Console.PrintLog(f"Create: Silo menu setup skipped: {e}\n") + FreeCAD.Console.PrintLog(f"Create: Silo origin registration skipped: {e}\n") def _setup_silo_auth_panel(): @@ -171,8 +152,8 @@ def _setup_silo_activity_panel(): try: from PySide.QtCore import QTimer - QTimer.singleShot(1500, _setup_silo_auth_panel) - QTimer.singleShot(2000, _setup_silo_menu) + QTimer.singleShot(1500, _register_silo_origin) + QTimer.singleShot(2000, _setup_silo_auth_panel) QTimer.singleShot(3000, _check_silo_first_start) QTimer.singleShot(4000, _setup_silo_activity_panel) except Exception: -- 2.49.1