exlab_wizard.ui.keyboard#
Keyboard-shortcut registry (Frontend Spec §3.7).
The bindings are intentionally small and central. Adding a new shortcut is a deliberate spec change to §3.7 plus a registry entry here; bypassing the registry to bind directly on a NiceGUI element is a code-review reject.
The registry exposes the canonical macOS and Windows / Linux key combos for
each Shortcut. Per-shortcut handlers are looked up at runtime so
the pages don’t need to import the registry’s binding helper to register.
Functions
|
Install a NiceGUI keyboard listener for the registry. |
|
Resolve the |
|
Return the |
|
Return |
Return the canonical bindings table (Frontend §3.7). |
|
|
Find the shortcut id matching the given key event, if any. |
Classes
|
A modifier-and-key combination. |
|
Identifiers for the app-level shortcut set (Frontend §3.7). |
|
One row in the §3.7 shortcut table. |
|
A populated registry of shortcut handlers. |
- class exlab_wizard.ui.keyboard.KeyCombo(key, cmd=False, ctrl=False, shift=False, alt=False)[source]#
Bases:
objectA modifier-and-key combination.
- class exlab_wizard.ui.keyboard.Shortcut(*values)[source]#
Bases:
StrEnumIdentifiers for the app-level shortcut set (Frontend §3.7).
- FOCUS_TREE_SEARCH = 'focus_tree_search'#
- NEW_PROJECT = 'new_project'#
- NEW_RUN = 'new_run'#
- NEW_TEST_RUN = 'new_test_run'#
- OPEN_PROBLEMS = 'open_problems'#
- OPEN_SETTINGS = 'open_settings'#
- REFRESH_TREE = 'refresh_tree'#
- WIZARD_CANCEL = 'wizard_cancel'#
- WIZARD_NEXT = 'wizard_next'#
- class exlab_wizard.ui.keyboard.ShortcutBinding(shortcut, macos, other, description)[source]#
Bases:
objectOne row in the §3.7 shortcut table.
- class exlab_wizard.ui.keyboard.ShortcutRegistry(handlers=<factory>)[source]#
Bases:
objectA populated registry of shortcut handlers.
Pages instantiate one registry, register handlers for the actions they care about, and pass the registry to
bind_global_shortcuts()to install a single keyboard listener.
- exlab_wizard.ui.keyboard.bind_global_shortcuts(registry)[source]#
Install a NiceGUI keyboard listener for the registry.
NiceGUI is imported lazily so unit tests can exercise the registry surface without spinning up an app.
- Parameters:
registry (
ShortcutRegistry)- Return type:
- exlab_wizard.ui.keyboard.combo_for_current_os(shortcut)[source]#
Resolve the
KeyCombofor the current OS.
- exlab_wizard.ui.keyboard.get_binding(shortcut)[source]#
Return the
ShortcutBindingfor the given shortcut id.
- exlab_wizard.ui.keyboard.is_macos()[source]#
Return
Truewhen running on macOS (used for combo selection).- Return type: