feat(quicknav): Phase 2 — dynamic discovery and MRU history #321

Closed
opened 2026-02-23 18:50:36 +00:00 by forbes · 0 comments
Owner

Summary

Replace hardcoded command groupings with dynamic toolbar introspection and add MRU history with persistence.

Depends on: #320 (Phase 1)

Scope

Toolbar introspection (quicknav/workbench_map.py)

  • discover_groupings(workbench_name) function that:
    1. Temporarily activates the target workbench (if not already active)
    2. Enumerates QToolBar widgets from the main window
    3. Maps toolbar name to list of QAction command names
    4. Filters out non-command actions (separators, widgets)
    5. Splits into tiers if >9 groupings
    6. Restores the previously active workbench
  • Falls back to hardcoded groupings from Phase 1 if discovery fails
  • ZTools commands injected via WorkbenchManipulator are automatically included (discovered after manipulators have run)

MRU history (quicknav/history.py)

  • Per-workbench grouping MRU stack
  • Activating a grouping (Shift+N or click) moves it to position 0
  • Previous grouping shifts to position 1, rest shifts down
  • Workbenches have fixed Ctrl+N assignments (not MRU ordered)
  • Each workbench remembers its last-active grouping — restored on workbench switch

Persistence

  • Store in FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/QuickNav")
  • GroupHistory/<Workbench>: semicolon-delimited grouping names in MRU order
  • LastGrouping/<Workbench>: last-active grouping per workbench
  • CustomSlots/Ctrl6 through Ctrl9: user-configurable workbench slots

Grouping overflow

  • Shift+Left/Right scrolls through groupings beyond the visible 9
  • Scroll wheel on grouping area cycles through overflow
  • Click scroll arrows to page through overflow

Deliverable

Command groupings are populated dynamically from actual workbench toolbars. MRU ordering persists across sessions. Overflow groupings accessible via scroll.

References

  • docs/src/quicknav/SPEC.md — §6 (MRU History), §10 (Command Discovery)
## Summary Replace hardcoded command groupings with dynamic toolbar introspection and add MRU history with persistence. Depends on: #320 (Phase 1) ## Scope ### Toolbar introspection (`quicknav/workbench_map.py`) - `discover_groupings(workbench_name)` function that: 1. Temporarily activates the target workbench (if not already active) 2. Enumerates `QToolBar` widgets from the main window 3. Maps toolbar name to list of `QAction` command names 4. Filters out non-command actions (separators, widgets) 5. Splits into tiers if >9 groupings 6. Restores the previously active workbench - Falls back to hardcoded groupings from Phase 1 if discovery fails - ZTools commands injected via `WorkbenchManipulator` are automatically included (discovered after manipulators have run) ### MRU history (`quicknav/history.py`) - Per-workbench grouping MRU stack - Activating a grouping (`Shift+N` or click) moves it to position 0 - Previous grouping shifts to position 1, rest shifts down - Workbenches have fixed `Ctrl+N` assignments (not MRU ordered) - Each workbench remembers its last-active grouping — restored on workbench switch ### Persistence - Store in `FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/QuickNav")` - `GroupHistory/<Workbench>`: semicolon-delimited grouping names in MRU order - `LastGrouping/<Workbench>`: last-active grouping per workbench - `CustomSlots/Ctrl6` through `Ctrl9`: user-configurable workbench slots ### Grouping overflow - `Shift+Left/Right` scrolls through groupings beyond the visible 9 - Scroll wheel on grouping area cycles through overflow - Click scroll arrows to page through overflow ## Deliverable Command groupings are populated dynamically from actual workbench toolbars. MRU ordering persists across sessions. Overflow groupings accessible via scroll. ## References - `docs/src/quicknav/SPEC.md` — §6 (MRU History), §10 (Command Discovery)
forbes added the enhancement label 2026-02-23 18:50:36 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/create#321