RegistriesModel

class omni.kit.window.extensions.exts_properties_registries.RegistriesModel

Bases: AbstractItemModel

A model representing a collection of registry items for an application.

This class maintains a list of registry items, each represented by a `RegistryItem` instance. It provides methods to load registry data, add or remove registry items, save changes, and set a default registry.

The class uses an internal model to manage the state of each registry item and to interact with the UI for displaying and editing registries. It also handles notifications for registry changes and ensures that registry updates are saved to the application settings.

The model is used in conjunction with a UI tree view to enable users to view and modify the list of registries in a structured fashion.

Methods

__init__()

Initializes the model for the registries view.

add_empty()

Adds a new empty item to the model.

destroy()

Clears all children items from the model.

get_item_children(item)

Retrieves the child items of a given item.

get_item_value_model(item, column_id)

Gets the value model for a given item and column.

get_item_value_model_count(item)

Returns the number of columns for the item's value model.

remove_item(item)

Removes a specified item from the model and saves the change.

save()

Saves the current state of the model's registries to settings.

set_default(item, value)

Sets a specified item as the default registry.

__init__()

Initializes the model for the registries view.

add_empty()

Adds a new empty item to the model.

destroy()

Clears all children items from the model.

get_item_children(item)

Retrieves the child items of a given item.

Parameters

item (ui.AbstractItem) – The parent item whose children are to be retrieved.

Returns

A list of child items.

Return type

list

get_item_value_model(item, column_id)

Gets the value model for a given item and column.

Parameters
  • item (ui.AbstractItem) – The item to get the value model for.

  • column_id (int) – The ID of the column.

Returns

The value model for the specified item and column.

Return type

ui.SimpleStringModel or None

get_item_value_model_count(item)

Returns the number of columns for the item’s value model.

Parameters

item (ui.AbstractItem) – The item to get the value model count for.

Returns

The number of value model columns.

Return type

int

remove_item(item)

Removes a specified item from the model and saves the change.

Parameters

item (ui.AbstractItem) – The item to be removed.

save()

Saves the current state of the model’s registries to settings.

set_default(item, value)

Sets a specified item as the default registry.

Parameters
  • item (ui.AbstractItem) – The item to set as default or not.

  • value (bool) – Whether to set or unset the item as default.