wijjit.core.wiring.ElementWiringManager

class wijjit.core.wiring.ElementWiringManager(app)[source]

Manages element callback wiring and state binding.

This manager is responsible for: - Wiring action callbacks for buttons - Binding state to inputs (two-way data binding) - Registering menu shortcuts - Managing scroll position persistence - Managing highlight state for selectable elements

Parameters:

app (Wijjit) – Reference to the main application

Variables:
  • app (Wijjit) – Application reference

  • _registered_menuitem_shortcuts (set[str]) – Set of registered menu item shortcut handler IDs

  • _registered_menu_shortcuts (set[str]) – Set of registered menu trigger shortcut handler IDs

__init__(app)[source]

Initialize the element wiring manager.

Parameters:

app (Wijjit) – Reference to the main application

Return type:

None

Methods

__init__(app)

Initialize the element wiring manager.

clear_view_shortcuts()

Clear shortcut tracking sets when navigating away from view.

wire_elements(elements, state)

Wire callbacks for all elements.

wire_menu_elements(menu_elements, ...)

Wire menu element callbacks and shortcuts.

clear_view_shortcuts()[source]

Clear shortcut tracking sets when navigating away from view.

This method clears the internal tracking sets used to prevent duplicate handler registration within a single view render.

Note: With VIEW-scoped handlers, the actual handler cleanup is handled automatically by handler_registry.clear_view(). This method primarily resets the duplicate-detection sets for the next view.

Return type:

None

wire_elements(elements, state)[source]

Wire callbacks for all elements.

This method wires up action callbacks, state bindings, and menu shortcuts for all positioned elements.

Parameters:
  • elements (list[Element]) – List of positioned elements to wire

  • state (State) – Application state for bindings

Return type:

None

wire_menu_elements(menu_elements, dropdown_state_keys, elements, state, event_type, handler_scope)[source]

Wire menu element callbacks and shortcuts.

Parameters:
  • menu_elements (list[tuple[MenuElement, dict]]) – List of (menu_element, overlay_info) tuples

  • dropdown_state_keys (list[str]) – List of dropdown menu visibility state keys for mutual exclusion

  • elements (list[Element]) – List of all positioned elements (for finding trigger buttons)

  • state (State) – Application state

  • event_type (EventType) – EventType.KEY for shortcut registration

  • handler_scope (HandlerScope) – HandlerScope.GLOBAL for shortcut registration

Return type:

None