SettingsComboItemModel

class omni.kit.widget.settings.settings_model.SettingsComboItemModel(setting_path, key_value_pairs: Dict[str, Any], setting_is_index: bool = True)

Bases: AbstractItemModel

Model for a combo box - for each setting we have a dictionary of key, values

Methods

__init__(self)

Constructs AbstractItemModel.

destroy()

Destroy class and cleanup.

get_item_children([item])

this is called by the widget when it needs the submodel items

get_item_index(value)

Get the item index to the given value.

get_item_value_model(self[, item, column_id])

Get the value model associated with this item.

get_value()

Get current selected item value or index value if setting_is_index is True.

get_value_as_int()

Get current selected item index :returns: (int) Current selected item index

get_value_as_string()

Get current selected item label string.

set_items(key_value_pairs)

Set items and refresh UI.

set_reset_button(button)

Set reset button from ui.Rectangle.

set_value(value)

Set current selected to the given value

Attributes

setting_is_index

__init__(self: omni.ui._ui.AbstractItemModel) None

Constructs AbstractItemModel.

`kwargsdict`

See below

### Keyword Arguments:

class ComboboxIndexModel(combobox_model, *args, **kwargs)

Bases: SimpleIntModel

A custom ui.SimpleIntModel that can handle value <-> index conversion when setting values.

set_value(value, as_index=True)

Set the given index value to the model. If the given value is not int type, it will try to find the index from the given value. If the given value is int but as_index is False, it will still try to find the index from the given value.

destroy()

Destroy class and cleanup.

get_item_children(item: Optional[AbstractItem] = None)

this is called by the widget when it needs the submodel items

get_item_index(value: Any) Optional[int]

Get the item index to the given value.

Arg:

value (int|str|float): The value to set.

Returns

(int|None) Item index. None if no item found.

get_item_value_model(self: omni.ui._ui.AbstractItemModel, item: omni.ui._ui.AbstractItem = None, column_id: int = 0) omni.ui._ui.AbstractValueModel

Get the value model associated with this item.

### Arguments:

`item :`

The item to request the value model from. If it’s null, the root value model will be returned.

`index :`

The column number to get the value model.

get_value() Any

Get current selected item value or index value if setting_is_index is True.

Returns

(int|str|float) Current selected item value or index value depends

on the self._setting_is_index attribute.

get_value_as_int() int

Get current selected item index :returns: (int) Current selected item index

get_value_as_string() str

Get current selected item label string.

Returns

(str) Current selected item label string.

set_items(key_value_pairs: Dict[str, Any])

Set items and refresh UI.

set_reset_button(button: Rectangle)

Set reset button from ui.Rectangle.

set_value(value: Any) Optional[int]

Set current selected to the given value

Arg:

value (int|str|float): The value to set.

Returns

(int|None) Item index set. None if no item found.