Context Menu¶
Runnable example
python/examples/context_menu_interact.py — opens the T-key radial menu → get_state → highlight → invoke → close.
resoio.context_menu.ContextMenuClient ¶
Bases: _BaseClient[ContextMenuStub]
Async client for the Resonite IO ContextMenu service over a UDS.
Use as an async context manager so the gRPC channel is closed
deterministically. Socket resolution mirrors
:class:resoio.ConnectionClient.
Source code in src/resoio/_client.py
open
async
¶
Open the radial context menu and return the resulting state.
Waits server-side until the menu has finished opening. Calling
when already open is a no-op that returns the current state.
gRPC failures surface as :class:grpclib.exceptions.GRPCError.
Source code in src/resoio/context_menu.py
close
async
¶
Close the radial context menu and return the resulting state.
Source code in src/resoio/context_menu.py
get_state
async
¶
Return the current menu state without modifying it.
Source code in src/resoio/context_menu.py
highlight
async
¶
Select (preview) the item at index without triggering it.
Highlight only moves the visual selection; it never presses the
item, so it has no side effect on the world or active tool. Use
:meth:invoke to actually act on an item.
gRPC failures (e.g. out-of-range index, menu not open) surface as
:class:grpclib.exceptions.GRPCError.
Source code in src/resoio/context_menu.py
invoke
async
¶
Press the item at index and return the resulting state.
Unlike :meth:highlight, this fires the item's button action, so
it may open a submenu, switch the active tool, or otherwise mutate
world state. The returned state reflects the menu after the press
(e.g. a submenu's items, or an empty menu if the action closed it).
gRPC failures (e.g. out-of-range index, menu not open) surface as
:class:grpclib.exceptions.GRPCError.
Source code in src/resoio/context_menu.py
resoio.context_menu.ContextMenuItem
dataclass
¶
ContextMenuItem(
index: int,
label: str,
enabled: bool,
has_icon: bool,
color: tuple[float, float, float, float],
)
A single entry in the radial context menu.
index is the enumeration order (ArcLayout child order) and is
what :meth:ContextMenuClient.highlight / :meth:ContextMenuClient.invoke
address. color is the RGBA tuple (r, g, b, a).
resoio.context_menu.ContextMenuState
dataclass
¶
Snapshot of the current context menu state.
items is empty when the menu is closed. highlighted_index is
-1 when no item is highlighted.