model

  • SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

  • SPDX-License-Identifier: Apache-2.0

  • Licensed under the Apache License, Version 2.0 (the “License”);

  • you may not use this file except in compliance with the License.

  • You may obtain a copy of the License at

  • https://www.apache.org/licenses/LICENSE-2.0

  • Unless required by applicable law or agreed to in writing, software

  • distributed under the License is distributed on an “AS IS” BASIS,

  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  • See the License for the specific language governing permissions and

  • limitations under the License.

class omni.flux.tree_panel.widget.tree.model.Item(parent: Optional[omni.flux.tree_panel.widget.tree.model.Item] = None)

Bases: omni.ui._ui.AbstractItem

Item of the model

__init__(self: omni.ui._ui.AbstractItem) None
abstract can_item_have_children(item: omni.flux.tree_panel.widget.tree.model.Item) bool

Define if the item can have children or not

Parameters

item – the item itself

Returns

If the item can has a children or not

abstract property component_type: Optional[str]

The component type. Use this attribute to set a “type/category” of your item. This attribute is used in the delegate as a style for the branch icon like: f”TreeViewBranch{item.component_type}”

property enabled
abstract on_mouse_pressed()

Called when the user click with the left mouse button

subscribe_item_enabled(function)

Return the object that will automatically unsubscribe when destroyed. Called when we click on a tool (change of the selected tool)

abstract property title: str

The title that will be showed on the tree

class omni.flux.tree_panel.widget.tree.model.Model

Bases: omni.ui._ui.AbstractItemModel

Basic list model

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

Constructs AbstractItemModel.

kwargs : dict

See below

### Keyword Arguments:

destroy()
get_item_children(item: Optional[omni.flux.tree_panel.widget.tree.model.Item])

Returns all the children when the widget asks it.

get_item_value_model(item, column_id)

Return value model. It’s the object that tracks the specific value. In our case we use ui.SimpleStringModel.

get_item_value_model_count(item: omni.flux.tree_panel.widget.tree.model.Item)

The number of columns

set_items(items: List[omni.flux.tree_panel.widget.tree.model.Item])

Set the items to show