CityModel#

class omni.kit.environment.core.CityModel#

Bases: AbstractItemModel

The model that has int value in the root, so it’s acceptable by city combo box.

Methods

__init__(self)

Constructs AbstractItemModel.

get_item_children([item])

Returns all the children items when requested by the widget.

get_item_value_model([item, column_id])

Get the item value model.

get_item_value_model_count([item])

Returns the number of columns in the model.

set_location(longitude, latitude)

Set location to refresh city.

Attributes

current_index

Gets the current index value of the model.

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

Constructs AbstractItemModel.

`kwargsdict`

See below

### Keyword Arguments:

get_item_children(
item=None,
) List[LocationItem]#

Returns all the children items when requested by the widget.

Parameters:

item (Optional[LocationItem]) – Item to query for children.

Returns:

List of children items if item is None; otherwise, an empty list.

Return type:

List[LocationItem]

get_item_value_model(
item: LocationItem | None = None,
column_id=0,
) AbstractValueModel#

Get the item value model.

Parameters:
  • item (Optional[LocationItem]) – Item to query. If provided, its value model is returned.

  • column_id (int) – Column id used to determine which model to return.

Returns:

If item is None, returns the current index model; otherwise, returns the model corresponding to the provided column id.

Return type:

ui.AbstractValueModel

get_item_value_model_count(item=None) int#

Returns the number of columns in the model. The provided item parameter is ignored.

Parameters:

item (Optional[LocationItem]) – Unused parameter.

Returns:

Number of columns (always 1).

Return type:

int

set_location(longitude: float, latitude: float) None#

Set location to refresh city. :param longitude: Longitude. :type longitude: float :param latitude: Latitude. :type latitude: float

property current_index: int#

Gets the current index value of the model.

Returns:

Current index value from the SimpleIntModel.

Return type:

int