fix(gui): merge Silo toolbar into File toolbar via origin system (#65)
Some checks failed
Build and Test / build (pull_request) Failing after 1m41s
Some checks failed
Build and Test / build (pull_request) Failing after 1m41s
- 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
This commit is contained in:
@@ -17,8 +17,8 @@ FreeCAD startup
|
|||||||
│ └─ exec(mods/silo/freecad/InitGui.py)
|
│ └─ exec(mods/silo/freecad/InitGui.py)
|
||||||
│ └─ registers SiloWorkbench
|
│ └─ registers SiloWorkbench
|
||||||
└─ Deferred setup (QTimer):
|
└─ Deferred setup (QTimer):
|
||||||
├─ 1500ms: _setup_silo_auth_panel() → "Database Auth" dock
|
├─ 1500ms: _register_silo_origin() → registers Silo FileOrigin
|
||||||
├─ 2000ms: _setup_silo_menu() → SiloMenuManipulator
|
├─ 2000ms: _setup_silo_auth_panel() → "Database Auth" dock
|
||||||
├─ 3000ms: _check_silo_first_start() → settings prompt
|
├─ 3000ms: _check_silo_first_start() → settings prompt
|
||||||
└─ 4000ms: _setup_silo_activity_panel() → "Database Activity" dock
|
└─ 4000ms: _setup_silo_activity_panel() → "Database Activity" dock
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -62,12 +62,12 @@ These appear in the File menu and "Origin Tools" toolbar across all workbenches
|
|||||||
| `Silo_Rollback` | Rollback to previous revision |
|
| `Silo_Rollback` | Rollback to previous revision |
|
||||||
| `Silo_SetStatus` | Set revision status (draft/review/released/obsolete) |
|
| `Silo_SetStatus` | Set revision status (draft/review/released/obsolete) |
|
||||||
| `Silo_Settings` | Configure API URL, projects dir, SSL certificates |
|
| `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 |
|
| `Silo_Auth` | Login/logout authentication panel |
|
||||||
|
|
||||||
**Global integration** via `SiloMenuManipulator` in `src/Mod/Create/InitGui.py`:
|
**Global integration** via the origin system in `src/Gui/`:
|
||||||
- File menu: Silo_New, Silo_Open, Silo_Save, Silo_Commit, Silo_Pull, Silo_Push, Silo_BOM
|
- File toolbar: `Std_Origin` selector widget + `Std_New`/`Std_Open`/`Std_Save` (delegate to current origin)
|
||||||
- File toolbar: Silo_ToggleMode button
|
- 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.
|
**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.
|
||||||
|
|
||||||
|
|||||||
@@ -58,11 +58,11 @@ The Python API provides everything needed for feature creation, command registra
|
|||||||
|
|
||||||
The Create module is a thin Python loader that:
|
The Create module is a thin Python loader that:
|
||||||
- Adds `mods/` addon paths to `sys.path` and executes their `Init.py`/`InitGui.py` files
|
- 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`
|
- Sets up deferred Silo dock panels (auth, activity) via `QTimer`
|
||||||
- Handles first-start configuration
|
- 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/`
|
### 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.
|
**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
|
### Phase 6: Build system integration -- PARTIAL
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
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
|
### High
|
||||||
|
|
||||||
|
|||||||
Submodule mods/silo updated: 3228ef5f79...fcb0a214e2
@@ -65,34 +65,15 @@ def _check_silo_first_start():
|
|||||||
FreeCAD.Console.PrintLog(f"Create: Silo first-start check skipped: {e}\n")
|
FreeCAD.Console.PrintLog(f"Create: Silo first-start check skipped: {e}\n")
|
||||||
|
|
||||||
|
|
||||||
def _setup_silo_menu():
|
def _register_silo_origin():
|
||||||
"""Inject Silo commands into the File menu and toolbar across all workbenches."""
|
"""Register Silo as a file origin so the origin selector can offer it."""
|
||||||
try:
|
try:
|
||||||
# Import silo_commands eagerly so commands are registered before the
|
import silo_commands # noqa: F401 - registers Silo commands
|
||||||
# manipulator tries to add them to toolbars/menus.
|
import silo_origin
|
||||||
import silo_commands # noqa: F401
|
|
||||||
|
|
||||||
class SiloMenuManipulator:
|
silo_origin.register_silo_origin()
|
||||||
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")
|
|
||||||
except Exception as e:
|
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():
|
def _setup_silo_auth_panel():
|
||||||
@@ -171,8 +152,8 @@ def _setup_silo_activity_panel():
|
|||||||
try:
|
try:
|
||||||
from PySide.QtCore import QTimer
|
from PySide.QtCore import QTimer
|
||||||
|
|
||||||
QTimer.singleShot(1500, _setup_silo_auth_panel)
|
QTimer.singleShot(1500, _register_silo_origin)
|
||||||
QTimer.singleShot(2000, _setup_silo_menu)
|
QTimer.singleShot(2000, _setup_silo_auth_panel)
|
||||||
QTimer.singleShot(3000, _check_silo_first_start)
|
QTimer.singleShot(3000, _check_silo_first_start)
|
||||||
QTimer.singleShot(4000, _setup_silo_activity_panel)
|
QTimer.singleShot(4000, _setup_silo_activity_panel)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
Reference in New Issue
Block a user