simvx.editor.keyboard_nav

Keyboard Navigation — Tab/Shift+Tab panel cycling and arrow-key navigation.

Module Contents

Classes

KeyboardNavigator

Manages Tab/Shift+Tab focus cycling between editor panels.

Data

log

API

simvx.editor.keyboard_nav.log[source]

‘getLogger(…)’

class simvx.editor.keyboard_nav.KeyboardNavigator(panels: list[simvx.core.ui.core.Control] | None = None)[source]

Manages Tab/Shift+Tab focus cycling between editor panels.

Panels are registered in visual order (left-to-right, top-to-bottom). Tab advances forward, Shift+Tab moves backward, wrapping at both ends.

Arrow key navigation within individual panels (scene tree, inspector) is handled by those panels’ own _on_gui_input methods; this class only manages the inter-panel cycling.

Usage::

nav = KeyboardNavigator()
nav.add_panel(scene_tree_panel)
nav.add_panel(viewport_panel)
nav.add_panel(inspector_panel)

# In the editor's shortcut handler:
nav.handle_tab(shift=False)   # Tab
nav.handle_tab(shift=True)    # Shift+Tab

Initialization

add_panel(panel: simvx.core.ui.core.Control) None[source]

Register a panel for focus cycling.

remove_panel(panel: simvx.core.ui.core.Control) None[source]

Unregister a panel from focus cycling.

property panels: list[simvx.core.ui.core.Control]

Return the ordered list of registered panels.

property focus_index: int

Return the index of the currently focused panel.

property focused_panel: simvx.core.ui.core.Control | None

Return the currently focused panel, or None if no panels registered.

handle_tab(shift: bool = False) bool[source]

Cycle focus to the next (or previous if shift) panel.

Skips invisible panels. Returns True if focus was moved, False if no focusable panel was found.

focus_panel(panel: simvx.core.ui.core.Control) bool[source]

Focus a specific panel by reference.

Returns True if the panel was found and focused.

focus_panel_by_name(name: str) bool[source]

Focus a panel by its node name.

Returns True if a panel with that name was found and focused.