StateMenu

from acron.ui import StateMenu
class StateMenu(ui: RmlUI, document, sets: dict[str, list[str]], *, pause=None, nav_events: tuple[str, str] = ('arrow_up', 'arrow_down'), activate_event: str = 'enter')

Bases: DirectObject

One menu document, many screens: per-state button sets + keyboard nav.

sets maps a state name to its button ids in navigation order; buttons are <button id="btn_<bid>"> elements. show() displays one state’s set and hides the rest; arrows + enter navigate while open (mouse hover/click keep working through RmlUi itself — style .selected like :hover in the game’s RCSS). Games override on_activate() (required — both keyboard enter and data-model clicks should route here) and on_show() (optional per-state extras: titles, label refresh).

pause is an optional callable(bool) invoked True on show / False on hide — wire it to the game’s single pause switch.

Inheritance diagram

digraph inheritancec690a813dc { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "DirectObject" [URL="direct.showbase.DirectObject.html#direct.showbase.DirectObject.DirectObject",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="This is the class that all Direct/SAL classes should inherit from"]; "StateMenu" [URL="acron.ui.StateMenu.html#acron.ui.StateMenu",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="One menu document, many screens: per-state button sets + keyboard nav."]; "DirectObject" -> "StateMenu" [arrowsize=0.75,style=""]; }
display_ids

ids whose display is toggled per-state; prune ids a game manages itself (e.g. buttons living inside a grouped row) after init.