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#
Create Final Configuration
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,
- tree_min_column_widths: list[Length] | None = None,
- columns_resizable: bool = False,
- select_all_children: bool = False,
Widget that let you build property widget(s) from any data
- 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.
- class omni.flux.property_widget_builder.widget.tree.clipboard.AttributeCopyPasteHelper#
Clipboard ownership for property rows; models retain editing policy.
- classmethod can_paste(*, target_rows) bool#
Check clipboard structure and row eligibility without invoking setters.
- classmethod copy(*, source_rows) None#
Copy eligible rows using property identities rather than source prim paths.
- classmethod paste(*, target_rows) None#
Group synchronous row edits. Existing callbacks own any delayed writes.
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.ClaimResult(
- primary: list[~omni.flux.property_widget_builder.widget.tree.model.Item] = <factory>,
- companions: list[~omni.flux.property_widget_builder.widget.tree.model.Item] = <factory>,
Return value from a builder’s
claim_func.primaryitems stay visible and are built by this builder.companionsare hidden (they belong to the same logical group but should not render their own row in the property panel).
- class omni.flux.property_widget_builder.widget.tree.delegate.Delegate(
- field_builders: list[FieldBuilder] | None = None,
- right_aligned_labels: bool = True,
Delegate of the tree
- build_widget( ) None#
Create a widget per item. To define the build function, override _build_widget. This function wraps the widget in a frame with an on-click listener.
- get_field_builder(
- item,
- default: Callable[[Item], Widget | list[Widget] | None] = None,
Get the full builder for the provided
itemfrom the stored claim mapping.
- get_widget_builder(
- item,
- default: Callable[[Item], Widget | list[Widget] | None] = None,
Get the build callable for the provided
itemfrom the stored claim mapping.
- reset()#
Resets any state stored on the delegate.
This method is called when the parent widget is hidden.
- resolve_claims(
- model: Model,
Run claim resolution across all items in the model.
Iterates builders in
reversed(field_builders)order (highest priority first). Each builder’sclaim_funcreceives the current list of unclaimed items and returns aClaimResult. Companion items are hidden; primary items are mapped to their builder; all claimed items are removed from the unclaimed pool.
- 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(
- claim_func: Callable[[list[Item]], ClaimResult],
- build_func: Callable[[...], Widget | list[Widget] | None],
- supports_field_cleanup: bool = False,
- builds_drag_field_group: bool = False,
Connects a claim strategy with a widget build callable.
claim_funcreceives the full list of unclaimed items and returns aClaimResultindicating which items this builder claims as primary (visible) and which as companions (hidden). Useclaim_each()to wrap a simple per-item predicate.build_funcbuilds the widget for each primary item.Factory functions that create an
AbstractDragFieldGroupsetbuilds_drag_field_groupso rows share the delegate’s link coordinator.
- class omni.flux.property_widget_builder.widget.tree.delegate.FieldBuilderList(iterable=(), /)#
A simple list of FieldBuilder with some helper methods to assist in constructing FieldBuilder instances.
- omni.flux.property_widget_builder.widget.tree.delegate.claim_each(
- predicate: Callable[[Item], bool],
Wrap a per-item predicate into a
claim_func(each match is primary, no companions).
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: str, tooltip: str = '')#
Read-only static name model for grouped tree rows.
- get_tool_tip() str#
Return the tooltip text for the group row.
- Returns:
Tooltip string, or an empty string.
- get_tooltip() str#
Return the tooltip text for the group row.
- Returns:
Tooltip string, or an empty string.
- get_value() str#
Return the display name value.
- Returns:
Static group row display text.
- refresh() None#
Refresh hook for watcher compatibility; static group names do not change.
- class omni.flux.property_widget_builder.widget.tree.item_model.ItemModel#
Base class for item models that can handle multiple value models.
- class omni.flux.property_widget_builder.widget.tree.item_model.ItemModelBase#
The base class for item models that will be used with Item and Model
- begin_batch_edit() None#
Begin a batch edit when supported; the default implementation is a no-op.
- 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
- cancel_property_edit_interaction() None#
Leave models without an editing lifecycle unchanged.
- end_batch_edit() None#
End a batch edit when supported; the default implementation is a no-op.
- get_tool_tip()#
Get the tooltip that best represents the current value
- abstractmethod get_value() Any#
Return the current value in the representation accepted by the model’s setter.
- property is_batch_editing: bool#
Return whether this model is currently inside an open batch-edit section.
- 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 is_virtual: bool#
Return whether the model allows a missing backing property.
- 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
- abstractmethod refresh() None#
Refresh hook for watcher compatibility; static group names do not 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_property_edit_callbacks(
- begin_callback: Callable[[ItemModelBase], None] | None,
- end_callback: Callable[[ItemModelBase], None] | None,
Accept editing hooks without changing models that have no editing lifecycle.
- 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
- property supports_batch_edit: bool#
Return whether delegates can group multiple UI edits into one logical batch on this model.
- class omni.flux.property_widget_builder.widget.tree.item_model.ItemValueModel#
Base value model class that can handle the value of an attribute (name or value)
- begin_edit(
- self: omni.ui._ui.AbstractValueModel,
Called when the user starts the editing. If it’s a field, this method is called when the user activates the field and places the cursor inside. This method should be reimplemented.
- cancel_property_edit_interaction() None#
Leave models without an editing lifecycle unchanged.
- end_edit(self: omni.ui._ui.AbstractValueModel) None#
Called when the user finishes the editing. If it’s a field, this method is called when the user presses Enter or selects another field for editing. It’s useful for undo/redo. This method should be reimplemented.
- 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”
- set_property_edit_callbacks(
- begin_callback: Callable[[ItemModelBase], None] | None,
- end_callback: Callable[[ItemModelBase], None] | None,
Accept editing hooks without changing models that have no editing lifecycle.
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#
Item of the model
- property can_have_children: bool#
Whether this item may have child items.
- get_logical_row_attribute_names() list[str] | None#
Return declared backing attributes for logical rows, or None for ordinary rows.
Whether this item is excluded from the TreeView.
- property linked_edit_enabled: bool#
Whether edits to one value model apply to every model in this item.
- 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
- set_linked_edit_enabled(enabled: bool) None#
Set linked editing and notify subscribers when its state changes.
- set_row_values(prepared_values: tuple[object, ...]) None#
Apply one prepared input per value model through its existing setter.
- Parameters:
prepared_values – Values in the row’s value-model order.
- Raises:
ValueError – If the number of values does not match the row.
- subscribe_linked_edit_changed(
- function: Callable[[bool], None],
Subscribe to linked-edit state changes.
- synchronize_linked_edit_value(source_index: int, value) None#
Apply one edited value to the other value models while linked.
- toggle_linked_edit() None#
Toggle linked editing, copying the first model value when enabling it.
- 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: str, expanded: bool = False)#
Item Group of the model
- property can_have_children: bool#
Whether this item may have child items.
- property expanded: bool#
Whether this group should be expanded by default.
- class omni.flux.property_widget_builder.widget.tree.model.Model#
Model for the treeview that will show a list of item(s)
- get_all_items(include_hidden: bool = False)#
Return all items in the model, optionally including hidden rows.
- Parameters:
include_hidden – Whether to include rows hidden by delegate or property visibility state.
- Returns:
Flattened list of tree items.
- get_item_children(
- item: Item | None,
Return visible children requested by the tree widget.
- Parameters:
item – Parent item whose children should be returned, or
Nonefor root items.- Returns:
Child items not hidden by delegate or property visibility state.
- 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