omni.flux.property_widget_builder.widget#
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
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.property_widget_builder.widget.extension.PropertyWidgetBuilderExtension#
Bases:
IExt
Create Final Configuration
- on_shutdown()#
- on_startup(ext_id)#
- omni.flux.property_widget_builder.widget.extension.get_instance()#
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
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.property_widget_builder.widget.property_widget_builder.PropertyWidget(
- model: Model | None = None,
- delegate: Delegate | None = None,
- tree_column_widths: List[Length] | None = None,
- columns_resizable: bool = False,
Bases:
object
Widget that let you build property widget(s) from any data
- destroy()#
- property tree_view: TreeWidget#
Treeview of the widget
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
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.
- omni.flux.property_widget_builder.widget.tree.clipboard.copy(
- items: Iterable[Item],
Copy the model items to the clipboard.
- omni.flux.property_widget_builder.widget.tree.clipboard.iter_clipboard_changes(
- items: Iterable[Item],
Yields items from relevant serialized items from the clipboard.
This method pairs chunks of clipboard data along with the relevant item from items.
- omni.flux.property_widget_builder.widget.tree.clipboard.paste(
- items: Iterable[Item],
Paste clipboard data to relevant model items.
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
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.property_widget_builder.widget.tree.delegate.Delegate(
- field_builders: list[FieldBuilder] | None = None,
- right_aligned_labels: bool = True,
Bases:
TreeDelegateBase
Delegate of the tree
- abstract property default_attr: dict[str, None]#
- get_widget_builder(
- item,
- default: Callable[[Item], Widget | list[Widget] | None] | None = None,
Get a callable that will build widget(s) for the provided item.
- reset()#
Resets any state stored on the delegate.
This method is called when the parent widget is hidden.
- set_model_edit_fn(widgets: list[Widget], item)#
Set the callbacks when the item is being edited.
- Parameters:
widgets – the list of widgets that show the item
item – the item
- set_model_value_changed_fn(
- widgets: list[Widget],
- item,
Set the callbacks when the value of the item changes.
- Parameters:
widgets – the list of widgets that show the item
item – the item
- value_model_updated(item)#
Callback ran whenever an item’s value model updates.
- class omni.flux.property_widget_builder.widget.tree.delegate.FieldBuilder( )#
Bases:
object
A FieldBuilder simply connects a method used to “claim” the widget building of an item and a callable responsible for creating the widgets.
- class omni.flux.property_widget_builder.widget.tree.delegate.FieldBuilderList(iterable=(), /)#
Bases:
list
[FieldBuilder
]A simple list of FieldBuilder with some helper methods to assist in constructing FieldBuilder instances.
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
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.property_widget_builder.widget.tree.item_model.ItemGroupNameModel(name)#
Bases:
ItemValueModel
The value model that handle the name an attribute
- get_value()#
- refresh()#
Called by the watcher when something change
- class omni.flux.property_widget_builder.widget.tree.item_model.ItemModel#
Bases:
ItemModelBase
,AbstractItemModel
Base class for item models that can handle multiple value models.
- class omni.flux.property_widget_builder.widget.tree.item_model.ItemModelBase#
Bases:
Serializable
,ABC
The base class for item models that will be used with Item and Model
- block_set_value(value: bool)#
Block the set value function
- Parameters:
value – block or not
- Returns:
None
- property cached_blocked_value: Any#
Return the cached value when the set value function is blocked
- get_tool_tip()#
Get the tooltip that best represents the current value
- property is_mixed#
Return true if this ItemModel currently represents multiple values
- is_set_value_blocked() bool #
Is the set value function blocked or not
- property multiline#
Used by the delegate to see if the item is multiline or not
- property read_only#
Used by the delegate to see if the item is read only or not
- abstract refresh()#
Called by the watcher when something change
- set_callback_post_set_value(
- callback: Callable[[Callable[[Any], Any], Any], Any],
Set a callback that will be executed after the value is set
- Parameters:
callback – callback that will be executed after the value is set. The callback will receive the “_set_value()” function and the value, if the callback wants to update the value manually
- Returns:
None
- set_callback_pre_set_value(
- callback: Callable[[Callable[[Any], Any], Any], Any],
Set a callback that will be executed before the value is set
- Parameters:
callback – callback that will be executed before the value is set. If the callback exists, the callback controls if the value should be set or not. The callback will receive the “_set_value()” function and the value
- Returns:
None
- set_value(value: Any)#
Function to override ui.AbstractValueModel._set_value()
This function should NOT be overridden. Please use _set_value(). Set the value. If “__block_set_value” is True, the value will not be set but cached into “__cached_blocked_value”. This can be used by a custom delegate to set a value when it wants (begin_edit_fn, end_edit_fn, etc).
- Parameters:
value – the value to set
- Returns:
None
- class omni.flux.property_widget_builder.widget.tree.item_model.ItemValueModel#
Bases:
ItemModelBase
,AbstractValueModel
Base value model class that can handle the value of an attribute (name or value)
- get_value_as_bool(
- self: omni.ui._ui.AbstractValueModel,
Return the bool representation of the value.
- get_value_as_float(
- self: omni.ui._ui.AbstractValueModel,
Return the float representation of the value.
- get_value_as_int(
- self: omni.ui._ui.AbstractValueModel,
Return the int representation of the value.
- get_value_as_string(
- self: omni.ui._ui.AbstractValueModel,
Return the string representation of the value.
- set_display_fn(
- display_fn: Callable[[Any, ItemValueModel], Any],
Function that will be called to filter the current value we want to show For example, if the value is “hello”, but we want to show “Hello”
- class omni.flux.property_widget_builder.widget.tree.item_model.Serializable#
Bases:
ABC
Mixin class to add serialization methods.
A single Serializer instance is shared for all classes that inherit from this class.
- deserialize(value)#
- abstract get_value()#
- register_serializer_hooks(serializer)#
Register serialization hooks for clipboard copy/paste.
Subclasses should overwrite this method if their get_value returns a type that is not natively supported by json. See the Serializer class documentation for more details.
- serialize()#
Get a serialized representation of this object.
Whatever is returned from this method should also be accepted as a value to the de method.
Sometimes special handling is needed for more complex types that are not natively supported in a serialized format.
- abstract set_value(value)#
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
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.property_widget_builder.widget.tree.model.Item#
Bases:
TreeItemBase
Item of the model
- apply_serialized_data(serialized_item: dict)#
- property can_have_children: bool#
- abstract property default_attr: dict[str, None]#
- property element_count: int#
- matches_serialized_data(serialized_item: dict)#
- property name_models: List[ItemModelBase]#
The name model that will be showed on the tree
- property read_only: bool#
Whether the item can have values edited or not
- refresh()#
- serialize() dict #
- property value_models: List[ItemModelBase]#
The name that will be showed on the tree
- class omni.flux.property_widget_builder.widget.tree.model.ItemGroup(name)#
Bases:
Item
Item Group of the model
- property can_have_children: bool#
- abstract property default_attr: dict[str, None]#
- class omni.flux.property_widget_builder.widget.tree.model.Model#
Bases:
TreeModelBase
[TreeItemBase
]Model for the treeview that will show a list of item(s)
- abstract property default_attr: dict[str, None]#
- get_all_items()#
- 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.
- refresh()#
Refresh everything