Keyboard-driven command navigation addon for Kindred Create. - Event filter with key routing (0=toggle, 1-9=commands, Shift+1-9=groupings, Ctrl+1-9=workbenches) - Navigation bar (QToolBar) with workbench/grouping/command display - QuickNavManager singleton with workbench switching, grouping selection, command execution - Hardcoded workbench slots (Sketcher, PartDesign, Assembly, Spreadsheet, TechDraw) - Input widget safety (QLineEdit, QTextEdit, QAbstractSpinBox, TaskView) - Numpad support via KeypadModifier stripping - Conditional Catppuccin theming via SDK (Qt defaults on standalone FreeCAD) - QuickNavWorkbench with transparent overlay pattern - Preference persistence (BaseApp/Preferences/Mod/QuickNav)
38 lines
1005 B
Python
38 lines
1005 B
Python
import FreeCAD as App
|
|
import FreeCADGui as Gui
|
|
|
|
|
|
class QuickNavWorkbench(Gui.Workbench):
|
|
"""Invisible workbench that installs QuickNav on load.
|
|
|
|
QuickNav does not replace the active workbench -- it layers on top.
|
|
Loading QuickNav installs the event filter and nav bar, then
|
|
immediately re-activates the previously active workbench.
|
|
"""
|
|
|
|
MenuText = "QuickNav"
|
|
ToolTip = "Keyboard-driven command navigation"
|
|
|
|
def Initialize(self):
|
|
from quicknav.core import QuickNavManager
|
|
|
|
QuickNavManager.instance().install()
|
|
App.Console.PrintMessage("QuickNav workbench initialized\n")
|
|
|
|
def Activated(self):
|
|
from quicknav.core import QuickNavManager
|
|
|
|
QuickNavManager.instance().handle_workbench_activated()
|
|
|
|
def Deactivated(self):
|
|
pass
|
|
|
|
def GetClassName(self):
|
|
return "Gui::PythonWorkbench"
|
|
|
|
|
|
Gui.addWorkbench(QuickNavWorkbench())
|
|
|
|
# Eager command registration
|
|
from quicknav.commands import QuickNav_Toggle # noqa: F401
|