Toolbar
- class omni.kit.widget.toolbar.Toolbar
Bases:
objectMain Toolbar class.
Methods
__init__()acquire_toolbar_context(context)Request toolbar to switch to given context.
add_custom_select_type(entry_name, ...)add_widget(widget_group, priority[, context])Adds a WidgetGroup instance to the Toolbar.
destroy()Gets the current context of the Toolbar.
get_widget(name)Gets a ui.Widget item by its name.
rebuild_toolbar([root_frame])release_toolbar_context(token)Request toolbar to release context associated with token.
remove_custom_select(entry_name)remove_widget(widget_group)Removes a WidgetGroup instance from the Toolbar.
set_axis(axis)Sets the axis direction of the Toolbar
subscribe_grab_mouse_pressed(function)Attributes
DEFAULT_CONTEXTDEFAULT_CONTEXT_TOKENDEFAULT_SIZEWINDOW_NAMEcontext_menu- __init__()
- acquire_toolbar_context(context: str)
Request toolbar to switch to given context. It takes the context preemptively even if previous context owner has not release the context.
- Parameters
context (str) – Context to switch to.
- Returns
A token to be used to release_toolbar_context
- add_widget(widget_group: WidgetGroup, priority: int, context: str = '')
Adds a WidgetGroup instance to the Toolbar.
- Parameters
widget_group (WidgetGroup) – The WidgetGroup instance to be added to the Toolbar.
priority (int) – priority of the WidgetGroup. With a smaller number the WidgetGroup will be shown on Toolbar first.
context (str) – A context the WidgetGroup is associated with.
- get_context()
Gets the current context of the Toolbar.
- get_widget(name: str) Widget
Gets a ui.Widget item by its name.
- Parameters
name (str) – The name of widget to fetch.
- Returns
The ui.Widget associated with such name. None if not found.
- release_toolbar_context(token: int)
Request toolbar to release context associated with token. If token is expired (already released or context ownership taken by others), this function does nothing.
- Parameters
token (int) – Context token to release.
- remove_widget(widget_group: WidgetGroup)
Removes a WidgetGroup instance from the Toolbar.
- Parameters
widget_group (WidgetGroup) – The WidgetGroup instance to be removed from the Toolbar.
- set_axis(axis: ToolBarAxis)
Sets the axis direction of the Toolbar
- Parameters
axis (ui.ToolBarAxis) –