RadioModel#

class omni.kit.widget.options_menu.RadioModel(texts: List[str], default_index: int = 0)#

Bases: AbstractItemModel

A class that represents a model for radio buttons, allowing the selection of a single option from a list.

Parameters:
  • texts (List[str]) – A list of strings representing the options.

  • default_index (int) – The index of the initially selected option.

Methods

__init__(texts[, default_index])

Initializes a new instance of RadioModel.

get_item_children([item])

Gets the children items of a given item or all items if no item is provided.

reset()

Resets the index to the default value.

Attributes

dirty

Gets whether the current selected index is not the default one.

index

Gets the current index value.

index_model

Gets the model of the current index.

index_text

Gets the text of the currently selected string.

__init__(texts: List[str], default_index: int = 0)#

Initializes a new instance of RadioModel.

get_item_children(
item: RadioItem | None = None,
) List[RadioItem]#

Gets the children items of a given item or all items if no item is provided.

Parameters:

item (Optional[RadioItem]) – The parent item or None for all items.

Returns:

A list of child items.

Return type:

List[RadioItem]

reset() None#

Resets the index to the default value.

property dirty: bool#

Gets whether the current selected index is not the default one.

Returns:

True if the current index is not the default, False otherwise.

Return type:

bool

property index: int#

Gets the current index value.

Returns:

The current index value.

Return type:

int

property index_model: SimpleIntModel#

Gets the model of the current index.

Returns:

The model representing the current index.

Return type:

ui.SimpleIntModel

property index_text: str#

Gets the text of the currently selected string.

Returns:

The text of the current selection.

Return type:

str