feat(quicknav): Phase 1 — core infrastructure #320

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

Summary

Implement the core infrastructure for the QuickNav keyboard navigation addon. This phase delivers a working numbered-key command execution system with hardcoded workbench/grouping maps.

Scope

Event filter (quicknav/event_filter.py)

  • QuickNavEventFilter(QObject) installed on FreeCAD's main window via installEventFilter()
  • Intercept KeyPress events only when QuickNav is active
  • Key routing: 0 toggles on/off, 1-9 executes commands, Shift+1-9 switches grouping, Ctrl+1-9 switches workbench
  • Input widget safety: skip interception when focus is on QLineEdit, QTextEdit, QPlainTextEdit, QSpinBox, QDoubleSpinBox, or task panel input fields

Manager singleton (quicknav/core.py)

  • QuickNavManager singleton orchestrating state: active flag, current workbench, current grouping, event filter lifecycle
  • install() / uninstall() methods for event filter and nav bar
  • toggle_active() bound to 0 key
  • switch_workbench(n), switch_grouping(n), execute_command(n) dispatch methods

Navigation bar (quicknav/nav_bar.py)

  • QToolBar subclass positioned at bottom of main window
  • Layout: workbench label | numbered grouping tabs | numbered command list
  • Show/hide with QuickNav toggle
  • Click support on groupings and commands

Hardcoded workbench map (quicknav/workbench_map.py)

  • Fixed Ctrl+N assignments: Sketcher (1), Part Design (2), Assembly (3), Spreadsheet (4), TechDraw (5)
  • Hardcoded command groupings from SPEC.md §5 as fallback defaults
  • Groupings per workbench: Sketcher (5), Part Design (5), Assembly (3), Spreadsheet (2), TechDraw (dynamic)

Addon scaffold

  • mods/quicknav/package.xml with <kindred> extensions (priority 10, depends on sdk)
  • Init.py (no-op), InitGui.py (registers QuickNavWorkbench)
  • QuickNavWorkbench class: installs QuickNav on load, re-activates previous workbench
  • ParamGet persistence for Enabled state

FreeCAD command registration

  • QuickNav_Toggle command registered via Gui.addCommand()

Deliverable

Working keyboard navigation: 0 to toggle, 1-9 to run commands, Shift+1-9 to switch groupings, Ctrl+1-5 to switch workbenches. Navigation bar visible at bottom of window.

References

  • docs/src/quicknav/SPEC.md — §3 (Key Bindings), §4 (Navigation Bar), §5 (Workbench Command Groupings), §8 (Key Event Handling), §9 (Addon Structure)
## Summary Implement the core infrastructure for the QuickNav keyboard navigation addon. This phase delivers a working numbered-key command execution system with hardcoded workbench/grouping maps. ## Scope ### Event filter (`quicknav/event_filter.py`) - `QuickNavEventFilter(QObject)` installed on FreeCAD's main window via `installEventFilter()` - Intercept `KeyPress` events only when QuickNav is active - Key routing: `0` toggles on/off, `1-9` executes commands, `Shift+1-9` switches grouping, `Ctrl+1-9` switches workbench - Input widget safety: skip interception when focus is on `QLineEdit`, `QTextEdit`, `QPlainTextEdit`, `QSpinBox`, `QDoubleSpinBox`, or task panel input fields ### Manager singleton (`quicknav/core.py`) - `QuickNavManager` singleton orchestrating state: active flag, current workbench, current grouping, event filter lifecycle - `install()` / `uninstall()` methods for event filter and nav bar - `toggle_active()` bound to `0` key - `switch_workbench(n)`, `switch_grouping(n)`, `execute_command(n)` dispatch methods ### Navigation bar (`quicknav/nav_bar.py`) - `QToolBar` subclass positioned at bottom of main window - Layout: workbench label | numbered grouping tabs | numbered command list - Show/hide with QuickNav toggle - Click support on groupings and commands ### Hardcoded workbench map (`quicknav/workbench_map.py`) - Fixed `Ctrl+N` assignments: Sketcher (1), Part Design (2), Assembly (3), Spreadsheet (4), TechDraw (5) - Hardcoded command groupings from SPEC.md §5 as fallback defaults - Groupings per workbench: Sketcher (5), Part Design (5), Assembly (3), Spreadsheet (2), TechDraw (dynamic) ### Addon scaffold - `mods/quicknav/package.xml` with `<kindred>` extensions (priority 10, depends on sdk) - `Init.py` (no-op), `InitGui.py` (registers `QuickNavWorkbench`) - `QuickNavWorkbench` class: installs QuickNav on load, re-activates previous workbench - ParamGet persistence for `Enabled` state ### FreeCAD command registration - `QuickNav_Toggle` command registered via `Gui.addCommand()` ## Deliverable Working keyboard navigation: `0` to toggle, `1-9` to run commands, `Shift+1-9` to switch groupings, `Ctrl+1-5` to switch workbenches. Navigation bar visible at bottom of window. ## References - `docs/src/quicknav/SPEC.md` — §3 (Key Bindings), §4 (Navigation Bar), §5 (Workbench Command Groupings), §8 (Key Event Handling), §9 (Addon Structure)
forbes added the enhancement label 2026-02-23 18:50:18 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/create#320