file_path
stringlengths 5
148
| content
stringlengths 0
526k
|
---|---|
omni.kit.widget.filebrowser.FileBrowserModel.md | # FileBrowserModel
## FileBrowserModel
```python
class omni.kit.widget.filebrowser.FileBrowserModel(name: Optional[str] = None, root_path: str = '', **kwargs)
```
**Bases:** `AbstractItemModel`
**Description:**
Base class for the Filebrowser view Model. Should be sub-classed to implement specific filesystem behavior.
**Parameters:**
- `name` (str): Name of root item. If None given, then create an initially empty model.
**Keyword Arguments:**
- `drop_fn` (Callable): Function called to handle drag-n-drops. Function signature: `void drop_fn(dst_item: FileBrowserItem, src_item: FileBrowserItem)`
- `filter_fn` (Callable): This handler should return True if the given Filebrowser view item is visible, False otherwise. Function signature: `bool filter_fn(item: FileBrowserItem)`
```
### Attributes
- **FileBrowserItem**
- **sort_by_field** (str) – Name of column by which to sort items in the same folder. Default “name”.
- **sort_ascending** (bool) – Sort in ascending order. Default True.
- **timeout** (float) – Timeout when updating item asynchronously.
### Methods
- **__init__**(self) - Constructs AbstractItemModel.
- **auto_refresh_item**(item[, throttle_frames]) - Watch the given folder and updates the children list as soon as its contents are changed.
- **copy_presets**(model) - Reset our fields to default arguments from the given model.
- **destroy**() - Destructor.
- **drop**(dst_item, source) - Invoke user-supplied function to handle dropping source onto destination item.
- **drop_accepted**(dst_item, src_item) - Reimplemented from AbstractItemModel.
- **filter_items**(items) - Return the items filtered with the filter function set.
- **get_drag_mime_data**(item) - Return Multipurpose Internet Mail Extensions (MIME) data for be able to drop this item somewhere.
- **get_item_children**(item) - Return the list of items that are nested to the given parent item.
- **get_item_value_model**(item, index) - Get the value model associated with this item.
- **get_item_value_model_count**(item) - Return the number of columns this model item contains.
- **on_list_change_event**(item, result, event, entry) -
Process change events for the given folder.
Set the handler that would return True if the given Filebrowser view item is visible, False otherwise.
Scan given folder for missed changes; processes any changes found.
Attributes
------------
builtin_column_count
--------------------
Return the number of available columns without tag delegates
drag_mime_data
--------------
Return the string with the drag and drop payload.
root
----
Get/set the root item of this model.
show_udim_sequence
-------------------
Show the UDIM sequence.
single_column
-------------
The panel on the left side works in one-column mode
sort_ascending
--------------
Get/set the sort ascending state.
sort_by_field
-------------
Get/set the sort-by field name.
__init__
--------
Constructs AbstractItemModel.
### Keyword Arguments:
- `kwargs dict`: See below
auto_refresh_item
------------------
(item: FileBrowserItem, throttle_frames)
### auto_refresh_item
Watch the given folder and updates the children list as soon as its contents are changed.
#### Parameters
- **item** (`FileBrowserItem`) – The folder item to watch.
- **throttle_frames** – Number of frames to throttle the UI refresh.
### copy_presets
Reset our fields to default arguments from the given model.
### destroy
Destructor.
### drop
Invoke user-supplied function to handle dropping source onto destination item.
#### Parameters
- **dst_item** (`FileBrowserItem`) – Target item.
- **src_item** (`FileBrowserItem`) – Source item.
### FileBrowserModel.drop_accepted
```python
drop_accepted(dst_item: FileBrowserItem, src_item: FileBrowserItem) -> bool
```
Reimplemented from AbstractItemModel. Called to highlight target when drag and drop. Returns True if destination item is able to accept a drop. This function can be overriden to implement a different behavior.
#### Parameters
- **dst_item** (FileBrowserItem) – Target item.
- **src_item** (FileBrowserItem) – Source item.
#### Returns
- bool
### FileBrowserModel.filter_items
```python
filter_items(items: List[FileBrowserItem]) -> List[FileBrowserItem]
```
Return the items filtered with the filter function set.
### FileBrowserModel.get_drag_mime_data
```python
get_drag_mime_data(item: FileBrowserItem)
```
Return Multipurpose Internet Mail Extensions (MIME) data for be able to drop this item somewhere.
### FileBrowserModel.get_item_children
```python
get_item_children(item: FileBrowserItem) -> List[FileBrowserItem]
```
```
### get_item_children
Return the list of items that are nested to the given parent item.
**Parameters**
- **item** (`FileBrowserItem`) – Parent item.
**Returns**
- list[`FileBrowserItem`]
### get_item_value_model
Get the value model associated with this item.
**Parameters**
- **item** (`FileBrowserItem`) – The item in question.
**Returns**
- `AbstractValueModel`
### get_item_value_model_count
Return the number of columns this model item contains.
**Parameters**
- **item** (`FileBrowserItem`) – The item in question.
**Returns**
- int
### on_list_change_event
(Method description not provided)
**Parameters**
- **item** (`FileBrowserItem`) – The item in question.
- **result** (`Result`) – (Description not provided)
Process change events for the given folder.
Parameters
----------
- **item** (`FileBrowserItem`) – The folder item.
- **result** (`omni.client.Result`) – Set by omni.client upon listing the folder.
- **event** (`omni.client.ListEvent`) – Event type.
- **throttle_frames** – Number of frames to throttle the UI refresh.
Set the handler that would return True if the given Filebrowser view item is visible, False otherwise. Function signature: bool filter_fn(item: `FileBrowserItem`)
Scan given folder for missed changes; processes any changes found.
Parameters
----------
- **item** (`FileBrowserItem`) – The folder item to watch.
Return the number of available columns without tag delegates
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.widget.filebrowser.FileBrowserModel.drag_mime_data">
<em class="property">
<span class="pre">
property
</span>
<span class="w">
</span>
</em>
<span class="sig-name descname">
<span class="pre">
drag_mime_data
</span>
</span>
<a class="headerlink" href="#omni.kit.widget.filebrowser.FileBrowserModel.drag_mime_data" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Return the string with the drag and drop payload.
</p>
</dd>
</dl>
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.widget.filebrowser.FileBrowserModel.root">
<em class="property">
<span class="pre">
property
</span>
<span class="w">
</span>
</em>
<span class="sig-name descname">
<span class="pre">
root
</span>
</span>
<em class="property">
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="pre">
FileBrowserItem
</span>
</em>
</dt>
<dd>
<p>
Get/set the root item of this model.
</p>
<dl class="field-list simple">
<dt class="field-odd">
Type
</dt>
<dd class="field-odd">
<p>
<code class="xref py py-obj docutils literal notranslate">
<span class="pre">
FileBrowserItem
</span>
</code>
</p>
</dd>
</dl>
</dd>
</dl>
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.widget.filebrowser.FileBrowserModel.show_udim_sequence">
<em class="property">
<span class="pre">
property
</span>
<span class="w">
</span>
</em>
<span class="sig-name descname">
<span class="pre">
show_udim_sequence
</span>
</span>
</dt>
<dd>
<p>
Show the UDIM sequence.
</p>
</dd>
</dl>
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.widget.filebrowser.FileBrowserModel.single_column">
<em class="property">
<span class="pre">
property
</span>
<span class="w">
</span>
</em>
<span class="sig-name descname">
<span class="pre">
single_column
</span>
</span>
</dt>
<dd>
<p>
The panel on the left side works in one-column mode
</p>
</dd>
</dl>
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.widget.filebrowser.FileBrowserModel.sort_ascending">
<em class="property">
<span class="pre">
property
</span>
<span class="w">
</span>
</em>
<span class="sig-name descname">
<span class="pre">
sort_ascending
</span>
</span>
<em class="property">
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="pre">
bool
</span>
</em>
</dt>
<dd>
<p>
Get/set the sort ascending state.
</p>
<dl class="field-list simple">
<dt class="field-odd">
Type
</dt>
<dd class="field-odd">
<p>
<code class="xref py py-obj docutils literal notranslate">
<span class="pre">
FileBrowserItem
</span>
</code>
</p>
</dd>
</dl>
</dd>
</dl>
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.widget.filebrowser.FileBrowserModel.sort_by_field">
<em class="property">
<span class="pre">
property
</span>
<span class="w">
</span>
</em>
<span class="sig-name descname">
<span class="pre">
sort_by_field
</span>
</span>
<em class="property">
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="pre">
str
</span>
</em>
</dt>
<dd>
<p>
Get/set the sort-by field name.
</p>
<dl class="field-list simple">
<dt class="field-odd">
Type
</dt>
<dd class="field-odd">
<p>
<code class="xref py py-obj docutils literal notranslate">
<span class="pre">
FileBrowserItem
</span>
</code>
</p>
</dd>
</dl>
</dd>
</dl> |
omni.kit.widget.filebrowser.FileBrowserUdimItem.md | # FileBrowserUdimItem
## FileBrowserUdimItem
```python
class omni.kit.widget.filebrowser.FileBrowserUdimItem(path: str, fields: FileBrowserItemFields, range_start: int, range_end: int, repr_frame: Optional[int] = None)
```
Bases: `FileBrowserItem`
A Filebrowser UDIM item class for navigating a the local filesystem in a Filebrowser view. Sub-classed from `FileBrowserItem`.
### Parameters
- **path** (`str`): The path to the file or directory.
- **fields** (`FileBrowserItemFields`): The fields associated with the item.
- **range_start** (`int`): The start range of the item.
- **range_end** (`int`): The end range of the item.
- **repr_frame** (`Optional[int]`): The representation frame, default is `None`.
```
### Parameters
- **path** (`str`) – path of the item.
- **fields** (`FileBrowserItemFields`) – Fields of the item.
- **is_folder** (`bool`) – Specify the item as a folder.
- **range_start** (`int`) – Starting index of UDIM sequence.
- **range_end** (`int`) – End index of UDIM sequence.
- **repr_frame** (`int`) – Index in UDIM sequence.
### Methods
- `__init__(self)`
- `get_udim_sequence(full_path: str)` - Get the UDIM sequence by path.
- `populate_udim(parent: FileBrowserItem)` - Generate UDIM items under the given item.
### Attributes
- `repr_path` - Full thumbnail path name.
### `__init__(self: omni.ui._ui.AbstractItem) -> None`
### `get_udim_sequence(full_path: str)`
Get the UDIM sequence by path.
### `populate_udim(parent: FileBrowserItem)`
Generate UDIM items under the given item.
## repr_path
Full thumbnail path name.
### Type
- str |
omni.kit.widget.filebrowser.FileBrowserWidget.md | # FileBrowserWidget
## Overview
The basic UI widget for navigating a filesystem as a tree or grid view. The filesystem can either be from your local machine or the Omniverse Nucleus server.
### Parameters
- **title** (str) – Widget title. Default None.
### Keyword Arguments
- **layout** (int) – The overall layout of the window, one of: {LAYOUT_SPLIT_PANES, LAYOUT_SINGLE_PANE_SLIM, LAYOUT_SINGLE_PANE_WIDE, LAYOUT_DEFAULT}. Default LAYOUT_SPLIT_PANES.
- **splitter_offset** (int) – Position of vertical splitter bar. Default 300.
- **tooltip** (bool) – Display tooltips when hovering over items. Default False.
- **allow_multi_selection** (bool) – Allow multiple items to be selected at once. Default True.
- **mouse_pressed_fn** (Callable) – Function called on mouse press. Function signature: void mouse_pressed_fn(pane: int, button: int, key_mode: int, item: FileBrowserItem, x: float=0, y: float=0)
- **mouse_double_clicked_fn** (Callable) – Function called on mouse double click. Function signature: void mouse_double_clicked_fn(pane: int, button: int, key_mode: int, item: FileBrowserItem)
### Parameters
- **FileBrowserItem** (title, x: float=0, y: float=0)
- **selection_changed_fn** (Callable) – Function called when selection changed. Function signature: void selection_changed_fn(pane: int, selections: list[FileBrowserItem])
- **drop_fn** (Callable) – Function called to handle drag-n-drops. Function signature: void drop_fn(dst_item: FileBrowserItem, src_path: str)
- **filter_fn** (Callable) – This user function should return True if the given tree view item is visible, False otherwise. Function signature: bool filter_fn(item: FileBrowserItem)
- **show_grid_view** (bool) – If True, initialize the folder view to display icons. Default False.
- **show_recycle_widget** (bool) – If True, show recycle view in the left bottom corner. Default False.
- **grid_view_scale** (int) – Scales grid view, ranges from 0-5. Default 2.
- **on_toggle_grid_view_fn** (Callable) – Callback after toggle grid view is executed. Default None.
- **on_scale_grid_view_fn** (Callable) – Callback after scale grid view is executed. Default None.
- **icon_provider** (Callable) – This callback provides an icon to replace the default one in the tree view. Signature: str icon_provider(item: FileBrowserItem, expanded: bool).
- **thumbnail_provider** (Callable) – This callback returns the path to the item’s thumbnail. If not specified, then a default thumbnail is used. Signature: str thumbnail_provider(item: FileBrowserItem).
- **badges_provider** (Callable) – This callback provides the list of badges to layer atop the thumbnail in the grid view. Callback signature: List[str] badges_provider(item: FileBrowserItem)
- **treeview_identifier** (str) – widget identifier for treeview, only used by tests.
- **enable_zoombar** (bool) – Enables/disables zoombar. Default True.
### Methods
- **__init__** (title, **kwargs)
- **add_model_as_subtree** (model[, parent]) – Add a new model as the subtree of the tree view root model or the given parent item.
- **clear_item_alert** (item) – Clear the alert of the given item.
create_grouping_item (name, path[, parent])
Create a folder item at the given path and add it as child to the tree view root model or the given parent item.
delete_child (item[, parent])
Delete an item from the tree view root model or the given parent item.
delete_child_by_name (item_name[, parent])
Delete an item from the tree view root model or the given parent item.
destroy ()
Destructor.
get_root ([pane])
Get the root item of the treeview by pane.
get_selected_item ([pane])
Return last of selected item from the specified pane.
get_selections ([pane])
Return list of selected items from the specified pane.
hide_notification ()
Hide the notification frame.
link_views (src_widget)
Link this widget to the given widget, i.e. the 2 widgets will therafter display the same models but not necessarily share the same view.
refresh_ui ([item, listview_only])
Redraw the subtree rooted at the given item.
scale_grid_view (scale)
Set the scale of item inside grid view.
select_and_center (selection[, pane])
Select and centers the tree view on the given item, expanding the tree if needed.
set_expanded (item, expanded[, recursive])
Set the expansion state of the given item.
set_item_alert (item, alert_level, msg)
Set the alert message of the given item.
| Method | Description |
| ------ | ----------- |
| `set_item_error(item, msg)` | Set the error message of the given item. |
| `set_item_info(item, msg)` | Set the info message of the given item. |
| `set_item_warning(item, msg)` | Set the warning message of the given item. |
| `set_selections(selections[, pane])` | Selected given items in given pane. |
| `show_model(model)` | Show the given model. |
| `show_notification()` | Show the notification frame. |
| `toggle_grid_view(show_grid_view)` | Toggle on/of grid view. |
### Attributes
| Attribute | Description |
| --------- | ----------- |
| `show_grid_view` | Return True if grid view is visible. |
| `show_udim_sequence` | Return True if the list model has UDIM sequence visible. |
### Methods
```python
__init__(title: str, **kwargs)
```
```python
add_model_as_subtree(model: FileBrowserModel, parent: Optional[FileBrowserItem])
```
```
### Add a new model as the subtree of the tree view root model or the given parent item.
**Parameters**
- **model** (`FileBrowserModel`) – the model to add.
- **parent** (`FileBrowserItem`) – If set, add the model as a child to this item instead of the tree view root model.
### Clear the alert of the given item.
**Parameters**
- **item** (`FileBrowserItem`) – Item to clear the alert.
### Create a folder item at the given path and add it as child to the tree view root model or the given parent item.
**Parameters**
- **name** (`str`) – name of the item.
- **path** (`str`) – path of the item.
- **parent** (`Optional[FileBrowserItem]`) – If set, add the item as a child to this parent item.
**Returns**
- `FileBrowserItem`
### delete_child
```delete_child```(item: FileBrowserItem, parent: Optional[FileBrowserItem] = None)
Delete an item from the tree view root model or the given parent item.
**Parameters:**
- **item** (FileBrowserItem) – the item to remove.
- **parent** (FileBrowserItem) – If set, remove the item from this item instead of the tree view root model.
### delete_child_by_name
```delete_child_by_name```(item_name: str, parent: Optional[FileBrowserItem] = None)
Delete an item from the tree view root model or the given parent item.
**Parameters:**
- **item_name** (str) – the item name to remove.
- **parent** (FileBrowserItem) – If set, remove the item from this item instead of the tree view root model.
### destroy
```destroy```()
Destructor. Called by extension before destroying this object. It doesn’t happen automatically. Without this hot reloading doesn’t work.
### get_root
`get_root(pane: Optional[int] = None) -> FileBrowserItem`
- Get the root item of the treeview by pane.
### get_selected_item
`get_selected_item(pane: int = 1) -> FileBrowserItem`
- Return last of selected item from the specified pane.
- **Parameters**
- **pane** (int) – One of TREEVIEW_PANE, LISTVIEW_PANE. Returns the union if None is specified.
- **Returns**
- `FileBrowserItem` or None
### get_selections
`get_selections(pane: int = 1) -> List[FileBrowserItem]`
- Return list of selected items from the specified pane.
- **Parameters**
- **pane** (int) – One of TREEVIEW_PANE, LISTVIEW_PANE. Returns the union if None is specified.
- **Returns**
- list[`FileBrowserItem`]
### hide_notification
`hide_notification()`
- Hide the notification frame.
### Link Views
```python
link_views(src_widget: FilePickerWidget)
```
Link this widget to the given widget, i.e. the 2 widgets will thereafter display the same models but not necessarily share the same view.
#### Parameters
- **src_widget** (`FilePickerWidget`) – The source widget.
### Refresh UI
```python
refresh_ui(item: Optional[FileBrowserItem] = None, listview_only: bool = False)
```
Redraw the subtree rooted at the given item. If item is None, then redraws entire tree.
#### Parameters
- **item** (`FileBrowserItem`) – Root of subtree to redraw. Default None, i.e. root.
### Scale Grid View
```python
scale_grid_view(scale: float)
```
Set the scale of item inside grid view.
### Select and Center
```python
select_and_center(selection: FileBrowserItem, pane: int = 1)
```
Select and centers the tree view on the given item, expanding the tree if needed.
#### Parameters
- **selection** (`FileBrowserItem`) – The item to select and center.
- **pane** (`int`) – The pane number. Default is 1.
### set_expanded
```python
set_expanded(item: FileBrowserItem, expanded: bool, recursive: bool = False)
```
Set the expansion state of the given item.
**Parameters**
- **item** (FileBrowserItem) – The item to effect.
- **expanded** (bool) – True to expand, False to collapse.
- **recursive** (bool) – Apply state recursively to descendent nodes. Default False.
### set_item_alert
```python
set_item_alert(item: FileBrowserItem, alert_level: int, msg: str)
```
Set the alert message of the given item.
**Parameters**
- **item** (FileBrowserItem) – Item to set alert.
- **alert_level** (int) – level of alert.
- **msg** (str) – message to alert.
### set_item_error
```python
set_item_error(item: FileBrowserItem, error_msg: str)
```
Set the error message of the given item.
**Parameters**
- **item** (FileBrowserItem) – Item to set error.
- **error_msg** (str) – message of error.
### set_item_error
Set the error message of the given item.
#### Parameters
- **item** (`FileBrowserItem`) – Item to set alert.
- **alert_level** (`int`) – level of alert.
- **msg** (`str`) – message to alert.
### set_item_info
Set the info message of the given item.
#### Parameters
- **item** (`FileBrowserItem`) – Item to set alert.
- **alert_level** (`int`) – level of alert.
- **msg** (`str`) – message to alert.
### set_item_warning
Set the warning message of the given item.
#### Parameters
- **item** (`FileBrowserItem`) – Item to set alert.
- **alert_level** (`int`) – level of alert.
- **msg** (`str`) – message to alert.
### set_selections
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.widget.filebrowser.FileBrowserWidget.set_selections">
<span class="sig-name descname">
<span class="pre">
set_selections
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="pre">
selections:
</span>
<span class="pre">
[<class
</span>
<span class="pre">
'omni.kit.widget.filebrowser.model.FileBrowserItem'>],
</span>
<span class="pre">
pane:
</span>
<span class="pre">
int
</span>
<span class="pre">
=
</span>
<span class="pre">
1
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Selected given items in given pane.
</p>
<dl class="field-list simple">
<dt class="field-odd">
Parameters
</dt>
<dd class="field-odd">
<ul class="simple">
<li>
<p>
<strong>
selections
</strong>
(list[
<code class="xref py py-obj docutils literal notranslate">
<span class="pre">
FileBrowserItem
</span>
</code>
]) – list of selections.
</p>
</li>
<li>
<p>
<strong>
pane
</strong>
(
<em>
int
</em>
) – One of TREEVIEW_PANE, LISTVIEW_PANE, or None for both. Default None.
</p>
</li>
</ul>
</dd>
</dl>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.widget.filebrowser.FileBrowserWidget.show_model">
<span class="sig-name descname">
<span class="pre">
show_model
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
model
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
FileBrowserModel
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Show the given model.
</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.widget.filebrowser.FileBrowserWidget.show_notification">
<span class="sig-name descname">
<span class="pre">
show_notification
</span>
</span>
<span class="sig-paren">
(
</span>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Show the notification frame.
</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.widget.filebrowser.FileBrowserWidget.toggle_grid_view">
<span class="sig-name descname">
<span class="pre">
toggle_grid_view
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
show_grid_view
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
bool
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Toggle on/of grid view.
</p>
</dd>
</dl>
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.widget.filebrowser.FileBrowserWidget.show_grid_view">
<em class="property">
<span class="pre">
property
</span>
<span class="w">
</span>
</em>
<span class="sig-name descname">
<span class="pre">
show_grid_view
</span>
</span>
</dt>
<dd>
<p>
Return True if grid view is visible.
</p>
</dd>
</dl>
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.widget.filebrowser.FileBrowserWidget.show_udim_sequence">
<em class="property">
<span class="pre">
property
</span>
<span class="w">
</span>
</em>
<span class="sig-name descname">
<span class="pre">
show_udim_sequence
</span>
</span>
</dt>
<dd>
<p>
Return True if the list model has UDIM sequence visible.
</p>
</dd>
</dl> |
omni.kit.widget.filebrowser.FileSystemItem.md | # FileSystemItem
## FileSystemItem
```python
class omni.kit.widget.filebrowser.FileSystemItem(path: str, fields: FileBrowserItemFields, is_folder: bool = False)
```
Bases: [FileBrowserItem](omni.kit.widget.filebrowser.model.FileBrowserItem.html#omni.kit.widget.filebrowser.model.FileBrowserItem)
A Filebrowser item class for navigating a the local filesystem in a Filebrowser view. Sub-classed from [FileBrowserItem](omni.kit.widget.filebrowser.FileBrowserItem.html#omni.kit.widget.filebrowser.FileBrowserItem).
### Parameters
- **path** (str) – Path of the item.
- **fields** ([FileBrowserItemFields](omni.kit.widget.filebrowser.FileSystemItem.html#omni.kit.widget.filebrowser.FileSystemItem)) – Fields of the item.
- **is_folder** (bool) – Specify the item as a folder.
### Methods
```
### Methods
| Method | Description |
|--------|-------------|
| `__init__(self)` | Initialize the instance. |
| `keep_entry(entry)` | Return True if we want to keep the given entry. |
| `on_list_change_event(event, entry)` | Handle ListEvent changes, should update this item's children list with the corresponding ListEntry. |
| `populate_async(callback_async[, timeout])` | Populate current item asynchronously if not already. |
### Attributes
| Attribute | Description |
|-----------|-------------|
| `readable` | Return True if the item is readable. |
| `writeable` | Return True if the item is writable. |
### Detailed Method Descriptions
#### `__init__(self)`
Initialize the instance.
#### `keep_entry(entry)`
Return True if we want to keep the given entry.
- **Parameters**:
- **entry** (`os.DirEntry`) – directory entry.
#### `on_list_change_event(event, entry)`
Handle ListEvent changes, should update this item’s children list with the corresponding ListEntry.
Parameters
----------
- **event** (`omni.client.ListEvent`) – One of of {UNKNOWN, CREATED, UPDATED, DELETED, METADATA, LOCKED, UNLOCKED}.
- **entry** (`omni.client.ListEntry`) – Updated entry as defined by omni.client.
### `populate_async`
Populate current item asynchronously if not already. Overrides base method.
Parameters
----------
- **callback_async** (`Callable`) – Function signature is void callback(result, children: [FileBrowserItem]), where result is an Exception type upon error.
- **timeout** (`float`) – Time out duration on failed server connections. Default 10.0.
Returns
-------
- Result of executing callback.
Return type
-----------
- Any
### `readable`
Return True if the item is readable.
### `writeable`
Return True if the item is writable. |
omni.kit.widget.filebrowser.FileSystemModel.md | # FileSystemModel
## FileSystemModel
```python
class omni.kit.widget.filebrowser.FileSystemModel(name: str, root_path: str = 'C:', **kwargs)
```
Bases: [`FileBrowserModel`](../omni.kit.widget.filebrowser.model/omni.kit.widget.filebrowser.model.FileBrowserModel.html#omni.kit.widget.filebrowser.model.FileBrowserModel)
A Filebrowser model class for navigating a the local filesystem in a Filebrowser view. Sub-classed from [`FileBrowserModel`](omni.kit.widget.filebrowser.FileBrowserModel.html#omni.kit.widget.filebrowser.FileBrowserModel).
### Parameters
- **name** (str) – Name of root item.
- **root_path** (str) – Root path. If None, then create empty model. Default “C:”.
### Keyword Arguments
- **drop_fn** (Callable) – Function called to handle drag-n-drops. Function signature: `void drop_fn(dst_item: FileBrowserItem, src_item: FileBrowserItem)`
### filter_fn
(Callable) – This handler should return True if the given Filebrowser view item is visible, False otherwise. Function signature: bool filter_fn(item: FileBrowserItem)
### sort_by_field
(str) – Name of column by which to sort items in the same folder. Default “name”.
### sort_ascending
(bool) – Sort in ascending order. Default True.
### Methods
| Method | Description |
| --- | --- |
| `__init__(self)` | Constructs AbstractItemModel. |
### Attributes
(No attributes listed)
### __init__(self: omni.ui._ui.AbstractItemModel) -> None
Constructs AbstractItemModel.
#### Keyword Arguments:
- `kwargs` (dict): See below |
omni.kit.widget.filebrowser.filesystem_model.Classes.md | # omni.kit.widget.filebrowser.filesystem_model Classes
## Classes Summary
- **FileSystemItem**
- A Filebrowser item class for navigating a the local filesystem in a Filebrowser view.
- **FileSystemItemFactory**
- Factory to create :obj:`FileSystemItem` instances.
- **FileSystemModel**
- A Filebrowser model class for navigating a the local filesystem in a Filebrowser view. |
omni.kit.widget.filebrowser.filesystem_model.FileSystemItemFactory.md | # FileSystemItemFactory
## FileSystemItemFactory
Factory to create `FileSystemItem` instances.
### Methods
- `create_entry_item(*args, **kwargs)`
- `create_group_item(*args, **kwargs)`
- `create_omni_entry_item(*args, **kwargs)` |
omni.kit.widget.filebrowser.filesystem_model.md | # omni.kit.widget.filebrowser.filesystem_model
## Classes Summary
| Class Name | Description |
|------------|-------------|
| [FileSystemItem](omni.kit.widget.filebrowser.filesystem_model/omni.kit.widget.filebrowser.filesystem_model.FileSystemItem.html) | A Filebrowser item class for navigating a the local filesystem in a Filebrowser view. |
| [FileSystemItemFactory](omni.kit.widget.filebrowser.filesystem_model/omni.kit.widget.filebrowser.filesystem_model.FileSystemItemFactory.html) | Factory to create :obj:`FileSystemItem` instances. |
| [FileSystemModel](omni.kit.widget.filebrowser.filesystem_model/omni.kit.widget.filebrowser.filesystem_model.FileSystemModel.html) | A Filebrowser model class for navigating a the local filesystem in a Filebrowser view. | |
omni.kit.widget.filebrowser.find_thumbnails_for_files_async.md | # find_thumbnails_for_files_async
## find_thumbnails_for_files_async
```python
async omni.kit.widget.filebrowser.find_thumbnails_for_files_async(urls: List[str], generate_missing: bool = True) -> Dict
```
Return a dictionary of thumbnails for the given files.
### Parameters
- **urls** (List[str]) – List of file Urls.
- **generate_missing** (bool) – When True, emits a carb event for the missing thumbnails. Set to False to disable this behavior.
### Returns
Dict of all found thumbnails, with file Url as key, and thumbnail Url as value.
### Return type
Dict
``` |
omni.kit.widget.filebrowser.Functions.md | # omni.kit.widget.filebrowser Functions
## Functions Summary:
| Function | Description |
|----------|-------------|
| clear_clipboard | Clear the clipboard. |
| find_thumbnails_for_files_async | Return a dictionary of thumbnails for the given files. |
| get_clipboard_items | Get browser items. |
| is_clipboard_cut | Return True if items in the clipboard are cut from other items. |
| is_path_cut | Return True if the path are cut from other items or clipboard. |
| list_thumbnails_for_folder_async | Return a dictionary of thumbnails for the files in the given folder. |
| save_items_to_clipboard | Save browser items to clipboard. | |
omni.kit.widget.filebrowser.grid_view.Classes.md | # omni.kit.widget.filebrowser.grid_view Classes
## Classes Summary
- **FileBrowserGridView**
- UI Widget for display files or folders as icons in a directory in grid view.
- **FileBrowserGridViewDelegate**
- The delegate that manages building browser items under the model as widgets inside the grid view. |
omni.kit.widget.filebrowser.grid_view.FileBrowserGridView.md | # FileBrowserGridView
## FileBrowserGridView
```python
class omni.kit.widget.filebrowser.grid_view.FileBrowserGridView(model: FileBrowserModel, **kwargs)
```
Bases: `FileBrowserView`
UI Widget for display files or folders as icons in a directory in grid view.
### Keyword Arguments
- **allow_multi_selection** (bool) – Optional argument to enable multi selection, defaults to True.
- **selection_changed_fn** (Callable) – Function called when selection changed. Function signature: `void selection_changed_fn(selections: List[FileBrowserItem])`
### Methods
- `__init__(model, **kwargs)`
- `build_ui()`
```
### Methods
| Method | Description |
|--------|-------------|
| `build_ui` ([restore_selections]) | Build the UI of the grid view. |
| `destroy` () | Destructor. |
| `refresh_ui` ([item, selections]) | Throttle the refreshes so that the UI can keep up with multiple refresh directives in succession. |
| `scale_view` (scale) | Change the scale of items inside the grid view. |
| `scroll_top` () | Scroll the widget to top |
| `select_and_center` (item[, callback]) | Select and center the view on the given item. |
### Attributes
| Attribute | Description |
|-----------|-------------|
| `selections` | |
### Initialization
```python
__init__(model: FileBrowserModel, **kwargs)
```
### Method Details
```python
build_ui(restore_selections: Optional[List[FileBrowserItem]] = None)
```
**Description:**
Build the UI of the grid view.
**Keyword Arguments:**
- `restore_selections` (List[FileBrowserItem]) – List of file browser items to restore selection to.
```
```python
destroy()
```
**Description:**
Destructor.
```
```python
refresh_ui(item, selections)
```
**Description:**
Throttle the refreshes so that the UI can keep up with multiple refresh directives in succession.
```
```python
scale_view(scale)
```
**Description:**
Change the scale of items inside the grid view.
```
```python
scroll_top()
```
**Description:**
Scroll the widget to top
```
```python
select_and_center(item[, callback])
```
**Description:**
Select and center the view on the given item.
```
```
### destroy
Destructor.
### refresh_ui
Throttle the refreshes so that the UI can keep up with multiple refresh directives in succession.
**Keyword Arguments**
- **item** (`FileBrowserItem`) – Unused argument, kept for compatibility.
- **selection** (List[`FileBrowserItem`]) – List of file browser items to set the new selection to.
### scale_view
Change the scale of items inside the grid view.
:param scale: the new scale to set.
:type scale: float
### scroll_top
Scroll the widget to top
### select_and_center
```python
[FileBrowserItem], None]
```
None
```python
=
```
None
```
(
```python
Select and center the view on the given item.
Parameters
----------
- **item** (FileBrowserItem) – the item to set the new selection to.
- **callback** (Callable) – optional callback to call after setting the selection. Function signature: void(item: FileBrowserItem)
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
``` |
omni.kit.widget.filebrowser.grid_view.FileBrowserGridViewDelegate.md | # FileBrowserGridViewDelegate
## Class FileBrowserGridViewDelegate
```python
class omni.kit.widget.filebrowser.grid_view.FileBrowserGridViewDelegate(widget: Frame, theme: str, **kwargs)
```
### Description
Bases: `object`
The delegate that manages building browser items under the model as widgets inside the grid view.
### Parameters
- **widget** (`ui.Frame`): The frame for the delegate to build widgets under.
- **theme** (`str`): The theme name to use.
### Keyword Arguments
- **mouse_pressed_fn** (`Callable`): Function called on mouse press. Function signature: `void mouse_pressed_fn(button: int, key_mode: int, item: FileBrowserItem, x: float=0, y: float=0)`
- **mouse_double_clicked_fn** (`Callable`): Function called on mouse double click. Function signature: `void mouse_double_clicked_fn(button: int, key_mode: int, item: FileBrowserItem, x: float=0, y: float=0)`
- **selection_changed_fn** (`Callable`): Function called on selection change. Function signature: `void selection_changed_fn(selected: bool, item: FileBrowserItem)`
```
### Attributes
- **selection_changed_fn** (*Callable*) – Function called when selection changed. Function signature: `void selection_changed_fn(selections: list[FileBrowserItem])`
- **drop_fn** (*Callable*) – Function called to handle drag-n-drops. Function signature: `void drop_fn(dst_item: FileBrowserItem, src_path: str)`
- **thumbnail_provider** (*Callable*) – This callback returns the path to the item’s thumbnail. If not specified, then a default thumbnail is used. Signature: `str thumbnail_provider(item: FileBrowserItem)`
- **badges_provider** (*Callable*) – This callback provides the list of badges to layer atop the thumbnail in the grid view. Callback signature: `List[str] badges_provider(item: FileBrowserItem)`
- **treeview_identifier** (*str*) – widget identifier for treeview, only used by tests.
- **testing** (*bool*) – When enabled, forces items to immediately be built and made available.
### Methods
- `__init__(widget, theme, **kwargs)`
- `add_selection(card)` – Add a new card to selection.
- `build_card(model, item)` – Create a widget per item.
- `build_grid(model)` – Build browser items under the model.
- `center_selection_async(selection[, ...])` – Center the given item and add it to the selection.
- `clear_selections()` – Clear current selection.
- `destroy()` – Destructor.
- `extend_selections(cards)` – Extend current selection.
- `refresh_thumbnails_async(urls)` – Re-generate the thumbnails with given URLs.
- `remove_selection()` – Remove the specified item from the selection.
### Methods
| HTML Code | Description |
|-----------|-------------|
| `remove_selection` (card) | Remove a new card from the selection. |
| `update_cards_on_thumbnails_generated` (event) | When new thumbnails are generated, re-renders associated cards. |
| `update_grid` (model) | Generate a grid of cards and renders them with custom thumbnails. |
### Attributes
| HTML Code | Description |
|-----------|-------------|
| `scale` | Get the scale of items. |
| `selections` | Get the current selection. |
### Methods
| Method Name | Parameters | Description |
|-------------|------------|-------------|
| `__init__` | widget: Frame, theme: str, **kwargs | |
| `add_selection` | card: FileBrowserItemCard | Add a new card to selection. |
| | Parameters: |
| | - **card** (FileBrowserItemCard) – Item widget to add. |
| `build_card` | model: FileBrowserModel, item: FileBrowserItem | |
### FileBrowserGridViewDelegate Methods
#### build_card
- **Description**: Create a widget per item.
- **Parameters**:
- **model** (`FileBrowserModel`) – model to build the item with.
- **item** (`FileBrowserItem`) – the item to build the widget.
#### build_grid
- **Description**: Build browser items under the model.
- **Parameters**:
- **model** (`FileBrowserModel`) – Model containing items to build.
#### center_selection_async
- **Description**: Asynchronously center the selection.
- **Parameters**:
- **selection** (`FileBrowserItem`)
- **scroll_frame** (Optional[`Frame`] = None)
- **scroll_ratio** = 0.0
- **refresh_interval** = 2
- **callback** (Optional[Callable[[`FileBrowserItem`], None]] = None)
### center_selection_async
Center the given item and add it to the selection.
**Parameters**
- **selection** (`FileBrowserItem`) – Item to center on.
- **scroll_frame** (`ui.Frame`) – Optional argument frame to scroll to the item’s new position.
- **scroll_ratio** (`float`) – Optional argument ratio to scroll to the item’s new position using item index ratio.
### clear_selections
Clear current selection.
### destroy
Destructor.
### extend_selections
Extend current selection.
**Parameters**
- **cards** (List[`FileBrowserItemCard`]) – List of item widgets to extend.
### refresh_thumbnails_async
Re-generate the thumbnails with given URLs.
**Parameters**
- **urls** (`List[str]`) – thumbnail URLs to update.
### remove_selection
Remove a new card from the selection.
**Parameters**
- **card** (`FileBrowserItemCard`) – Item widget to remove.
When new thumbnails are generated, re-renders associated cards.
**Parameters**
- **events** (`IEvent`) – event containing the thumbnail URLs to update.
Generate a grid of cards and renders them with custom thumbnails.
**Parameters**
- **model** (`FileBrowserModel`) – Model containing items to update.
Get the scale of items.
**scale** : `float`
Get the current selection.
**selections** : `List[FileBrowserItem]` |
omni.kit.widget.filebrowser.list_thumbnails_for_folder_async.md | # list_thumbnails_for_folder_async
## list_thumbnails_for_folder_async
```python
async omni.kit.widget.filebrowser.list_thumbnails_for_folder_async(url: str, timeout: float = 30.0, generate_missing: bool = True) -> Dict
```
Return a dictionary of thumbnails for the files in the given folder.
### Parameters
- **url** (str) – Folder Url.
- **generate_missing** (bool) – When True, emits a carb event for the missing thumbnails. Set to False to disable this behavior.
### Returns
Dict of all found thumbnails, with file Url as key, and thumbnail Url as value.
### Return type
Dict
``` |
omni.kit.widget.filebrowser.md | # omni.kit.widget.filebrowser
## Submodules Summary:
- **omni.kit.widget.filebrowser.abstract_column_delegate**
- An abstract column delegate class. Subclassed by column delegates used by :obj:`FileBrowserTreeView`.
- **omni.kit.widget.filebrowser.card**
- Base Model classes for the filebrowser entity.
- **omni.kit.widget.filebrowser.clipboard**
- Collection of utility functions to manage the clipboard.
- **omni.kit.widget.filebrowser.column_delegate_registry**
- Manage Registration of column delegates to be used by :obj:`FileBrowserTreeView`.
- **omni.kit.widget.filebrowser.date_format_menu**
- A menu to set datetime format.
- **omni.kit.widget.filebrowser.filesystem_model**
- Model and Item classes for navigating the local file system on the machine.
- **omni.kit.widget.filebrowser.grid_view**
- A generic GridView Widget for File Systems.
- **omni.kit.widget.filebrowser.model**
- No submodule docstring provided
- **omni.kit.widget.filebrowser.nucleus_model**
- Model and Item classes for navigating a Nucleus Server.
- **omni.kit.widget.filebrowser.singleton**
- Decorator class to define the class as a singleton.
- **omni.kit.widget.filebrowser.style**
- No description provided.
| Description | Summary |
|-------------|---------|
| UI Styles for widgets used in the extension. | UI Styles for widgets used in the extension. |
| omni.kit.widget.filebrowser.thumbnails | Collection of functions to manage thumbnails. |
| omni.kit.widget.filebrowser.tree_view | A generic Tree View Widget for File Systems. |
| omni.kit.widget.filebrowser.view | An abstract View class, subclassed by TreeView and GridView. |
| omni.kit.widget.filebrowser.widget | UI widget for navigating a filesystem. |
| omni.kit.widget.filebrowser.zoom_bar | UI Widget to change the scale of items inside :obj:`FileBrowserGridView`. |
Classes Summary:
| Class | Description |
|-------|-------------|
| AbstractColumnDelegate | An abstract object that is used to put the widget to the file browser asynchronously. |
| ColumnItem | Column Item class to be used with FileBrowserTreeView. |
| FileBrowserItem | Base class for the Filebrowser view Item. |
| FileBrowserItemCard | Widget used by FileBrowserGridView to build the browser item. |
| FileBrowserItemFactory | Factory to create :obj:`FileBrowserItem` instances. |
| FileBrowserModel | Base class for the Filebrowser view Model. |
| FileBrowserUdimItem | A Filebrowser UDIM item class for navigating a the local filesystem in a Filebrowser view. |
| FileBrowserWidget | The basic UI widget for navigating a filesystem as a tree or grid view. |
| FileSystemItem | A Filebrowser item class for navigating a the local filesystem in a Filebrowser view. |
| FileSystemModel | A Filebrowser model class for navigating a the local filesystem in a Filebrowser view. |
| NucleusConnectionItem | NucleusItem that represents a nucleus connection. |
| NucleusItem | A Filebrowser item class for navigating a Nucleus server in a Filebrowser view. |
| NucleusModel | A Filebrowser model class for navigating a Nucleus server in a Filebrowser view. |
| ColumnDelegateRegistry | |
# Functions Summary:
| Function Name | Description |
|---------------|-------------|
| clear_clipboard | Clear the clipboard. |
| find_thumbnails_for_files_async | Return a dictionary of thumbnails for the given files. |
| get_clipboard_items | Get browser items. |
| is_clipboard_cut | Return True if items in the clipboard are cut from other items. |
| is_path_cut | Return True if the path are cut from other items or clipboard. |
| list_thumbnails_for_folder_async | Return a dictionary of thumbnails for the files in the given folder. |
| save_items_to_clipboard | Save browser items to clipboard. | |
omni.kit.widget.filebrowser.model.Classes.md | # omni.kit.widget.filebrowser.model Classes
## Classes Summary
| Class Name | Description |
|------------|-------------|
| [FileBrowserItem](omni.kit.widget.filebrowser.model/omni.kit.widget.filebrowser.model.FileBrowserItem.html) | Base class for the Filebrowser view Item. |
| [FileBrowserItemFactory](omni.kit.widget.filebrowser.model/omni.kit.widget.filebrowser.model.FileBrowserItemFactory.html) | Factory to create :obj:`FileBrowserItem` instances. |
| [FileBrowserModel](omni.kit.widget.filebrowser.model/omni.kit.widget.filebrowser.model.FileBrowserModel.html) | Base class for the Filebrowser view Model. | |
omni.kit.widget.filebrowser.model.FileBrowserItem.md | # FileBrowserItem
## FileBrowserItem
```
```text
class omni.kit.widget.filebrowser.model.FileBrowserItem
(
path : str,
fields : FileBrowserItemFields,
is_folder : bool = False,
is_deleted : bool = False
)
```
```text
Bases: AbstractItem
Base class for the Filebrowser view Item.
Should be sub-classed to implement specific filesystem behavior. The Constructor should not be
called directly. Instead there are factory methods available for creating instances when needed.
Parameters
-----------
path (str) – Path of the item.
fields (FileBrowserItemFields) – Fields of the item.
**is_folder** *(bool)* – Set to True if the item is a folder.
**is_deleted** *(bool)* – Set to True if the item is deleted.
## Methods
| Method | Description |
|--------|-------------|
| `__init__(self)` | |
| `add_child(item)` | Add item as child. |
| `datetime_as_string(value)` | Convert datatime to string. |
| `del_child(item_name)` | Delete child item by name. |
| `get_custom_thumbnails_for_folder_async()` | Return the thumbnail dictionary for this (folder) item. |
| `get_subitem_model(index)` | Return ith column of this item. |
| `has_mouse_pressed_fn()` | Check if the item has a mouse pressed callback assigned. |
| `mouse_pressed_fn()` | Mouse pressed callback. |
| `on_list_change_event(event, entry)` | Virtual method to be implemented by sub-class. |
| `on_populated_async([result, children, callback])` | async callback after finish populating the item. |
| `populate_async([callback_async, timeout])` | Populate current item asynchronously if not already. |
| `populate_with_callback(callback[, timeout])` | Populate this item if not already populated. |
| `size_as_string(value)` | |
## Attributes
| Attribute | Description |
|--------------------|-----------------------------------------------------------------------------|
| alert | Get/set alert level and message. |
| children | Children of this item. |
| context_menu | Optionally provide a context menu to be shown when this item is right-clicked. |
| enable_sorting | True if item's children are sortable. |
| expandable | Whether this FileBrowserItem is expandable. |
| fields | A subset of the item's stats stored as a string tuple. |
| hideable | Whether this FileBrowserItem is hideable. |
| icon | Get/set path to icon file. |
| is_deleted | True if this item is a deleted folder/file. |
| is_folder | True if this item is a folder. |
| is_udim_file | Get/Set item udim_file state. |
| item_changed | True if this item is has been restored/deleted already. |
| models | The columns of this item. |
| name | Item name. |
| parent | Parent of this item. |
| Property | Description |
|----------|-------------|
| parent | Parent of this item. |
| path | Full path name. |
| populated | Get/Set item populated state. |
| readable | True if the item is readable. |
| writeable | True if the item is writeable. |
### __init__
- **Parameters:**
- self: omni.ui._ui.AbstractItem
- **Returns:** None
### add_child
- **Description:** Add item as child.
- **Parameters:**
- item (FileBrowserItem): Child item.
### datetime_as_string
- **Parameters:**
- value: datetime
- **Returns:** str
- **Description:** Convert datatime to string.
### del_child
- **Description:** Delete child item by name.
- **Parameters:**
- item_name (str): Name of child item.
### get_custom_thumbnails_for_folder_async
- **Description**: Return the thumbnail dictionary for this (folder) item.
- **Returns**: With children url’s as keys, and url’s to thumbnail files as values.
- **Return type**: Dict
### get_subitem_model
- **Description**: Return ith column of this item.
- **Returns**: `AbstractValueModel`
### has_mouse_pressed_fn
- **Description**: Check if the item has a mouse pressed callback assigned.
### mouse_pressed_fn
- **Description**: Mouse pressed callback.
### on_list_change_event
- **Description**: Virtual method to be implemented by sub-class. When called with a ListEvent, should update this item’s children list with the corresponding ListEntry.
- **Parameters**:
- **event** (`omni.client.ListEvent`) – One of of {UNKNOWN, CREATED, UPDATED, DELETED, METADATA, LOCKED, UNLOCKED}.
- **entry** (`omni.client.ListEntry`) – Updated entry as defined by omni.client.
### on_populated_async
- **Description**: async method description here.
:
Optional
[
Dict
[
str
,
FileBrowserItem
]
]
=
None
,
callback
:
Optional
[
Callable
[
[
Dict
[
str
,
FileBrowserItem
]
,
None
]
]
=
None
)
async
populate_async
(
callback_async
:
Optional
[
Callable
]
=
None
,
timeout
:
float
=
10.0
)
->
Any
<dl>
<dt>
<p>
Populate current item asynchronously if not already. Override this method to customize for specific file systems.
</p>
<dl class="field-list simple">
<dt class="field-odd">
Parameters
</dt>
<dd class="field-odd">
<ul class="simple">
<li>
<p>
<strong>callback_async</strong> (Callable) – Function signature is void callback(result, children: Dict[str, FileBrowserItem]), where result is an Exception type upon error.
</p>
</li>
<li>
<p>
<strong>timeout</strong> (float) – Time out duration on failed server connections. Default 10.0.
</p>
</li>
</ul>
</dd>
<dt class="field-even">
Returns
</dt>
<dd class="field-even">
<p>
Result of executing callback.
</p>
</dd>
<dt class="field-odd">
Return type
</dt>
<dd class="field-odd">
<p>
Any
</p>
</dd>
</dl>
</dt>
<dd>
<p>
Populate this item if not already populated. When done, executes callback.
</p>
<dl class="field-list simple">
<dt class="field-odd">
Parameters
</dt>
<dd class="field-odd">
<ul class="simple">
<li>
<p>
<strong>callback</strong> (Callable) – Function signature is void callback(children: [FileBrowserItem]).
</p>
</li>
<li>
<p>
<strong>timeout</strong> (float) – Time out duration on failed server connections. Default 10.0.
</p>
</li>
</ul>
</dd>
</dl>
</dd>
<dt>
<p>
Convert data size in bytes to a human readable string.
</p>
</dt>
<dd>
<p>
Get/set alert level and message.
</p>
</dd>
<dt>
<p>
property children : Dict[str, FileBrowserItem]
</p>
</dt>
<dd>
<p>
Get/set alert level and message.
</p>
</dd>
</dl>
### Children of this item. Does not populate the item if not already populated.
#### Type
- dict[FileBrowserItem]
### Optionally provide a context menu to be shown when this item is right-clicked.
### True if item’s children are sortable.
#### Type
- bool
### Whether this FileBrowserItem is expandable. Override to change behavior.
### A subset of the item’s stats stored as a string tuple.
#### Type
- FileBrowserItemFields
### Whether this FileBrowserItem is hideable. Override to change behavior.
### Get/set path to icon file.
#### Type
- str
### Whether this FileBrowserItem is deleted.
<dl>
<dt>
<p>
True if this item is a deleted folder/file.
</p>
<dl class="field-list simple">
<dt class="field-odd">
Type
</dt>
<dd class="field-odd">
<p>
bool
</p>
</dd>
</dl>
</dt>
<dd>
<p>
True if this item is a folder.
</p>
<dl class="field-list simple">
<dt class="field-odd">
Type
</dt>
<dd class="field-odd">
<p>
bool
</p>
</dd>
</dl>
</dd>
<dd>
<p>
Get/Set item udim_file state.
</p>
<dl class="field-list simple">
<dt class="field-odd">
Type
</dt>
<dd class="field-odd">
<p>
bool
</p>
</dd>
</dl>
</dd>
<dd>
<p>
True if this item is has been restore/delete aready.
</p>
<dl class="field-list simple">
<dt class="field-odd">
Type
</dt>
<dd class="field-odd">
<p>
bool
</p>
</dd>
</dl>
</dd>
<dd>
<p>
The columns of this item.
</p>
<dl class="field-list simple">
<dt class="field-odd">
Type
</dt>
<dd class="field-odd">
<p>
Tuple[
<code>
ui.AbstractValueModel
</code>
]
</p>
</dd>
</dl>
</dd>
<dd>
<p>
Item name.
</p>
<dl class="field-list simple">
<dt class="field-odd">
Type
</dt>
<dd class="field-odd">
<p>
str
</p>
</dd>
</dl>
</dd>
<dd>
<p>
Parent of this item.
</p>
<dl class="field-list simple">
<dt class="field-odd">
Type
</dt>
<dd class="field-odd">
<p>
FileBrowserItem
</p>
</dd>
</dl>
</dd>
<dd>
<p>
path
</p>
<dl class="field-list simple">
<dt class="field-odd">
Type
</dt>
<dd class="field-odd">
<p>
str
</p>
</dd>
</dl>
</dd>
</dl>
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.widget.filebrowser.model.FileBrowserItem.full_path">
<em class="property">
<span class="pre">
property
</span>
<span class="w">
</span>
</em>
<span class="sig-name descname">
<span class="pre">
full_path
</span>
</span>
<em class="property">
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="pre">
str
</span>
</em>
<a class="headerlink" href="#omni.kit.widget.filebrowser.model.FileBrowserItem.full_path" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Full path name.
</p>
<dl class="field-list simple">
<dt class="field-odd">
Type
</dt>
<dd class="field-odd">
<p>
str
</p>
</dd>
</dl>
</dd>
</dl>
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.widget.filebrowser.model.FileBrowserItem.populated">
<em class="property">
<span class="pre">
property
</span>
<span class="w">
</span>
</em>
<span class="sig-name descname">
<span class="pre">
populated
</span>
</span>
<em class="property">
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="pre">
bool
</span>
</em>
<a class="headerlink" href="#omni.kit.widget.filebrowser.model.FileBrowserItem.populated" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Get/Set item populated state.
</p>
<dl class="field-list simple">
<dt class="field-odd">
Type
</dt>
<dd class="field-odd">
<p>
bool
</p>
</dd>
</dl>
</dd>
</dl>
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.widget.filebrowser.model.FileBrowserItem.readable">
<em class="property">
<span class="pre">
property
</span>
<span class="w">
</span>
</em>
<span class="sig-name descname">
<span class="pre">
readable
</span>
</span>
<em class="property">
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="pre">
bool
</span>
</em>
<a class="headerlink" href="#omni.kit.widget.filebrowser.model.FileBrowserItem.readable" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
True if the item is readable.
</p>
</dd>
</dl>
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.widget.filebrowser.model.FileBrowserItem.writeable">
<em class="property">
<span class="pre">
property
</span>
<span class="w">
</span>
</em>
<span class="sig-name descname">
<span class="pre">
writeable
</span>
</span>
<em class="property">
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="pre">
bool
</span>
</em>
<a class="headerlink" href="#omni.kit.widget.filebrowser.model.FileBrowserItem.writeable" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
True if the item is writeable.
</p>
</dd>
</dl> |
omni.kit.widget.filebrowser.model.FileBrowserItemFactory.md | # FileBrowserItemFactory
## FileBrowserItemFactory
Factory to create `FileBrowserItem` instances.
### Methods
| Method | Description |
| --- | --- |
| `create_dummy_item(name, path)` | Create a dummy item at the given path. |
| `create_group_item(name, path)` | Create a folder item at the given path. |
| `create_udim_item(name, path, range_start, ...)` | Create a UDIM item. |
### create_dummy_item
**Parameters**
- **name** (str) – name of the item.
- **path** (str) – path of the item.
### create_group_item
**Parameters**
- **name** (str) – name of the item.
- **path** (str) – path of the item.
### create_udim_item
**Parameters**
- **name** (str) – name of the item.
- **path** (str) – path of the item.
- **range_start** (int) –
- **range_end** (int) –
- **repr_frame** (int) –
Create a UDIM item.
Parameters
----------
- **name** (`str`) – name of the item.
- **path** (`str`) – path of the item.
- **range_start** (`int`) – Starting index of UDIM sequence.
- **range_end** (`int`) – End index of UDIM sequence.
- **repr_frame** (`int`) – Index in UDIM sequence. |
omni.kit.widget.filebrowser.model.FileBrowserModel.md | # FileBrowserModel
## FileBrowserModel
### FileBrowserModel
#### FileBrowserModel
##### FileBrowserModel
###### FileBrowserModel
class omni.kit.widget.filebrowser.model.FileBrowserModel(name: Optional[str] = None, root_path: str = '', **kwargs)
Bases: AbstractItemModel
Base class for the Filebrowser view Model.
Should be sub-classed to implement specific filesystem behavior.
Parameters
-----------
name (str) – Name of root item. If None given, then create an initally empty model.
Keyword Arguments
------------------
drop_fn (Callable) – Function called to handle drag-n-drops. Function signature:
void drop_fn(dst_item: FileBrowserItem, src_item: FileBrowserItem)
**filter_fn**(Callable) – This handler should return True if the given Filebrowser view item is visible, False otherwise. Function signature: bool filter_fn(item: FileBrowserItem)
**sort_by_field**(str) – Name of column by which to sort items in the same folder. Default “name”.
**sort_ascending**(bool) – Sort in ascending order. Default True.
**timeout**(float) – Timeout when updating item asynchronously.
## Methods
- **__init__(self)** - Constructs AbstractItemModel.
- **auto_refresh_item(item[, throttle_frames])** - Watch the given folder and updates the children list as soon as its contents are changed.
- **copy_presets(model)** - Reset our fields to default arguments from the given model.
- **destroy()** - Destructor.
- **drop(dst_item, source)** - Invoke user-supplied function to handle dropping source onto destination item.
- **drop_accepted(dst_item, src_item)** - Reimplemented from AbstractItemModel.
- **filter_items(items)** - Return the items filtered with the filter function set.
- **get_drag_mime_data(item)** - Return Multipurpose Internet Mail Extensions (MIME) data for be able to drop this item somewhere.
- **get_item_children(item)** - Return the list of items that are nested to the given parent item.
- **get_item_value_model(item, index)** - Get the value model associated with this item.
- **get_item_value_model_count(item)** - Return the number of columns this model item contains.
| Method Name | Description |
|-------------|-------------|
| `on_list_change_event(item, result, event, entry)` | Process change events for the given folder. |
| `set_filter_fn(filter_fn)` | Set the handler that would return True if the given Filebrowser view item is visible, False otherwise. |
| `sync_up_item_changes(item)` | Scan given folder for missed changes; processes any changes found. |
### Attributes
| Attribute Name | Description |
|----------------|-------------|
| `builtin_column_count` | Return the number of available columns without tag delegates |
| `drag_mime_data` | Return the string with the drag and drop payload. |
| `root` | Get/set the root item of this model. |
| `show_udim_sequence` | Show the UDIM sequence. |
| `single_column` | The panel on the left side works in one-column mode |
| `sort_ascending` | Get/set the sort ascending state. |
| `sort_by_field` | Get/set the sort-by field name. |
### Methods
#### `__init__(self: omni.ui._ui.AbstractItemModel)`
Constructs AbstractItemModel.
**Keyword Arguments:**
- `kwargs: dict` - See below
#### `auto_refresh_item(self)`
Description for auto_refresh_item method.
### auto_refresh_item
- **Parameters**
- **item** (FileBrowserItem) – The folder item to watch.
- **throttle_frames** – Number of frames to throttle the UI refresh.
### copy_presets
- **Parameters**
- **model** (FileBrowserModel) – The model to copy presets from.
### destroy
### drop
- **Parameters**
- **dst_item** (FileBrowserItem) – Target item.
- **src_item** (FileBrowserItem) – Source item.
### drop_accepted
```python
drop_accepted(dst_item: FileBrowserItem, src_item: FileBrowserItem) -> bool
```
Reimplemented from AbstractItemModel. Called to highlight target when drag and drop.
Returns True if destination item is able to accept a drop. This function can be
overriden to implement a different behavior.
**Parameters:**
- **dst_item** (FileBrowserItem) – Target item.
- **src_item** (FileBrowserItem) – Source item.
**Returns:**
- bool
### filter_items
```python
filter_items(items: List[FileBrowserItem]) -> List[FileBrowserItem]
```
Return the items filtered with the filter function set.
### get_drag_mime_data
```python
get_drag_mime_data(item: FileBrowserItem)
```
Return Multipurpose Internet Mail Extensions (MIME) data for be able to drop this item somewhere.
### get_item_children
```python
get_item_children(item: FileBrowserItem)
```
### get_item_children
Return the list of items that are nested to the given parent item.
#### Parameters
- **item** (`FileBrowserItem`) – Parent item.
#### Returns
- list[`FileBrowserItem`]
### get_item_value_model
Get the value model associated with this item.
#### Parameters
- **item** (`FileBrowserItem`) – The item in question.
#### Returns
- `AbstractValueModel`
### get_item_value_model_count
Return the number of columns this model item contains.
#### Parameters
- **item** (`FileBrowserItem`) – The item in question.
#### Returns
- int
### on_list_change_event
## omni.kit.widget.filebrowser.model.FileBrowserModel.on_list_change_event
### Parameters
- **item** (FileBrowserItem) – The folder item.
- **result** (omni.client.Result) – Set by omni.client upon listing the folder.
- **event** (omni.client.ListEvent) – Event type.
- **throttle_frames** – Number of frames to throttle the UI refresh.
Process change events for the given folder.
## omni.kit.widget.filebrowser.model.FileBrowserModel.set_filter_fn
Set the handler that would return True if the given Filebrowser view item is visible, False otherwise. Function signature: bool filter_fn(item: FileBrowserItem)
## omni.kit.widget.filebrowser.model.FileBrowserModel.sync_up_item_changes
Scan given folder for missed changes; processes any changes found.
### Parameters
- **item** (FileBrowserItem) – The folder item to watch.
## Properties
### builtin_column_count
Return the number of available columns without tag delegates
### drag_mime_data
Return the string with the drag and drop payload.
### root
Get/set the root item of this model.
Type: FileBrowserItem
### show_udim_sequence
Show the UDIM sequence.
### single_column
The panel on the left side works in one-column mode
### sort_ascending
Get/set the sort ascending state.
Type: bool
### sort_by_field
Get/set the sort-by field name.
Type: str |
omni.kit.widget.filebrowser.NucleusConnectionItem.md | # NucleusConnectionItem
## NucleusConnectionItem
```python
class omni.kit.widget.filebrowser.NucleusConnectionItem(path: str, fields: FileBrowserItemFields, is_folder: bool = True)
```
**Bases:**
`NucleusItem`
**Description:**
NucleusItem that represents a nucleus connection. Sub-classed from `NucleusItem`.
**Parameters:**
- **path** (str) – Path of the item.
- **fields** (`FileBrowserItemFields`) – Fields of the item.
- **is_folder** (bool) – Specify the item as a folder.
- **is_deleted** (bool) – Specify the item as deleted.
**Methods:**
```
```
| Column 1 | Column 2 |
|----------|----------|
| `__init__` (self) | |
| `signed_in` | Return True when signed in to the Nucleus server. |
### Attributes
#### `__init__`
```python
def __init__(self: omni.ui._ui.AbstractItem) -> None
```
#### `signed_in`
```python
property signed_in
```
Return True when signed in to the Nucleus server.
``` |
omni.kit.widget.filebrowser.NucleusItem.md | # NucleusItem
## NucleusItem
```python
class omni.kit.widget.filebrowser.NucleusItem(path: str, fields: FileBrowserItemFields, is_folder: bool = True, is_deleted: bool = False)
```
**Bases:** [FileBrowserItem](../omni.kit.widget.filebrowser.model/omni.kit.widget.filebrowser.model.FileBrowserItem.html#omni.kit.widget.filebrowser.model.FileBrowserItem)
A Filebrowser item class for navigating a Nucleus server in a Filebrowser view. Sub-classed from [FileBrowserItem](omni.kit.widget.filebrowser.FileBrowserItem.html#omni.kit.widget.filebrowser.FileBrowserItem).
**Parameters:**
- **path** (str) – Path of the item.
- **fields** ([FileBrowserItemFields](../omni.kit.widget.filebrowser.model/omni.kit.widget.filebrowser.model.FileBrowserItemFields.html#omni.kit.widget.filebrowser.model.FileBrowserItemFields)) – Fields of the item.
- **is_folder** (bool) – Indicates if the item is a folder. Default is `True`.
- **is_deleted** (bool) – Indicates if the item is deleted. Default is `False`.
- **is_folder** (**bool**) – Specify the item as a folder.
- **is_deleted** (**bool**) – Specify the item as deleted.
## Methods
| Method | Description |
| ------ | ----------- |
| `__init__` (self) | |
| `on_list_change_event` (event, entry) | Handle ListEvent changes, should update this item's children list with the corresponding ListEntry. |
| `populate_async` ([callback_async, timeout]) | Populate current item asynchronously if not already. |
## Attributes
| Attribute | Description |
| --------- | ----------- |
| `readable` | Return True if the item is readable. |
| `writeable` | Return True if the writable is readable. |
### `__init__` (self: omni.ui._ui.AbstractItem) -> None
### `on_list_change_event` (event: omni.client.ListEvent, entry: omni.client.ListEntry) -> bool
Handle ListEvent changes, should update this item’s children list with the corresponding ListEntry.
**Parameters:**
- **event** (`omni.client.ListEvent`) – One of of {UNKNOWN, CREATED, UPDATED, DELETED, METADATA, LOCKED, UNLOCKED}.
- **entry** (`omni.client.ListEntry`) – Updated entry as defined by omni.client.
(
callback_async : Optional[Callable] = None,
timeout : float = 10.0
)
→ Any
Populate current item asynchronously if not already. Overrides base method.
Parameters
----------
callback_async
(Callable) – Function signature is void callback(result, children: [FileBrowserItem]),
where result is an Exception type upon error.
timeout
(float) – Time out duration on failed server connections. Default 10.0.
Returns
-------
Result of executing callback.
Return type
-----------
Any
property readable : bool
----------------------
Return True if the item is readable.
property writeable : bool
-------------------------
Return True if the writable is readable. |
omni.kit.widget.filebrowser.NucleusModel.md | # NucleusModel
## NucleusModel
```python
class omni.kit.widget.filebrowser.NucleusModel(name: str, root_path: str, **kwargs)
```
**Bases:** [FileBrowserModel](../omni.kit.widget.filebrowser.model/omni.kit.widget.filebrowser.model.FileBrowserModel.html#omni.kit.widget.filebrowser.model.FileBrowserModel)
A Filebrowser model class for navigating a Nucleus server in a Filebrowser view. Sub-classed from [FileBrowserModel](omni.kit.widget.filebrowser.FileBrowserModel.html#omni.kit.widget.filebrowser.FileBrowserModel).
**Parameters:**
- **name** (str) – Name of root item.
- **root_path** (str) – Root path. If None, then create empty model. Example: “omniverse://ov-content”.
**Keyword Arguments:**
- **drop_fn** (Callable) – Function called to handle drag-n-drops. Function signature: `void drop_fn(dst_item: FileBrowserItem, src_item: FileBrowserItem)`
- **filter_fn** (Callable) – This handler should return True if the given Filebrowser view item is visible, False otherwise. Function signature: `bool filter_fn(item: FileBrowserItem)`
```
- **FileBrowserItem**
- **sort_by_field** (*str*) – Name of column by which to sort items in the same folder. Default “name”.
- **sort_ascending** (*bool*) – Sort in ascending order. Default True.
### Methods
| Method | Description |
|--------|-------------|
| `__init__` (self) | Constructs AbstractItemModel. |
### Attributes
### __init__
(self: omni.ui._ui.AbstractItemModel) → None
- Constructs AbstractItemModel.
### Keyword Arguments:
- `kwargs` dict: See below |
omni.kit.widget.filebrowser.nucleus_model.Classes.md | # omni.kit.widget.filebrowser.nucleus_model Classes
## Classes Summary
- **NucleusConnectionItem**
- NucleusItem that represents a nucleus connection.
- **NucleusItem**
- A Filebrowser item class for navigating a Nucleus server in a Filebrowser view.
- **NucleusItemFactory**
- Factory to create :obj:`NucleusItem` instances.
- **NucleusModel**
- A Filebrowser model class for navigating a Nucleus server in a Filebrowser view. |
omni.kit.widget.filebrowser.nucleus_model.NucleusConnectionItem.md | # NucleusConnectionItem
## NucleusConnectionItem
```python
class omni.kit.widget.filebrowser.nucleus_model.NucleusConnectionItem(path: str, fields: FileBrowserItemFields, is_folder: bool = True)
```
Bases: `NucleusItem`
NucleusItem that represents a nucleus connection. Sub-classed from `NucleusItem`.
### Parameters
- **path** (str) – Path of the item.
- **fields** (`FileBrowserItemFields`) – Fields of the item.
- **is_folder** (bool) – Specify the item as a folder.
```
- **is_deleted** (*bool*) – Specify the item as deleted.
### Methods
| | |
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| __init__ | [__init__](omni.kit.widget.filebrowser.nucleus_model.NucleusConnectionItem.__init__) (self) |
### Attributes
| | |
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| signed_in | [signed_in](omni.kit.widget.filebrowser.nucleus_model.NucleusConnectionItem.signed_in) |
#### __init__
__init__(self: omni.ui._ui.AbstractItem) -> None
#### signed_in
property signed_in
Return True when signed in to the Nucleus server. |
omni.kit.widget.filebrowser.nucleus_model.NucleusItemFactory.md | # NucleusItemFactory
## NucleusItemFactory
Factory to create `NucleusItem` instances.
### Methods
- `create_entry_item(*args, **kwargs)`
- `create_group_item(*args, **kwargs)`
### `__init__()` |
omni.kit.widget.filebrowser.singleton.Functions.md | # omni.kit.widget.filebrowser.singleton Functions
## Functions Summary:
| Name | Description |
|------------|--------------------|
| [Singleton](omni.kit.widget.filebrowser.singleton/omni.kit.widget.filebrowser.singleton.Singleton.html) | A singleton decorator | |
omni.kit.widget.filebrowser.singleton.md | # omni.kit.widget.filebrowser.singleton
## Functions Summary:
- **Singleton**
- A singleton decorator |
omni.kit.widget.filebrowser.singleton.Singleton.md | # Singleton
## Singleton
```python
omni.kit.widget.filebrowser.singleton.Singleton(class_)
```
A singleton decorator
``` |
omni.kit.widget.filebrowser.style.Classes.md | # omni.kit.widget.filebrowser.style Classes
## Classes Summary:
- **Path**
- PurePath subclass that can make system calls. |
omni.kit.widget.filebrowser.style.md | # omni.kit.widget.filebrowser.style
## Classes Summary:
| Class | Description |
|-------|-------------|
| [Path](omni.kit.widget.filebrowser.style/omni.kit.widget.filebrowser.style.Path.html) | PurePath subclass that can make system calls. | |
omni.kit.widget.filebrowser.style.Path.md | # Path
## Path
```python
class omni.kit.widget.filebrowser.style.Path(*args, **kwargs)
```
Bases: `PurePath`
PurePath subclass that can make system calls.
Path represents a filesystem path but unlike PurePath, also offers methods to do system calls on path objects. Depending on your system, instantiating a Path will return either a PosixPath or a WindowsPath object. You can also instantiate a PosixPath or WindowsPath directly, but cannot instantiate a WindowsPath on a POSIX system or vice versa.
### Methods
| Method | Description |
|--------|-------------|
| `absolute()` | Return an absolute version of this path. |
| `chmod(mode, [, follow_symlinks])` | Change the permissions of the path, like os.chmod(). |
| `cwd()` | Return a new path pointing to the current working directory (as returned by os.getcwd()). |
| `exists()` | Check if the path exists. |
```
- Whether this path exists.
- `expanduser()`
- Return a new path with expanded ~ and ~user constructs (as returned by os.path.expanduser)
- `glob(pattern)`
- Iterate over this subtree and yield all existing files (of any kind, including directories) matching the given relative pattern.
- `group()`
- Return the group name of the file gid.
- `hardlink_to(target)`
- Make this path a hard link pointing to the same file as `target`.
- `home()`
- Return a new path pointing to the user's home directory (as returned by os.path.expanduser('~')).
- `is_block_device()`
- Whether this path is a block device.
- `is_char_device()`
- Whether this path is a character device.
- `is_dir()`
- Whether this path is a directory.
- `is_fifo()`
- Whether this path is a FIFO.
- `is_file()`
- Whether this path is a regular file (also True for symlinks pointing to regular files).
- `is_mount()`
- Check if this path is a POSIX mount point
- `is_socket()`
- Whether this path is a socket.
- `is_symlink()`
- Whether this path is a symbolic link.
- `iterdir()`
- Iterate over the files in this directory.
| 方法 | 描述 |
| --- | --- |
| lchmod (mode) | Like chmod(), except if the path points to a symlink, the symlink's permissions are changed, rather than its target's. |
| link_to (target) | Make the target path a hard link pointing to this path. |
| lstat () | Like stat(), except if the path points to a symlink, the symlink's status information is returned, rather than its target's. |
| mkdir ([mode, parents, exist_ok]) | Create a new directory at this given path. |
| open ([mode, buffering, encoding, errors, ...]) | Open the file pointed by this path and return a file object, as the built-in open() function does. |
| owner () | Return the login name of the file owner. |
| read_bytes () | Open the file in bytes mode, read it, and close the file. |
| read_text ([encoding, errors]) | Open the file in text mode, read it, and close the file. |
| readlink () | Return the path to which the symbolic link points. |
| rename (target) | Rename this path to the target path. |
| replace (target) | Rename this path to the target path, overwriting if that path exists. |
| resolve ([strict]) | Make the path absolute, resolving all symlinks on the way and also normalizing it (for example turning slashes into backslashes under Windows). |
| rglob (pattern) | Recursively yield all existing files (of any kind, including directories) matching the given relative pattern, anywhere in this subtree. |
| rmdir () | Remove this directory. |
| samefile (other_path) | Return whether other_path is the same or not as this file (as returned by os.path.samefile()). |
| Method | Description |
|--------|-------------|
| `stat(*[, follow_symlinks])` | Return the result of the stat() system call on this path, like os.stat() does. |
| `symlink_to(target[, target_is_directory])` | Make this path a symlink pointing to the target path. |
| `touch([mode, exist_ok])` | Create this file with the given access mode, if it doesn't exist. |
| `unlink([missing_ok])` | Remove this file or link. |
| `write_bytes(data)` | Open the file in bytes mode, write to it, and close the file. |
| `write_text(data[, encoding, errors, newline])` | Open the file in text mode, write to it, and close the file. |
### Attributes
#### `__init__()`
#### `absolute()`
Return an absolute version of this path. This function works even if the path doesn’t point to anything.
No normalization is done, i.e. all ‘.’ and ‘..’ will be kept along. Use resolve() to get the canonical path to a file.
#### `chmod(mode, *[, follow_symlinks=True])`
Change the permissions of the path, like os.chmod().
#### `cwd()`
classmethod
Return a new path pointing to the current working directory (as returned by os.getcwd()).
#### `exists()`
Whether this path exists.
#### `expanduser()`
## Methods
### expanduser
Return a new path with expanded ~ and ~user constructs (as returned by os.path.expanduser)
### glob
Iterate over this subtree and yield all existing files (of any kind, including directories) matching the given relative pattern.
### group
Return the group name of the file gid.
### hardlink_to
Make this path a hard link pointing to the same file as target.
Note the order of arguments (self, target) is the reverse of os.link’s.
### home
Return a new path pointing to the user’s home directory (as returned by os.path.expanduser(‘~’)).
### is_block_device
Whether this path is a block device.
### is_char_device
Whether this path is a character device.
### is_dir
Whether this path is a directory.
### is_fifo
Whether this path is a FIFO.
### is_file
Whether this path is a regular file (also True for symlinks pointing to regular files).
### is_mount
Check if this path is a POSIX mount point
### is_socket
Whether this path is a socket.
### is_symlink
Whether this path is a symlink.
## Path Methods
### is_symlink
Whether this path is a symbolic link.
### iterdir
Iterate over the files in this directory. Does not yield any result for the special paths ‘.’ and ‘..’.
### lchmod
Like chmod(), except if the path points to a symlink, the symlink’s permissions are changed, rather than its target’s.
### link_to
Make the target path a hard link pointing to this path.
Note this function does not make this path a hard link to target, despite the implication of the function and argument names. The order of arguments (target, link) is the reverse of Path.symlink_to, but matches that of os.link.
Deprecated since Python 3.10 and scheduled for removal in Python 3.12. Use `hardlink_to()` instead.
### lstat
Like stat(), except if the path points to a symlink, the symlink’s status information is returned, rather than its target’s.
### mkdir
Create a new directory at this given path.
### open
Open the file pointed by this path and return a file object, as the built-in open() function does.
### owner
### Return the login name of the file owner.
### read_bytes
Open the file in bytes mode, read it, and close the file.
### read_text
Open the file in text mode, read it, and close the file.
### readlink
Return the path to which the symbolic link points.
### rename
Rename this path to the target path.
The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.
Returns the new Path instance pointing to the target path.
### replace
Rename this path to the target path, overwriting if that path exists.
The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.
Returns the new Path instance pointing to the target path.
### resolve
Make the path absolute, resolving all symlinks on the way and also normalizing it (for example turning slashes into backslashes under Windows).
### rglob
Recursively yield all existing files (of any kind, including directories) matching the given relative pattern, anywhere in this subtree.
### rmdir
Remove this directory. The directory must be empty.
### samefile
## Methods
### stat
```python
stat(follow_symlinks=True)
```
Return the result of the stat() system call on this path, like os.stat() does.
### symlink_to
```python
symlink_to(target, target_is_directory=False)
```
Make this path a symlink pointing to the target path. Note the order of arguments (link, target) is the reverse of os.symlink.
### touch
```python
touch(mode=438, exist_ok=True)
```
Create this file with the given access mode, if it doesn’t exist.
### unlink
```python
unlink(missing_ok=False)
```
Remove this file or link. If the path is a directory, use rmdir() instead.
### write_bytes
```python
write_bytes(data)
```
Open the file in bytes mode, write to it, and close the file.
### write_text
```python
write_text(data, encoding=None, errors=None, newline=None)
```
Open the file in text mode, write to it, and close the file. |
omni.kit.widget.filebrowser.Submodules.md | # omni.kit.widget.filebrowser Submodules
## Submodules
Summary:
| Module | Description |
|--------|-------------|
| [omni.kit.widget.filebrowser.abstract_column_delegate](omni.kit.widget.filebrowser.abstract_column_delegate.html) | An abstract column delegate class. Subclassed by column delegates used by :obj:`FileBrowserTreeView`. |
| [omni.kit.widget.filebrowser.card](omni.kit.widget.filebrowser.card.html) | Base Model classes for the filebrowser entity. |
| [omni.kit.widget.filebrowser.clipboard](omni.kit.widget.filebrowser.clipboard.html) | Collection of utility functions to manage the clipboard. |
| [omni.kit.widget.filebrowser.column_delegate_registry](omni.kit.widget.filebrowser.column_delegate_registry.html) | Manage Registration of column delegates to be used by :obj:`FileBrowserTreeView`. |
| [omni.kit.widget.filebrowser.date_format_menu](omni.kit.widget.filebrowser.date_format_menu.html) | A menu to set datetime format. |
| [omni.kit.widget.filebrowser.filesystem_model](omni.kit.widget.filebrowser.filesystem_model.html) | Model and Item classes for navigating the local file system on the machine. |
| [omni.kit.widget.filebrowser.grid_view](omni.kit.widget.filebrowser.grid_view.html) | A generic GridView Widget for File Systems. |
| [omni.kit.widget.filebrowser.model](omni.kit.widget.filebrowser.model.html) | No submodule docstring provided |
| [omni.kit.widget.filebrowser.nucleus_model](omni.kit.widget.filebrowser.nucleus_model.html) | Model and Item classes for navigating a Nucleus Server. |
| [omni.kit.widget.filebrowser.singleton](omni.kit.widget.filebrowser.singleton.html) | Decorator class to define the class as a singleton. |
### UI Styles for widgets used in the extension.
### Collection of functions to manage thumbnails.
### A generic Tree View Widget for File Systems.
### An abstract View class, subclassed by TreeView and GridView.
### UI widget for navigating a filesystem.
### UI Widget to change the scale of items inside :obj:`FileBrowserGridView`. |
omni.kit.widget.filebrowser.thumbnails.Classes.md | # omni.kit.widget.filebrowser.thumbnails Classes
## Classes Summary:
| Class Name | Description |
|------------|-------------|
| [MissingThumbnailError](#) | Raised when Moebius server error | |
omni.kit.widget.filebrowser.thumbnails.Functions.md | # omni.kit.widget.filebrowser.thumbnails Functions
## Functions Summary
- **find_thumbnails_for_files_async**
- Return a dictionary of thumbnails for the given files.
- **generate_missing_thumbnails_async**
- When missing thumbnails are discovered, send an event to have them generated. The generator
- **list_thumbnails_for_folder_async**
- Return a dictionary of thumbnails for the files in the given folder. |
omni.kit.widget.filebrowser.thumbnails.generate_missing_thumbnails_async.md | # generate_missing_thumbnails_async
## generate_missing_thumbnails_async
```python
async omni.kit.widget.filebrowser.thumbnails.generate_missing_thumbnails_async(missing_thumbnails: List[str])
```
When missing thumbnails are discovered, send an event to have them generated. The generator service is a separate process. Once generated, a reciprocal event is sent to update the UI. The flow is diagramed below:
```c++
+-----------------------------------+ +------------------------------+
| Filebrowser | | |
| +-------------------------+ | | | |
| | | | | | |
| | update_grid +---------------------------> Thumbnail generator |
| | | | | | service |
| +-------------------------+ | | | |
| +-------------------------+ | | Thumbnails | |
+-----------------------------------+ +------------------------------+
```
| | | | generated event | |
|---|--------------------------|---|------------------------|----------------------------|
| | update_cards_on | | | |
| | thumbnails_generated | | | |
| | | | | |
+-----------------------------------+------------------------------+ |
omni.kit.widget.filebrowser.thumbnails.md | # omni.kit.widget.filebrowser.thumbnails
## Classes Summary:
- **MissingThumbnailError**: Raised when Moebius server error
## Functions Summary:
- **find_thumbnails_for_files_async**: Return a dictionary of thumbnails for the given files.
- **generate_missing_thumbnails_async**: When missing thumbnails are discovered, send an event to have them generated. The generator
- **list_thumbnails_for_folder_async**: Return a dictionary of thumbnails for the files in the given folder. |
omni.kit.widget.filebrowser.thumbnails.MissingThumbnailError.md | # MissingThumbnailError
## MissingThumbnailError
```python
class omni.kit.widget.filebrowser.thumbnails.MissingThumbnailError(msg: str = '', url: Optional[str] = None)
```
Bases: `Exception`
Raised when Moebius server error
```python
def __init__(msg: str = '', url: Optional[str] = None)
```
**Optional**
[str]
=
None
) |
omni.kit.widget.filebrowser.tree_view.AwaitWithFrame.md | # AwaitWithFrame
## AwaitWithFrame
```python
class omni.kit.widget.filebrowser.tree_view.AwaitWithFrame(frame: Frame, future: Future)
```
Bases: `object`
A future-like object that runs the given future and makes sure it’s always in the given frame’s scope. It allows for creating widgets asynchronously.
### Methods
| Method | Description |
|--------|-------------|
| `__init__(frame: Frame, future: Future)` | |
``` |
omni.kit.widget.filebrowser.tree_view.Classes.md | # omni.kit.widget.filebrowser.tree_view Classes
## Classes Summary
- **AwaitWithFrame**
- A future-like object that runs the given future and makes sure it’s
- **FileBrowserTreeView**
- UI Widget for display files or folders as icons in a directory in tree view.
- **FileBrowserTreeViewDelegate**
- The delegate that manages building browser items under the model as widgets inside the tree view. |
omni.kit.widget.filebrowser.tree_view.FileBrowserTreeView.md | # FileBrowserTreeView
## FileBrowserTreeView
```python
class omni.kit.widget.filebrowser.tree_view.FileBrowserTreeView(model: FileBrowserModel, **kwargs)
```
Bases: `FileBrowserView`
UI Widget for display files or folders as icons in a directory in tree view.
### Keyword Arguments
- **root_visible** (bool) – Set to True to show the root item.
- **header_visible** (bool) – Set to True to show the column headers.
- **allow_multi_selection** (bool) – Optional argument to enable multi selection, defaults to True.
- **selection_changed_fn** (Callable) – Function called when selection changed. Function signature: `void selection_changed_fn(selections: List[FileBrowserItem])`
- **mouse_pressed_fn** (Callable) – Function called on mouse press. Function signature: `void mouse_pressed_fn(item: FileBrowserItem, x: float, y: float, button: int, key_mode: int)`
```
- **mouse_double_clicked_fn** (`Callable`) – Function called on mouse double click. Function signature:
```python
void mouse_double_clicked_fn(item: FileBrowserItem, x: float, y: float, button: int, key_mode: int)
```
- **treeview_identifier** (`str`) – widget identifier for treeview, only used by tests.
### Methods
| Method | Description |
|--------|-------------|
| `__init__` (model, **kwargs) | |
| `build_ui` () | Build the tree view. |
| `destroy` () | Destructor. |
| `is_expanded` (item) | Return True if the item is expanded. |
| `refresh_ui` ([item]) | Throttle the refreshes so that the UI can keep up with multiple refresh directives in succession. |
| `scroll_top` () | Scroll the widget to top |
| `select_and_center` (item) | Select and center the view on the given item. |
| `set_expanded` (item, expanded[, recursive]) | Set the expansion state of the given item. |
### Attributes
| Attribute | Description |
|-----------|-------------|
| `selections` | Get selected items in the tree view. |
| `tree_view` | Get the tree view. |
#### `__init__`
```python
__init__(model: FileBrowserModel, **kwargs)
```
```
### `__init__`
```python
def __init__(self, *args, **kwargs)
```
### `build_ui`
```python
def build_ui()
```
Build the tree view.
### `destroy`
```python
def destroy()
```
Destructor.
### `is_expanded`
```python
def is_expanded(item: FileBrowserItem) -> bool
```
Return True if the item is expanded.
### `refresh_ui`
```python
def refresh_ui(item: Optional[FileBrowserItem] = None)
```
Throttle the refreshes so that the UI can keep up with multiple refresh directives in succession.
**Parameters**
- **item** (`FileBrowserItem`) – The item to refresh.
### `scroll_top`
```python
def scroll_top()
```
Scroll the widget to top
### `select_and_center`
```python
def select_and_center(item: FileBrowserItem)
```
Select and center the view on the given item.
**Parameters**
- **item** (`FileBrowserItem`) – the item to set the new selection to.
(
item : FileBrowserItem,
expanded : bool,
recursive : bool = False
)
Set the expansion state of the given item.
Parameters:
- **item** (FileBrowserItem) – The item to effect.
- **expanded** (bool) – True to expand, False to collapse.
- **recursive** (bool) – Apply state recursively to descendent nodes. Default False.
property selections
Get selected items in the tree view.
property tree_view
Get the tree view. |
omni.kit.widget.filebrowser.tree_view.FileBrowserTreeViewDelegate.md | # FileBrowserTreeViewDelegate
## FileBrowserTreeViewDelegate
```python
class omni.kit.widget.filebrowser.tree_view.FileBrowserTreeViewDelegate(headers: Tuple[str], theme: str, **kwargs)
```
Bases: `AbstractItemDelegate`
The delegate that manages building browser items under the model as widgets inside the tree view.
### Parameters
- **headers** (Tuple[str]) – Tuple of columns to show in the tree view.
- **theme** (str) – The theme name to use.
### Keyword Arguments
- **mouse_pressed_fn** (Callable) – Function called on mouse press. Function signature: void mouse_pressed_fn(item: `FileBrowserItem`, x: float, y: float, button: int, key_mode: int)
- **mouse_double_clicked_fn** (Callable) – Function called on mouse double click. Function signature:
```
### Events
- `mouse_double_clicked_fn(item: FileBrowserItem, x: float, y: float, button: int, key_mode: int)`
- Function called when item double clicked.
- `column_clicked_fn(Callable)`
- Function called when column clicked. Function signature: `void column_clicked_fn(column_id: int)`
- `datetime_format_changed_fn(Callable)`
- Function called when datetime format changed. Function signature: `void datetime_format_changed_fn()`
- `sort_by_column(int)`
- The column index to sort items, defaults to 0.
- `sort_ascending(bool)`
- Sort in ascending or otherwise descending order, defaults to ascending.
- `builtin_column_count(int)`
- Set count of builtin columns.
- `icon_provider(object)`
- Set this to override default icons.
### Methods
- `__init__(self)`
- Constructs AbstractItemDelegate.
- `build_branch(model, item, column_id, level, ...)`
- Create a branch widget that opens or closes subtree.
- `build_header(column_id)`
- Build the given column.
- `build_widget(model, item, column_id, level, ...)`
- Create a widget per item.
- `clear_futures()`
- Stop and destroy all working futures.
- `destroy()`
- Destructor.
- `set_column_delegates(delegates)`
- Add custom columns.
### Attributes
- `sort_ascending`
- Return True when sort in ascending order.
- `sort_by_column`
- Return the column index used for sorting.
### omni.kit.widget.filebrowser.tree_view.FileBrowserTreeViewDelegate.__init__
Constructs AbstractItemDelegate.
#### Keyword Arguments:
- `kwargs` (dict) - See below
### omni.kit.widget.filebrowser.tree_view.FileBrowserTreeViewDelegate.build_branch
Create a branch widget that opens or closes subtree.
#### Parameters:
- **model** (`FileBrowserModel`) – The model to build the branch with.
- **item** (`FileBrowserItem`) – The item to build.
- **column_id** (int) – ID of the column.
- **level** (int) – level of the item inside the tree.
- **expanded** (bool) – Set if the item is expanded.
### omni.kit.widget.filebrowser.tree_view.FileBrowserTreeViewDelegate.build_header
Build the given column.
#### Parameters:
- **column_id** (int) – ID of the column.
### omni.kit.widget.filebrowser.tree_view.FileBrowserTreeViewDelegate.build_widget
Build a widget.
#### Parameters:
- **model** (`FileBrowserModel`) – The model to build the widget with.
- **item** (`FileBrowserItem`) – The item to build.
- **column_id** (int) – ID of the column.
- **level** (int) – level of the item inside the tree.
- **expanded** (bool) – Set if the item is expanded.
### FileBrowserTreeViewDelegate Methods
#### build_widget
```python
def build_widget(model: FileBrowserModel, item: FileBrowserItem, column_id: int, level: int, expanded: bool):
```
Create a widget per item.
**Parameters:**
- **model** (`FileBrowserModel`) – The model to build the widget with.
- **item** (`FileBrowserItem`) – The item to build.
- **column_id** (`int`) – ID of the column.
- **level** (`int`) – level of the item inside the tree.
- **expanded** (`bool`) – Set if the item is expanded.
#### clear_futures
```python
def clear_futures():
```
Stop and destroy all working futures
#### destroy
```python
def destroy():
```
Destructor.
#### set_column_delegates
```python
def set_column_delegates(delegates: List[AbstractColumnDelegate]):
```
Add custom columns
#### sort_ascending
```python
property sort_ascending: bool
```
```
## Property Definitions
### sort_in_ascending_order
- **Description:** Return True when sort in ascending order.
### sort_by_column
- **Type:** int
- **Description:** Return the column index used for sorting. |
omni.kit.widget.filebrowser.view.Classes.md | # omni.kit.widget.filebrowser.view Classes
## Classes Summary
| Class Name | Description |
|------------|-------------|
| [FileBrowserView](omni.kit.widget.filebrowser.view/omni.kit.widget.filebrowser.view.FileBrowserView.html) | Base class for :obj:`FileBrowserGridView` and :obj:`FileBrowserTreeView`. | |
omni.kit.widget.filebrowser.view.FileBrowserView.md | # FileBrowserView
## FileBrowserView
```python
class omni.kit.widget.filebrowser.view.FileBrowserView(model: FileBrowserModel)
```
Bases: `object`
Base class for `FileBrowserGridView` and `FileBrowserTreeView`.
**Parameters**
- **model** (`FileBrowserModel`) – the model to use.
**Methods**
- `__init__(model)`
- `build_ui()` - Build the UI.
- `destroy()` - Destructor.
```
| Method | Description |
|--------|-------------|
| `refresh_ui([item])` | Update the UI. |
| `select_and_center(item)` | Select and center the view on the given item. |
| `set_root(item)` | Set the root item. |
### Attributes
| Attribute | Description |
|-----------|-------------|
| `model` | Return the model of the view. |
| `visible` | Return visiblity of the view. |
### Methods
#### `__init__(model: FileBrowserModel)`
Initialize the view with a model.
#### `build_ui()`
Build the UI.
#### `destroy()`
Destructor.
#### `refresh_ui(item: Optional[FileBrowserItem] = None)`
Update the UI.
Parameters:
- `item` (FileBrowserItem) – The item to refresh.
### select_and_center
```abstract```
```select_and_center```(item: ```FileBrowserItem```)
Select and center the view on the given item.
:param item: the item to set the new selection to.
:type item: ```FileBrowserItem```
### set_root
```set_root```(item: ```FileBrowserItem```)
Set the root item.
### model
```property```
```model```
Return the model of the view.
### visible
```property```
```visible```
Return visibility of the view. |
omni.kit.widget.filebrowser.view.md | # omni.kit.widget.filebrowser.view
## Classes Summary
- **FileBrowserView**
- Base class for `FileBrowserGridView` and `FileBrowserTreeView`. |
omni.kit.widget.filebrowser.widget.Classes.md | # omni.kit.widget.filebrowser.widget Classes
## Classes Summary:
| Class Name | Description |
|------------|-------------|
| [FileBrowserWidget](omni.kit.widget.filebrowser.widget/omni.kit.widget.filebrowser.widget.FileBrowserWidget.html) | The basic UI widget for navigating a filesystem as a tree or grid view. | |
omni.kit.widget.filebrowser.widget.md | # omni.kit.widget.filebrowser.widget
## Classes Summary:
- **FileBrowserWidget**
- The basic UI widget for navigating a filesystem as a tree or grid view. |
omni.kit.widget.filebrowser.zoom_bar.Classes.md | # omni.kit.widget.filebrowser.zoom_bar Classes
## Classes Summary:
| Class | Description |
|-------|-------------|
| [ZoomBar](omni.kit.widget.filebrowser.zoom_bar/omni.kit.widget.filebrowser.zoom_bar.ZoomBar.html) | Widget to control the scale of items inside :obj:`FileBrowserGridView`. | |
omni.kit.widget.filebrowser.zoom_bar.ZoomBar.md | # ZoomBar
## ZoomBar
```python
class omni.kit.widget.filebrowser.zoom_bar.ZoomBar(**kwargs)
```
Bases: `object`
Widget to control the scale of items inside `FileBrowserGridView`.
### Methods
| Method | Description |
|--------|-------------|
| `__init__(**kwargs)` | |
| `destroy()` | Destructor |
```python
def __init__(**kwargs):
pass
```
```python
def destroy():
"""
Destructor
"""
```
---
title: 文章标题
---
# 章节标题
## 子章节标题
### 子子章节标题
> 引用内容
**加粗文本**
*斜体文本*
`代码块`
- 列表项1
- 列表项2
1. 有序列表项1
2. 有序列表项2
---
## 页脚
--- |
omni.kit.widget.graph.AbstractBatchPositionGetter.md | # AbstractBatchPositionGetter
## AbstractBatchPositionGetter
```python
class omni.kit.widget.graph.AbstractBatchPositionGetter(model: GraphModel)
```
Helper to get the nodes to move at the same time
### Methods
```python
__init__(model: GraphModel)
```
### Attributes
```python
model
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```javascript
SphinxRtdTheme.Navigation.enable(true);
});
</script>
``` |
omni.kit.widget.graph.AbstractGraphNodeDelegate.md | # AbstractGraphNodeDelegate
The delegate generates widgets that together form the node using the model. The following figure shows the LIST layout of the node. For every zone, there is a method that is called to build this zone.
```c++
+---------------------+
| node_background |
| +---+-------------+ |
| | [A] | node_header | |
| +---+-------------+ |
| | [C] | port | |
| +---+-------------+ |
| | [D] | port | |
| +---+-------------+ |
| | [E] | node_footer | |
| +---+-------------+ |
+---------------------+
```
COLUMN layout allows to put input and output ports at the same line:
```c++
+---------------------+
| node_background |
| +---+-------------+ |
| | [A] | node_header | |
| +---+-------------+ |
| | [C] | port | |
| +---+-------------+ |
| | [D] | port | |
| +---+-------------+ |
| | [E] | node_footer | |
| +---+-------------+ |
+---------------------+
```
| +---+------+------+---+ |
| [C] | port | port | [D] | |
| | |------+---| |
| |---+------| port | [D] | |
| [D] | port | | | |
| +---+------+------+---+ |
| [E] | node_footer | [F] | |
| +---+-------------+---+ |
+-------------------------+
[A] node_header_input
[B] node_header_output
[C] port_input
[D] port_output
[E] node_footer_input (TODO)
[F] node_footer_output (TODO)
## Methods
| Method | Description |
|--------|-------------|
| `connection(model, source_desc, target_desc)` | Called to create the connection between ports. |
| `destroy()` | |
| `get_node_layout(model, node_desc)` | Called to determine the node layout |
| `node_background(model, node_desc)` | Called to create widgets of the node background |
| `node_footer(model, node_desc)` | Called to create widgets of the bottom of the node |
| `node_header(model, node_desc)` | Called to create widgets of the top of the node |
| `node_header_input(model, node_desc)` | Called to create the left part of the header that will be used as input when the node is collapsed |
| `node_header_output(model, node_desc)` | Called to create the right part of the header that will be used as output when the node is collapsed |
| `port(model, node_desc)` | |
| Method | Description |
|--------|-------------|
| `port(model, node_desc, port_desc)` | Called to create the middle part of the port |
| `port_input(model, node_desc, port_desc)` | Called to create the left part of the port that will be used as input |
| `port_output(model, node_desc, port_desc)` | Called to create the right part of the port that will be used as output |
### `__init__()`
### `connection(model, source_desc: GraphConnectionDescription, target_desc: GraphConnectionDescription, foreground: bool = False)`
Called to create the connection between ports. This method can be called twice - once as a background pass, once as a foreground pass, which is what the `foreground` parameter denotes. The foreground pass is off by default, but is useful for curve anchor floating value displays that need to be in front of all nodes.
### `get_node_layout(model, node_desc: GraphNodeDescription)`
Called to determine the node layout
### `node_background(model, node_desc: GraphNodeDescription)`
### node_background
Called to create widgets of the node background
### node_footer
Called to create widgets of the bottom of the node
### node_header
Called to create widgets of the top of the node
### node_header_input
Called to create the left part of the header that will be used as input when the node is collapsed
### node_header_output
Called to create the right part of the header that will be used as output when the node is collapsed
### port
Called to create widgets for a port
### GraphPortDescription
#### port
Called to create the middle part of the port
#### port_input
(model, node_desc: GraphNodeDescription, port_desc: GraphPortDescription)
Called to create the left part of the port that will be used as input
#### port_output
(model, node_desc: GraphNodeDescription, port_desc: GraphPortDescription)
Called to create the right part of the port that will be used as output |
omni.kit.widget.graph.abstract_batch_position_getter.AbstractBatchPositionGetter.md | # AbstractBatchPositionGetter
## AbstractBatchPositionGetter
Helper to get the nodes to move at the same time
### Methods
- `__init__(model)`
### Attributes
- `model`
### `__init__(model)`
```
GraphModel |
omni.kit.widget.graph.abstract_batch_position_getter.Classes.md | # omni.kit.widget.graph.abstract_batch_position_getter Classes
## Classes Summary:
| Class | Description |
|-------|-------------|
| [AbstractBatchPositionGetter](omni.kit.widget.graph.abstract_batch_position_getter/omni.kit.widget.graph.abstract_batch_position_getter.AbstractBatchPositionGetter.html) | Helper to get the nodes to move at the same time | |
omni.kit.widget.graph.abstract_graph_node_delegate.AbstractGraphNodeDelegate.md | # AbstractGraphNodeDelegate
## AbstractGraphNodeDelegate
```
The delegate generates widgets that together form the node using the model. The following figure shows the LIST layout of the node. For every zone, there is a method that is called to build this zone.
```
+---------------------+
| node_background |
| +---+-------------+ |
| | [A] | node_header | |
| +---+-------------+ |
| | [C] | port | |
| +---+-------------+ |
| | [D] | port | |
| +---+-------------+ |
| | [E] | node_footer | |
| +---+-------------+ |
+---------------------+
```
COLUMN layout allows to put input and output ports at the same line:
```
+---------------------+
| node_background |
| |
| |
| |
| |
| |
+---------------------+
```
| +---+-------------+---+
| [A] | node_header | [B] |
+---+------+------+---+
| [C] | port | port | [D] |
| | |------+---|
| --- |------| port | [D] |
| [D] | port | | |
+---+------+------+---+
| [E] | node_footer | [F] |
+---+-------------+---+
+-------------------------+
## Methods
| Method | Description |
|--------|-------------|
| `connection(model, source_desc, target_desc)` | Called to create the connection between ports. |
| `destroy()` | |
| `get_node_layout(model, node_desc)` | Called to determine the node layout |
| `node_background(model, node_desc)` | Called to create widgets of the node background |
| `node_footer(model, node_desc)` | Called to create widgets of the bottom of the node |
| `node_header(model, node_desc)` | Called to create widgets of the top of the node |
| `node_header_input(model, node_desc)` | Called to create the left part of the header that will be used as input when the node is collapsed |
### Methods
#### `node_header_output`
- **Parameters**: `model`, `node_desc`
- **Description**: Called to create the right part of the header that will be used as output when the node is collapsed.
#### `port`
- **Parameters**: `model`, `node_desc`, `port_desc`
- **Description**: Called to create the middle part of the port.
#### `port_input`
- **Parameters**: `model`, `node_desc`, `port_desc`
- **Description**: Called to create the left part of the port that will be used as input.
#### `port_output`
- **Parameters**: `model`, `node_desc`, `port_desc`
- **Description**: Called to create the right part of the port that will be used as output.
#### `__init__`
- **Description**: Initializes the object.
#### `connection`
- **Parameters**: `model`, `source_desc: GraphConnectionDescription`, `target_desc: GraphConnectionDescription`, `foreground: bool = False`
- **Description**: Called to create the connection between ports. This method can be called twice - once as a background pass, once as a foreground pass, which is what the `foreground` parameter denotes. The foreground pass is off by default, but is useful for curve anchor floating value displays that need to be in front of all nodes.
#### `get_node_layout`
- **Parameters**: `model`, `node_desc: GraphNodeDescription`
- **Description**: Called to determine the node layout.
#### `node_background`
- **Description**: (Description not provided in the HTML snippet)
(model, node_desc: GraphNodeDescription)
Called to create widgets of the node background
(model, node_desc: GraphNodeDescription)
Called to create widgets of the bottom of the node
(model, node_desc: GraphNodeDescription)
Called to create widgets of the top of the node
(model, node_desc: GraphNodeDescription)
Called to create the left part of the header that will be used as input when the node is collapsed
(model, node_desc: GraphNodeDescription)
Called to create the right part of the header that will be used as output when the node is collapsed
(model, node_desc: GraphNodeDescription)
Called to create widgets of the node background
### AbstractGraphNodeDelegate Methods
#### port
```python
def port(model, node_desc: GraphNodeDescription, port_desc: GraphPortDescription):
"""
Called to create the middle part of the port
"""
```
#### port_input
```python
def port_input(model, node_desc: GraphNodeDescription, port_desc: GraphPortDescription):
"""
Called to create the left part of the port that will be used as input
"""
```
#### port_output
```python
def port_output(model, node_desc: GraphNodeDescription, port_desc: GraphPortDescription):
"""
Called to create the right part of the port that will be used as output
"""
``` |
omni.kit.widget.graph.abstract_graph_node_delegate.Classes.md | # omni.kit.widget.graph.abstract_graph_node_delegate Classes
## Classes Summary
- **AbstractGraphNodeDelegate**
- The delegate generates widgets that together form the node using the
- **GraphConnectionDescription**
- The object that holds the main attributes of the connection
- **GraphNodeDescription**
- The object that holds the main attributes of the node
- **GraphNodeLayout**
- An enumeration.
- **GraphPortDescription**
- The object that holds the main attributes of the port |
omni.kit.widget.graph.abstract_graph_node_delegate.GraphConnectionDescription.md | # GraphConnectionDescription
## GraphConnectionDescription
```python
class omni.kit.widget.graph.abstract_graph_node_delegate.GraphConnectionDescription(node, port, widget, level, is_tangent_reversed=False)
```
Bases: `object`
The object that holds the main attributes of the connection
### Methods
```python
__init__(node, port, widget, level[, ...])
```
```
<section>
<div>
<div>
<div>
<div>
<dl>
<dt>
<em>
<span>
<span>
is_tangent_reversed
</span>
</span>
<span>
<span>
=
</span>
</span>
<span>
<span>
False
</span>
</span>
</em>
<span>
)
</span>
</dt>
<dd>
</dd>
</dl>
</div>
</div>
<footer>
<hr/>
</footer>
</div>
</div>
</section> |
omni.kit.widget.graph.abstract_graph_node_delegate.GraphNodeDescription.md | # GraphNodeDescription
## GraphNodeDescription
```python
class omni.kit.widget.graph.abstract_graph_node_delegate.GraphNodeDescription(node, connected_source=None, connected_target=None)
```
Bases: `object`
The object that holds the main attributes of the node
### Methods
| Method | Description |
|--------|-------------|
| `__init__(node[, connected_source, connected_target])` | |
```python
def __init__(node, connected_source=None, connected_target=None):
# method implementation
```
``` |
omni.kit.widget.graph.abstract_graph_node_delegate.GraphNodeLayout.md | # GraphNodeLayout
## GraphNodeLayout
```python
class omni.kit.widget.graph.abstract_graph_node_delegate.GraphNodeLayout(value)
```
An enumeration.
### Attributes
| Attribute | Description |
|-----------|-------------|
| LIST | |
| COLUMNS | |
| HEAP | |
### `__init__`
```python
__init__()
```
``` |
omni.kit.widget.graph.abstract_graph_node_delegate.GraphPortDescription.md | # GraphPortDescription
## GraphPortDescription
```python
class omni.kit.widget.graph.abstract_graph_node_delegate.GraphPortDescription(port, level, relative_position, parent_child_count, connected_source=None, connected_target=None)
```
Bases: `object`
The object that holds the main attributes of the port
### Methods
- `__init__(port, level, relative_position, parent_child_count, connected_source=None, connected_target=None)`
```
parent_child_count, connected_source=None, connected_target=None) |
omni.kit.widget.graph.BackdropDelegate.md | # BackdropDelegate
## BackdropDelegate
```python
class omni.kit.widget.graph.BackdropDelegate(scale_factor=1.0)
```
Bases: `GraphNodeDelegateFull`
The delegate with the Omniverse design for the nodes of the closed state.
### Methods
| Method | Description |
|--------|-------------|
| `node_background(model, node_desc)` | Called to create widgets of the node background |
| `node_footer(model, node_desc)` | Called to create widgets of the bottom of the node |
| `node_header(model, node_desc)` | Called to create widgets of the top of the node |
```python
def __init__(scale_factor=1.0):
```
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.widget.graph.BackdropDelegate.node_background">
<span class="sig-name descname">
<span class="pre">
node_background
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
model
</span>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
node_desc
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
GraphNodeDescription
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Called to create widgets of the node background
</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.widget.graph.BackdropDelegate.node_footer">
<span class="sig-name descname">
<span class="pre">
node_footer
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
model
</span>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
node_desc
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
GraphNodeDescription
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Called to create widgets of the bottom of the node
</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.widget.graph.BackdropDelegate.node_header">
<span class="sig-name descname">
<span class="pre">
node_header
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
model
</span>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
node_desc
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
GraphNodeDescription
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Called to create widgets of the top of the node
</p>
</dd>
</dl> |
omni.kit.widget.graph.BackdropGetter.md | # BackdropGetter
## BackdropGetter
```
class omni.kit.widget.graph.BackdropGetter(model: GraphModel, is_backdrop_fn: Callable[[Any], bool], graph_widget=None)
```
**Bases:**
```
AbstractBatchPositionGetter
```
**Description:**
Helper to get the nodes that placed in the given backdrop
**Methods:**
```
__init__(model, is_backdrop_fn[, graph_widget])
```
**Attributes:**
```
None
```
## __init__
(
**model** : GraphModel,
**is_backdrop_fn** : Callable[[Any], bool],
**graph_widget** = None
) |
omni.kit.widget.graph.backdrop_delegate.BackdropDelegate.md | # BackdropDelegate
## BackdropDelegate
```python
class omni.kit.widget.graph.backdrop_delegate.BackdropDelegate(scale_factor=1.0)
```
Bases: `GraphNodeDelegateFull`
The delegate with the Omniverse design for the nodes of the closed state.
### Methods
| Method | Description |
|--------|-------------|
| `node_background(model, node_desc)` | Called to create widgets of the node background |
| `node_footer(model, node_desc)` | Called to create widgets of the bottom of the node |
| `node_header(model, node_desc)` | Called to create widgets of the top of the node |
### `__init__(scale_factor=1.0)`
```
## BackdropDelegate Methods
### __init__
```python
scale_factor = 1.0
```
### node_background
```python
node_background(model, node_desc: GraphNodeDescription)
```
Called to create widgets of the node background
### node_footer
```python
node_footer(model, node_desc: GraphNodeDescription)
```
Called to create widgets of the bottom of the node
### node_header
```python
node_header(model, node_desc: GraphNodeDescription)
```
Called to create widgets of the top of the node |
omni.kit.widget.graph.backdrop_delegate.Classes.md | # omni.kit.widget.graph.backdrop_delegate Classes
## Classes Summary
| Class | Description |
|-------|-------------|
| [BackdropDelegate](omni.kit.widget.graph.backdrop_delegate/omni.kit.widget.graph.backdrop_delegate.BackdropDelegate.html) | The delegate with the Omniverse design for the nodes of the closed state. | |
omni.kit.widget.graph.backdrop_getter.Classes.md | # omni.kit.widget.graph.backdrop_getter Classes
## Classes Summary
- **BackdropGetter**
- Helper to get the nodes that placed in the given backdrop |
omni.kit.widget.graph.Classes.md | # omni.kit.widget.graph Classes
## Classes Summary
| Class Name | Description |
|------------|-------------|
| AbstractBatchPositionGetter | Helper to get the nodes to move at the same time |
| AbstractGraphNodeDelegate | The delegate generates widgets that together form the node using the |
| BackdropDelegate | The delegate with the Omniverse design for the nodes of the closed state. |
| BackdropGetter | Helper to get the nodes that placed in the given backdrop |
| CompoundInputOutputNodeDelegate | The delegate for the input/output nodes of the compound. |
| CompoundNodeDelegate | The delegate for the compound nodes. |
| GraphConnectionDescription | The object that holds the main attributes of the connection |
| GraphModel | The base class for the Graph model. |
| GraphModelBatchPositionHelper | The model that manages batch position of the items. It can be used to manage |
| GraphNodeDelegate | The delegate with the Omniverse design that has both full and collapsed states. |
| GraphNodeDelegateRouter | |
### GraphNodeDelegateRouter
The delegate that keeps multiple delegates and pick them depending on the
### GraphNodeDescription
The object that holds the main attributes of the node
### GraphNodeLayout
An enumeration.
### GraphPortDescription
The object that holds the main attributes of the port
### GraphView
The visualisation layer of omni.kit.widget.graph. It behaves like a
### IsolationGraphModel
### SelectionGetter
Helper to get the selection of the given model. It’s supposed to be |
omni.kit.widget.graph.CompoundInputOutputNodeDelegate.md | # CompoundInputOutputNodeDelegate
## CompoundInputOutputNodeDelegate
```python
class omni.kit.widget.graph.CompoundInputOutputNodeDelegate(GraphNodeDelegateFull)
```
The delegate for the input/output nodes of the compound.
### Methods
```python
__init__()
```
```python
destroy()
```
```python
port(model, node_desc, port_desc)
```
Called to create the middle part of the port
```python
port_input(model, node_desc, port_desc)
```
Called to create the left part of the port that will be used as input
```python
port_output(model, node_desc, port_desc)
```
Called to create the right part of the port that will be used as output
```
### `__init__`
### `port(model, node_desc: GraphNodeDescription, port_desc: GraphPortDescription)`
Called to create the middle part of the port
### `port_input(model, node_desc: GraphNodeDescription, port_desc: GraphPortDescription)`
Called to create the left part of the port that will be used as input
### `port_output(model, node_desc: GraphNodeDescription, port_desc: GraphPortDescription)`
Called to create the right part of the port that will be used as output |
omni.kit.widget.graph.CompoundNodeDelegate.md | # CompoundNodeDelegate
## CompoundNodeDelegate
```
class omni.kit.widget.graph.CompoundNodeDelegate(scale_factor=1.0)
```
Bases:
```
GraphNodeDelegateFull
```
The delegate for the compound nodes.
### Methods
```
__init__(scale_factor=1.0)
```
``` |
omni.kit.widget.graph.compound_node_delegate.Classes.md | # omni.kit.widget.graph.compound_node_delegate Classes
## Classes Summary
- **CompoundInputOutputNodeDelegate**
- The delegate for the input/output nodes of the compound.
- **CompoundNodeDelegate**
- The delegate for the compound nodes. |
omni.kit.widget.graph.compound_node_delegate.CompoundNodeDelegate.md | # CompoundNodeDelegate
## CompoundNodeDelegate
```python
class omni.kit.widget.graph.compound_node_delegate.CompoundNodeDelegate(scale_factor=1.0)
```
Bases: `GraphNodeDelegateFull`
The delegate for the compound nodes.
### Methods
```python
def __init__(scale_factor=1.0)
```
``` |
omni.kit.widget.graph.GraphConnectionDescription.md | # GraphConnectionDescription
## GraphConnectionDescription
```python
class omni.kit.widget.graph.GraphConnectionDescription(node, port, widget, level, is_tangent_reversed=False)
```
Bases: `object`
The object that holds the main attributes of the connection
### Methods
| Method | Description |
|--------|-------------|
| `__init__(node, port, widget, level, is_tangent_reversed=False)` | |
``` |
omni.kit.widget.graph.GraphModel.md | # GraphModel
## GraphModel
The base class for the Graph model.
The model is the central component of the graph widget. It is the application’s dynamic data structure, independent of the user interface, and it directly manages the data. It follows closely model–view pattern. It defines the standard interface to be able to interoperate with the components of the model-view architecture. It is not supposed to be instantiated directly. Instead, the user should subclass it to create a new model.
The model manages two kinds of data elements. Node and port are the atomic data elements of the model. Both node and port can have any number of sub-ports and any number of input and output connections.
There is no specific Python type for the elements of the model. Since Python has dynamic types, the model can return any object as a node or a port. When the widget needs to get a property of the node, it provides the given node back to the model.
Example:
```python
class UsdShadeModel(GraphModel):
@property
def nodes(self, prim=None):
# Return Usd.Prim in a list
return [stage.GetPrimAtPath(selection)]
@property
def name(self, item=None):
# item here is Usd.Prim because UsdShadeModel.nodes returns
# Usd.Prim
return item.GetPath().name
# Accessing nodes and properties example
model = UsdShadeModel()
# UsdShadeModel decides the type of nodes. It's a list with Usd.Prim
nodes = model.nodes
for node in nodes:
# The node is accessed through evaluation of self[key]. It will
# return the proxy object that redirects its properties back to
# model. So the following line will call UsdShadeModel.name(node).
name = model[node].name
print(f"The model has node {name}")
```
### Methods
- **__init__**
```
### Methods
- `__init__()`
- `can_connect(source, target)`
- Return if it's possible to connect source to target
- `destroy()`
- `has_nodes(obj)`
- Returns true if the model can currently build the graph network using the provided object
- `position_begin_edit(item)`
- Called when the user started dragging the node
- `position_end_edit(item)`
- Called when the user finished dragging the node and released the mouse
- `size_begin_edit(item)`
- Called when the user started resizing the node
- `size_end_edit(item)`
- Called when the user finished resizing the node and released the mouse
- `special_select_widget(node, node_widget)`
- `subscribe_item_changed(fn)`
- Return the object that will automatically unsubscribe when destroyed.
- `subscribe_node_changed(fn)`
- Return the object that will automatically unsubscribe when destroyed.
- `subscribe_selection_changed(fn)`
- Return the object that will automatically unsubscribe when destroyed.
### Attributes
- `DISPLAY_NAME`
- `description`
- The text label that is displayed on the backdrop in the node graph.
- `display_color`
- The node color.
- `expansion_state`
- `icon`: Return icon of the image
- `inputs`:
- `name`: The name of the item how it should be displayed in the view
- `nodes`:
- `outputs`:
- `ports`:
- `position`: Returns the position of the node
- `preview`: Return the preview of the image
- `preview_state`: Return the state of the preview of the node
- `selection`:
- `size`: The node size.
- `stacking_order`: This value is a hint when an application cares about the visibility of a node and whether each node overlaps another.
- `type`:
__init__()
class ExpansionState(value)
- Bases: Enum
- An enumeration.
class PreviewState(value)
- Bases: IntFlag
- An enumeration.
## Methods
### can_connect
```python
can_connect(source, target)
```
Return if it’s possible to connect source to target
### has_nodes
```python
static has_nodes(obj)
```
Returns true if the model can currently build the graph network using the provided object
### position_begin_edit
```python
position_begin_edit(item)
```
Called when the user started dragging the node
### position_end_edit
```python
position_end_edit(item)
```
Called when the user finished dragging the node and released the mouse
### size_begin_edit
```python
size_begin_edit(item)
```
Called when the user started resizing the node
### size_end_edit
```python
size_end_edit(item)
```
Called when the user finished resizing the node and released the mouse
### subscribe_item_changed
```python
subscribe_item_changed(fn)
```
Return the object that will automatically unsubscribe when destroyed.
### subscribe_node_changed
```python
subscribe_node_changed(fn)
```
Return the object that will automatically unsubscribe when destroyed.
### subscribe_selection_changed
```python
subscribe_selection_changed(fn)
```
Return the object that will automatically unsubscribe when destroyed.
## Property
### description
```python
property description
```
The text label that is displayed on the backdrop in the node graph.
## Properties
### display_color
The node color.
### icon
Return icon of the image
### name
The name of the item how it should be displayed in the view
### position
Returns the position of the node
### preview
Return the preview of the image
### preview_state
Return the state of the preview of the node
### size
The node size. Is used for nodes like Backdrop.
### stacking_order
This value is a hint when an application cares about the visibility of a node and whether each node overlaps another. |
omni.kit.widget.graph.GraphModelBatchPositionHelper.md | # GraphModelBatchPositionHelper
## GraphModelBatchPositionHelper
The model that manages batch position of the items. It can be used to manage the position of multi selection, backdrops and upstreams.
### Methods
- **`__init__()`**
- **`add_get_moving_items_fn(fn)`**
- Add the function that is called in batch_position_begin_edit to determine which items to move
- **`batch_position_begin_edit(item)`**
- Should be called from position_begin_edit to make sure position_begin_edit is called for all the selected nodes
- **`batch_position_end_edit(item)`**
- Should be called from position_begin_edit to make sure position_begin_edit is called for all the selected nodes
- **`batch_set_position(position[, item])`**
- Should be called in the position setter to make sure the position setter is called for all the selected nodes
### Attributes
| Attribute | Description |
|-----------|-------------|
| `batch_proxy` | Proxy is the isolation model. |
### Methods
#### `__init__()`
#### `add_get_moving_items_fn(fn: Callable[[Any], List[Any]])`
Add the function that is called in batch_position_begin_edit to determine which items to move.
#### `batch_position_begin_edit(item: Any)`
Should be called from position_begin_edit to make sure position_begin_edit is called for all the selected nodes.
#### `batch_position_end_edit(item: Any)`
Should be called from position_begin_edit to make sure position_begin_edit is called for all the selected nodes.
#### `batch_set_position(position: List[float], item: Optional[Any] = None)`
Should be called in the position setter to make sure the position setter is called for all the selected nodes.
## GraphModelBatchPositionHelper.batch_proxy
**Property**: batch_proxy
Proxy is the isolation model. We need it because it converts calls to input/output nodes. |
omni.kit.widget.graph.GraphNodeDelegate.md | # GraphNodeDelegate
## GraphNodeDelegate
```python
class omni.kit.widget.graph.GraphNodeDelegate(GraphNodeDelegateRouter)
```
The delegate with the Omniverse design that has both full and collapsed states.
### Methods
```python
__init__()
```
```python
get_style()
```
Return style that can be used with this delegate
```python
specialized_color_style(name, color, icon[, ...])
```
Return part of the style that has everything to color special node type.
```python
specialized_port_style(name, color)
```
Return part of the style that has everything to color the customizable part of the port.
### get_style()
Return style that can be used with this delegate
### specialized_color_style(name, color, icon, icon_tint_color=None)
Return part of the style that has everything to color special node type.
#### Parameters
- **name** – Node type
- **color** – Node color
- **icon** – Filename to the icon the node type should display
- **icon_tint_color** – Icon tint color
### specialized_port_style(name, color)
Return part of the style that has everything to color the customizable part of the port.
#### Parameters
- **name** – Port type type
- **color** – Port color |
omni.kit.widget.graph.GraphNodeDelegateRouter.md | # GraphNodeDelegateRouter
## GraphNodeDelegateRouter
```python
class omni.kit.widget.graph.GraphNodeDelegateRouter
```
**Bases:**
```python
AbstractGraphNodeDelegate
```
**Description:**
The delegate that keeps multiple delegates and pick them depending on the routing conditions.
It’s possible to add the routing conditions with `add_route`, and conditions could be a type or a lambda expression.
The latest added routing is stronger than previously added. Routing added without conditions is the default.
We use type routing to make the specific kind of nodes unique, and also we can use the lambda function to make the particular state of nodes unique (ex. full/collapsed).
It’s possible to use type and lambda routing at the same time.
**Usage examples:**
```python
delegate.add_route(TextureDelegate(), type="Texture2d")
delegate.add_route(CollapsedDelegate(), expression=is_collapsed)
```
### Methods
| Method | Description |
|--------|-------------|
| `__init__()` | |
| `add_route(delegate[, type, expression])` | Add delegate to the routing table |
| `connection(model, source, target[, foreground])` | Called to create the connection between ports |
| `destroy()` | |
| `get_node_layout()` | |
```
| Method Name | Description |
|-------------|-------------|
| `get_node_layout(model, node_desc)` | Called to determine the node layout |
| `node_background(model, node_desc)` | Called to create widgets of the node background |
| `node_background_v2(model, node_desc, draw_icon)` | Called to create widgets of the node background |
| `node_footer(model, node_desc)` | Called to create widgets of the bottom of the node |
| `node_header(model, node_desc)` | Called to create widgets of the top of the node |
| `node_header_input(model, node_desc)` | Called to create the left part of the header that will be used as input when the node is collapsed |
| `node_header_output(model, node_desc)` | Called to create the right part of the header that will be used as output when the node is collapsed |
| `port(model, node_desc, port_desc)` | Called to create the middle part of the port |
| `port_input(model, node_desc, port_desc)` | Called to create the left part of the port that will be used as input |
| `port_output(model, node_desc, port_desc)` | Called to create the right part of the port that will be used as output |
### `__init__()`
### `add_route(delegate: AbstractGraphNodeDelegate, type=None, expression=None)`
### Add delegate to the routing table
### connection(model, source: GraphConnectionDescription, target: GraphConnectionDescription, foreground: bool = False)
Called to create the connection between ports
### get_node_layout(model, node_desc: GraphNodeDescription)
Called to determine the node layout
### node_background(model, node_desc: GraphNodeDescription)
Called to create widgets of the node background
### node_background_v2(model, node_desc: GraphNodeDescription, draw_icon: bool)
<p>
Called to create widgets of the node background
</p>
<dt class="sig sig-object py" id="omni.kit.widget.graph.GraphNodeDelegateRouter.node_footer">
<span class="sig-name descname">
<span class="pre">
node_footer
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
model
</span>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
node_desc
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
GraphNodeDescription
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Called to create widgets of the bottom of the node
</p>
</dd>
<dt class="sig sig-object py" id="omni.kit.widget.graph.GraphNodeDelegateRouter.node_header">
<span class="sig-name descname">
<span class="pre">
node_header
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
model
</span>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
node_desc
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
GraphNodeDescription
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Called to create widgets of the top of the node
</p>
</dd>
<dt class="sig sig-object py" id="omni.kit.widget.graph.GraphNodeDelegateRouter.node_header_input">
<span class="sig-name descname">
<span class="pre">
node_header_input
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
model
</span>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
node_desc
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
GraphNodeDescription
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Called to create the left part of the header that will be used as input when the node is collapsed
</p>
</dd>
<dt class="sig sig-object py" id="omni.kit.widget.graph.GraphNodeDelegateRouter.node_header_output">
<span class="sig-name descname">
<span class="pre">
node_header_output
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
model
</span>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
node_desc
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
GraphNodeDescription
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Called to create the right part of the header that will be used as output when the node is collapsed
</p>
</dd>
<dt class="sig sig-object py" id="omni.kit.widget.graph.GraphNodeDelegateRouter.port">
<span class="sig-name descname">
<span class="pre">
port
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
model
</span>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
node_desc
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
GraphNodeDescription
</span>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
port_desc
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
GraphPortDescription
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.widget.graph.GraphNodeDelegateRouter.port">
<span class="sig-name descname">
<span class="pre">
port
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
model
</span>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
node_desc
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
GraphNodeDescription
</span>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
port_desc
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
GraphPortDescription
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Called to create the middle part of the port
</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.widget.graph.GraphNodeDelegateRouter.port_input">
<span class="sig-name descname">
<span class="pre">
port_input
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
model
</span>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
node_desc
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
GraphNodeDescription
</span>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
port_desc
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
GraphPortDescription
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Called to create the left part of the port that will be used as input
</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.widget.graph.GraphNodeDelegateRouter.port_output">
<span class="sig-name descname">
<span class="pre">
port_output
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
model
</span>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
node_desc
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
GraphNodeDescription
</span>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
port_desc
</span>
</span>
<span class="p">
<span class="pre">
:
</span>
</span>
<span class="w">
</span>
<span class="n">
<span class="pre">
GraphPortDescription
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Called to create the right part of the port that will be used as output
</p>
</dd>
</dl> |
omni.kit.widget.graph.GraphNodeDescription.md | # GraphNodeDescription
## GraphNodeDescription
```python
class omni.kit.widget.graph.GraphNodeDescription(node, connected_source=None, connected_target=None)
```
Bases: `object`
The object that holds the main attributes of the node
### Methods
```python
__init__(node, connected_source=None, connected_target=None)
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
```
# 欢迎来到我的网站
这是一个段落。
## 第二部分
这里是一些文本。
### 子标题
这里是更多的文本。 |
omni.kit.widget.graph.GraphNodeLayout.md | # GraphNodeLayout
## GraphNodeLayout
```
Bases: `Enum`
An enumeration.
### Attributes
| Attribute | Description |
|-----------|-------------|
| `LIST` | |
| `COLUMNS` | |
| `HEAP` | |
```markdown
## __init__
```
--- |
omni.kit.widget.graph.GraphPortDescription.md | # GraphPortDescription
## GraphPortDescription
```python
class omni.kit.widget.graph.GraphPortDescription(port, level, relative_position, parent_child_count, connected_source=None, connected_target=None)
```
Bases: `object`
The object that holds the main attributes of the port
### Methods
| Method | Description |
|--------|-------------|
| `__init__(port, level, relative_position, parent_child_count, connected_source=None, connected_target=None)` | |
```
None, connected_target = None) |
omni.kit.widget.graph.GraphView.md | # GraphView
## GraphView
```
class omni.kit.widget.graph.GraphView(**kwargs)
```
### Keyword Arguments:
- **kwargs**
### Description
The visualisation layer of omni.kit.widget.graph. It behaves like a regular widget and displays nodes and their connections.
### Methods
- `__init__(**kwargs)`
- ### Keyword Arguments:
- **kwargs**
- `destroy()`
- Called by extension before destroying this object.
- `filter_upstream(nodes)`
- Remove nodes that are not upstream of the given nodes
- `focus_on_nodes([nodes])`
- Focus the view on nodes
- `get_bbox_of_nodes(nodes)`
- Get the bounding box of nodes
- `layout_all()`
- Layout all nodes in the graph.
```
| Method | Description |
| --- | --- |
| layout_all() | Reset positions of all the nodes in the model |
| set_delegate(delegate) | Replace the delegate of the widget |
| set_expansion(state) | Open, close or minimize all the nodes in the model. |
| set_model(model) | Replace the model of the widget. |
| subscribe_empty_connection_drop(fn) | Return the object that will automatically unsubscribe when destroyed. |
| subscribe_post_delayed_build_layout(fn) | Return the object that will automatically unsubscribe when destroyed. |
| subscribe_pre_delayed_build_layout(fn) | Return the object that will automatically unsubscribe when destroyed. |
### Attributes
| Attribute | Description |
| --- | --- |
| DEFAULT_DISTANCE_BETWEEN_NODES | |
| model | |
| pan_x | The horizontal offset of the scene |
| pan_y | The vertical offset of the scene |
| raster_nodes | |
| selection | Return selected nodes |
| virtual_ports | Typically source connections go from the left side of the node to the right side of the node. |
| zoom | The zoom level of the scene |
| zoom_max | The maximum zoom level of the scene |
| zoom_min | The minimum zoom level of the scene |
## zoom_min
The minimum zoom level of the scene
### Keyword Arguments:
- `model GraphModel`
- Model to display the node graph
- `delegate AbstractGraphNodeDelegate`
- Delegate to draw the node
- `virtual_ports bool`
- True when the model should use reversed output for better look of the graph.
- `port_grouping bool`
- True when the widget should use sub-ports for port grouping.
- `draw_curve_top_layer bool`
- When True, connections are drawn in 2 passes. The “under” layer is for the opaque curve, and the “top” or “over” layer is meant for floating curve anchor decorations that need to be on top of all nodes, like a value display. Its curve should be drawn transparent. False by default, so both layers are not drawn.
- `allow_same_side_connections bool`
- When True, connections can happen between two input ports or two output ports. This is only used within one node. We don’t support same side connection between different nodes yet.
All other kwargs are passed to CanvasFrame which is the root widget.
## destroy
Called by extension before destroying this object. It doesn’t happen automatically. Without this hot reloading doesn’t work.
## filter_upstream
Remove nodes that are not upstream of the given nodes
## focus_on_nodes
Focus the view on nodes
## get_bbox_of_nodes
Get the bounding box of nodes
## layout_all
### omni.kit.widget.graph.GraphView.layout_all
Reset positions of all the nodes in the model
### omni.kit.widget.graph.GraphView.set_delegate
Replace the delegate of the widget
### omni.kit.widget.graph.GraphView.set_expansion
Open, close or minimize all the nodes in the model.
### omni.kit.widget.graph.GraphView.set_model
Replace the model of the widget. It will refresh all the content.
### omni.kit.widget.graph.GraphView.subscribe_empty_connection_drop
Return the object that will automatically unsubscribe when destroyed.
### omni.kit.widget.graph.GraphView.subscribe_post_delayed_build_layout
Return the object that will automatically unsubscribe when destroyed.
### omni.kit.widget.graph.GraphView.subscribe_pre_delayed_build_layout
Return the object that will automatically unsubscribe when destroyed.
### omni.kit.widget.graph.GraphView.pan_x
The horizontal offset of the scene
### omni.kit.widget.graph.GraphView.pan_y
The vertical offset of the scene
## GraphView Properties
### selection
Return selected nodes
### virtual_ports
Typically source connections go from the left side of the node to the right side of the node. But sometimes it looks messy when circular connections. When `virtual_ports` is true, and the connection is circular, the view draws it from the right side to the left side.
Example:
A.out ————-> B.surface
A.color [REVERSED] <- B.color
### zoom
The zoom level of the scene
### zoom_max
The maximum zoom level of the scene
### zoom_min
The minimum zoom level of the scene |
omni.kit.widget.graph.graph_layout.Classes.md | # omni.kit.widget.graph.graph_layout Classes
## Classes Summary
| Class Name | Description |
|------------|-------------|
| SugiyamaLayout | Compute the coordinates for drawing directed graphs following the method | |
omni.kit.widget.graph.graph_layout.md | # omni.kit.widget.graph.graph_layout
## Classes Summary
- **SugiyamaLayout**
- Compute the coordinates for drawing directed graphs following the method |
omni.kit.widget.graph.graph_layout.SugiyamaLayout.md | # SugiyamaLayout
## Overview
The `SugiyamaLayout` class is designed to compute the coordinates for drawing directed graphs following the method developed by Sugiyama. This method involves four main phases:
1. Cycle Removal
2. Layer Assignment
3. Crossing Reduction
4. Coordinate Assignment
The input for this class is a list of edges in the format: `[(vertex1, vertex2), (vertex3, vertex4), ...]`. Once the `SugiyamaLayout` object is created, it's possible to get the node layer number immediately. To get the node positions, it's necessary to set each node's size and call `update_positions`.
The implementation follows closely to the following papers:
- [1] "An Efficient Implementation of Sugiyama’s Algorithm for Layered Graph Drawing" by Eiglsperger, Siebenhaller, and Kaufmann
- [2] "Sugiyama Algorithm" by Nikolov
- [3] "Graph Drawing Algorithms in Information Visualization" by Frishman
## Methods
- `__init__(edges=[], vertical_distance=10.0, horizontal_distance=10.0)`
- `get_layer(vertex)`
The layer id of the node
get_position (vertex)
The position of the node
set_size (vertex, width, height)
Set the size of the node
update_positions ()
1. Coordinate Assignment
__init__ (edges = [], vertical_distance = 10.0, horizontal_distance = 10.0)
class Node (id)
Bases: object
Temporary node that caches all the intermediate compute data
add_upstream (node)
Add the upstream node. It will add current node to downstream as well.
get_layer (vertex)
The layer id of the node
get_position (vertex)
The position of the node
set_size (vertex, width, height)
Set the size of the node
## Node Size Setting
Set the size of the node
## Update Positions
Coordinate Assignment |
omni.kit.widget.graph.graph_model.Classes.md | # omni.kit.widget.graph.graph_model Classes
## Classes Summary:
| Class | Description |
|-------|-------------|
| [GraphModel](omni.kit.widget.graph.graph_model/omni.kit.widget.graph.graph_model.GraphModel.html) | The base class for the Graph model. | |
omni.kit.widget.graph.graph_model.GraphModel.md | # GraphModel
## GraphModel
```
class omni.kit.widget.graph.graph_model.GraphModel
```
The base class for the Graph model.
The model is the central component of the graph widget. It is the application’s dynamic data structure, independent of the user interface, and it directly manages the data. It follows closely model–view pattern. It defines the standard interface to be able to interoperate with the components of the model-view architecture. It is not supposed to be instantiated directly. Instead, the user should subclass it to create a new model.
The model manages two kinds of data elements. Node and port are the atomic data elements of the model. Both node and port can have any number of sub-ports and any number of input and output connections.
There is no specific Python type for the elements of the model. Since Python has dynamic types, the model can return any object as a node or a port. When the widget needs to get a property of the node, it provides the given node back to the model.
Example:
```python
class UsdShadeModel(GraphModel):
@property
def nodes(self, prim=None):
# Return Usd.Prim in a list
return [stage.GetPrimAtPath(selection)]
@property
def name(self, item=None):
# item here is Usd.Prim because UsdShadeModel.nodes returns
# Usd.Prim
return item.GetPath().name
# Accessing nodes and properties example
model = UsdShadeModel()
# UsdShadeModel decides the type of nodes. It's a list with Usd.Prim
nodes = model.nodes
for node in nodes:
# The node is accessed through evaluation of self[key]. It will
# return the proxy object that redirects its properties back to
# model. So the following line will call UsdShadeModel.name(node).
name = model[node].name
print(f"The model has node {name}")
```
```
| Method | Description |
| --- | --- |
| `__init__()` | |
| `can_connect(source, target)` | Return if it's possible to connect source to target |
| `destroy()` | |
| `has_nodes(obj)` | Returns true if the model can currently build the graph network using the provided object |
| `position_begin_edit(item)` | Called when the user started dragging the node |
| `position_end_edit(item)` | Called when the user finished dragging the node and released the mouse |
| `size_begin_edit(item)` | Called when the user started resizing the node |
| `size_end_edit(item)` | Called when the user finished resizing the node and released the mouse |
| `special_select_widget(node, node_widget)` | |
| `subscribe_item_changed(fn)` | Return the object that will automatically unsubscribe when destroyed. |
| `subscribe_node_changed(fn)` | Return the object that will automatically unsubscribe when destroyed. |
| `subscribe_selection_changed(fn)` | Return the object that will automatically unsubscribe when destroyed. |
### Attributes
| Attribute | Description |
| --- | --- |
| `DISPLAY_NAME` | |
| `description` | The text label that is displayed on the backdrop in the node graph. |
| `display_color` | |
| Property | Description |
|----------|-------------|
| display_color | The node color. |
| expansion_state | |
| icon | Return icon of the image |
| inputs | |
| name | The name of the item how it should be displayed in the view |
| nodes | |
| outputs | |
| ports | |
| position | Returns the position of the node |
| preview | Return the preview of the image |
| preview_state | Return the state of the preview of the node |
| selection | |
| size | The node size. |
| stacking_order | This value is a hint when an application cares about the visibility of a node and whether each node overlaps another. |
| type | |
### __init__()
### ExpansionState(value)
Bases: Enum
An enumeration.
### PreviewState(value)
<em>
<span class="sig-name descname">
<span class="pre">
PreviewState
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
value
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Bases:
<code class="xref py py-class docutils literal notranslate">
<span class="pre">
IntFlag
</span>
</code>
</p>
<p>
An enumeration.
</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.widget.graph.graph_model.GraphModel.can_connect">
<span class="sig-name descname">
<span class="pre">
can_connect
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
source
</span>
</span>
</em>
,
<em class="sig-param">
<span class="n">
<span class="pre">
target
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Return if it’s possible to connect source to target
</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.widget.graph.graph_model.GraphModel.has_nodes">
<em class="property">
<span class="pre">
static
</span>
<span class="w">
</span>
</em>
<span class="sig-name descname">
<span class="pre">
has_nodes
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
obj
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Returns true if the model can currently build the graph network using the provided object
</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.widget.graph.graph_model.GraphModel.position_begin_edit">
<span class="sig-name descname">
<span class="pre">
position_begin_edit
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
item
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Called when the user started dragging the node
</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.widget.graph.graph_model.GraphModel.position_end_edit">
<span class="sig-name descname">
<span class="pre">
position_end_edit
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
item
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Called when the user finished dragging the node and released the mouse
</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.widget.graph.graph_model.GraphModel.size_begin_edit">
<span class="sig-name descname">
<span class="pre">
size_begin_edit
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
item
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Called when the user started resizing the node
</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.widget.graph.graph_model.GraphModel.size_end_edit">
<span class="sig-name descname">
<span class="pre">
size_end_edit
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
item
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Called when the user finished resizing the node and released the mouse
</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.widget.graph.graph_model.GraphModel.subscribe_item_changed">
<span class="sig-name descname">
<span class="pre">
subscribe_item_changed
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
fn
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Return the object that will automatically unsubscribe when destroyed.
</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.widget.graph.graph_model.GraphModel.subscribe_node_changed">
<span class="sig-name descname">
<span class="pre">
subscribe_node_changed
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
fn
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Return the object that will automatically unsubscribe when destroyed.
</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.widget.graph.graph_model.GraphModel.subscribe_selection_changed">
<span class="sig-name descname">
<span class="pre">
subscribe_selection_changed
</span>
</span>
<span class="sig-paren">
(
</span>
<em class="sig-param">
<span class="n">
<span class="pre">
fn
</span>
</span>
</em>
<span class="sig-paren">
### omni.kit.widget.graph.graph_model.GraphModel.subscribe_selection_changed
- **Description**: Return the object that will automatically unsubscribe when destroyed.
### omni.kit.widget.graph.graph_model.GraphModel.description
- **Description**: The text label that is displayed on the backdrop in the node graph.
### omni.kit.widget.graph.graph_model.GraphModel.display_color
- **Description**: The node color.
### omni.kit.widget.graph.graph_model.GraphModel.icon
- **Description**: Return icon of the image
### omni.kit.widget.graph.graph_model.GraphModel.name
- **Description**: The name of the item how it should be displayed in the view
### omni.kit.widget.graph.graph_model.GraphModel.position
- **Description**: Returns the position of the node
### omni.kit.widget.graph.graph_model.GraphModel.preview
- **Description**: Return the preview of the image
### omni.kit.widget.graph.graph_model.GraphModel.preview_state
- **Description**: Return the state of the preview of the node
### omni.kit.widget.graph.graph_model.GraphModel.size
- **Description**: The node size. Is used for nodes like Backdrop.
## Property: stacking_order
This value is a hint when an application cares about the visibility of a node and whether each node overlaps another. |
omni.kit.widget.graph.graph_model.md | # omni.kit.widget.graph.graph_model
## Classes Summary
- **GraphModel**
- The base class for the Graph model. |
omni.kit.widget.graph.graph_model_batch_position_helper.Classes.md | # omni.kit.widget.graph.graph_model_batch_position_helper Classes
## Classes Summary
| Class Name | Description |
|------------|-------------|
| [GraphModelBatchPositionHelper](omni.kit.widget.graph.graph_model_batch_position_helper/omni.kit.widget.graph.graph_model_batch_position_helper.GraphModelBatchPositionHelper.html) | The model that manages batch position of the items. It can be used to manage | |
omni.kit.widget.graph.graph_model_batch_position_helper.GraphModelBatchPositionHelper.md | # GraphModelBatchPositionHelper
## GraphModelBatchPositionHelper
```python
class omni.kit.widget.graph.graph_model_batch_position_helper.GraphModelBatchPositionHelper
```
Bases: `object`
The model that manages batch position of the items. It can be used to manage the position of multi selection, backdrops and upstreams.
### Methods
- `__init__()`
- `add_get_moving_items_fn(fn)`
- Add the function that is called in batch_position_begin_edit to determine which items to move
- `batch_position_begin_edit(item)`
- Should be called from position_begin_edit to make sure position_begin_edit is called for all the selected nodes
- `batch_position_end_edit(item)`
- Should be called from position_begin_edit to make sure position_begin_edit is called for all the selected nodes
### batch_set_position (position[, item])
Should be called in the position setter to make sure the position setter is called for all the selected nodes
### Attributes
#### batch_proxy
Proxy is the isolation model.
### Methods
#### __init__()
#### add_get_moving_items_fn(fn: Callable[[Any], List[Any]])
Add the function that is called in batch_position_begin_edit to determine which items to move
#### batch_position_begin_edit(item: Any)
Should be called from position_begin_edit to make sure position_begin_edit is called for all the selected nodes
#### batch_position_end_edit(item: Any)
Should be called from position_begin_edit to make sure position_begin_edit is called for all the selected nodes
#### batch_set_position(position: List[float], item: Any)
<span class="pre">
Optional
</span>
<span class="p">
<span class="pre">
[
</span>
</span>
<span class="pre">
Any
</span>
<span class="p">
<span class="pre">
]
</span>
</span>
</span>
<span class="w">
</span>
<span class="o">
<span class="pre">
=
</span>
</span>
<span class="w">
</span>
<span class="default_value">
<span class="pre">
None
</span>
</span>
</em>
<span class="sig-paren">
)
</span>
</dt>
<dd>
<p>
Should be called in the position setter to make sure the position setter is called for all the selected nodes
</p>
</dd>
</dl>
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.widget.graph.graph_model_batch_position_helper.GraphModelBatchPositionHelper.batch_proxy">
<em class="property">
<span class="pre">
property
</span>
<span class="w">
</span>
</em>
<span class="sig-name descname">
<span class="pre">
batch_proxy
</span>
</span>
</dt>
<dd>
<p>
Proxy is the isolation model. We need it because it converts calls to input/output nodes.
</p>
</dd>
</dl>
</dd>
</dl>
</section>
</div>
</div>
<footer>
<hr/>
</footer>
</div>
</div>
</section>
</div> |
omni.kit.widget.graph.graph_model_batch_position_helper.md | # omni.kit.widget.graph.graph_model_batch_position_helper
## Classes Summary
- **GraphModelBatchPositionHelper**
- The model that manages batch position of the items. It can be used to manage |
omni.kit.widget.graph.graph_node.Classes.md | # omni.kit.widget.graph.graph_node Classes
## Classes Summary
| Class Name | Description |
|------------|-------------|
| GraphNode | Represents the Widget for the single node. Uses the model and the | |
omni.kit.widget.graph.graph_node.GraphNode.md | # GraphNode
## GraphNode
```python
class omni.kit.widget.graph.graph_node.GraphNode(model: GraphModel, item, has_input_connection, has_output_connection, ports: list, delegate)
```
Represents the Widget for the single node. Uses the model and the delegate to fill up its layout.
### Methods
| Method | Description |
|--------|-------------|
| `__init__(model, item, has_input_connection, has_output_connection, ports: list, delegate)` | Save the model, item and delegate to reuse when drawing the widget |
| `destroy()` | Called by extension before destroying this object. |
```
```python
rebuild_layout
```
()
## Attributes
| Attribute | Description |
|-----------|-------------|
| `header_frame` | Return the Frame that holds the entire header bar. |
| `header_input_frame` | Return the Frame that holds the inputs on the left side of the header bar. |
| `header_output_frame` | Return the Frame that holds the outputs on the right side of the header bar. |
| `port_center_widgets` | Return the dict for port center widgets (which contains the port name label and edit fields). |
| `ports` | |
| `selected` | Return the widget selected style state |
| `skip_draw_clipped` | Get skip_draw_when_clipped property of the root frame |
| `snapping_widgets` | |
| `user_drag` | Return the dict with the port as the key and widget that follows the mouse cursor when the user creates a connection. |
| `user_drag_placer` | Return the dict with the port as the key and placer that follows the mouse cursor when the user creates a connection. |
| `visible` | |
## Methods
### `__init__(model: GraphModel, item, has_input_connection, has_output_connection, ports: list, delegate)`
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.widget.graph.graph_node.GraphNode.__init__">
<span class="sig-name descname">
<span class="pre">
__init__
</span>
</span>
<span class="sig-paren">
(
</span>
<span class="sig-paren">
)
</span>
<a class="headerlink" href="#omni.kit.widget.graph.graph_node.GraphNode.__init__" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Save the model, item and delegate to reuse when drawing the widget
</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.widget.graph.graph_node.GraphNode.destroy">
<span class="sig-name descname">
<span class="pre">
destroy
</span>
</span>
<span class="sig-paren">
(
</span>
<span class="sig-paren">
)
</span>
<a class="headerlink" href="#omni.kit.widget.graph.graph_node.GraphNode.destroy" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Called by extension before destroying this object. It doesn’t happen automatically.
Without this hot reloading doesn’t work.
</p>
</dd>
</dl>
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.widget.graph.graph_node.GraphNode.header_frame">
<em class="property">
<span class="pre">
property
</span>
<span class="w">
</span>
</em>
<span class="sig-name descname">
<span class="pre">
header_frame
</span>
</span>
<a class="headerlink" href="#omni.kit.widget.graph.graph_node.GraphNode.header_frame" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Return the Frame that holds the entire header bar.
</p>
</dd>
</dl>
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.widget.graph.graph_node.GraphNode.header_input_frame">
<em class="property">
<span class="pre">
property
</span>
<span class="w">
</span>
</em>
<span class="sig-name descname">
<span class="pre">
header_input_frame
</span>
</span>
<a class="headerlink" href="#omni.kit.widget.graph.graph_node.GraphNode.header_input_frame" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Return the Frame that holds the inputs on the left side of the header bar.
</p>
</dd>
</dl>
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.widget.graph.graph_node.GraphNode.header_output_frame">
<em class="property">
<span class="pre">
property
</span>
<span class="w">
</span>
</em>
<span class="sig-name descname">
<span class="pre">
header_output_frame
</span>
</span>
<a class="headerlink" href="#omni.kit.widget.graph.graph_node.GraphNode.header_output_frame" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Return the Frame that holds the outputs on the right side of the header bar.
</p>
</dd>
</dl>
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.widget.graph.graph_node.GraphNode.port_center_widgets">
<em class="property">
<span class="pre">
property
</span>
<span class="w">
</span>
</em>
<span class="sig-name descname">
<span class="pre">
port_center_widgets
</span>
</span>
<a class="headerlink" href="#omni.kit.widget.graph.graph_node.GraphNode.port_center_widgets" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Return the dict for port center widgets (which contains the port name label and edit fields).
Dictionary key is the port, value is ui.Widget or None if the delegate does not return a widget
</p>
</dd>
</dl>
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.widget.graph.graph_node.GraphNode.selected">
<em class="property">
<span class="pre">
property
</span>
<span class="w">
</span>
</em>
<span class="sig-name descname">
<span class="pre">
selected
</span>
</span>
<a class="headerlink" href="#omni.kit.widget.graph.graph_node.GraphNode.selected" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Return the widget selected style state
</p>
</dd>
</dl>
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.widget.graph.graph_node.GraphNode.skip_draw_clipped">
<em class="property">
<span class="pre">
property
</span>
<span class="w">
</span>
</em>
<span class="sig-name descname">
<span class="pre">
skip_draw_clipped
</span>
</span>
<a class="headerlink" href="#omni.kit.widget.graph.graph_node.GraphNode.skip_draw_clipped" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Get skip_draw_when_clipped property of the root frame
</p>
</dd>
</dl>
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.widget.graph.graph_node.GraphNode.user_drag">
<em class="property">
<span class="pre">
property
</span>
<span class="w">
</span>
</em>
<span class="sig-name descname">
<span class="pre">
user_drag
</span>
</span>
<a class="headerlink" href="#omni.kit.widget.graph.graph_node.GraphNode.user_drag" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Return the dict with the port as the key and widget that follows the
mouse cursor when the user creates a connection.
</p>
</dd>
</dl>
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.widget.graph.graph_node.GraphNode.user_drag_placer">
<em class="property">
<span class="pre">
property
</span>
<span class="w">
</span>
</em>
<span class="sig-name descname">
<span class="pre">
user_drag_placer
</span>
</span>
<a class="headerlink" href="#omni.kit.widget.graph.graph_node.GraphNode.user_drag_placer" title="Permalink to this definition">
</a>
</dt>
<dd>
<p>
Return the dict with the port as the key and placer that follows the
mouse cursor when the user creates a connection.
</p>
</dd>
</dl> |
omni.kit.widget.graph.graph_node_delegate.Classes.md | # omni.kit.widget.graph.graph_node_delegate Classes
## Classes Summary
- **GraphNodeDelegate**
- The delegate with the Omniverse design that has both full and collapsed states. |
omni.kit.widget.graph.graph_node_delegate_closed.Classes.md | # omni.kit.widget.graph.graph_node_delegate_closed Classes
## Classes Summary
- **GraphNodeDelegateClosed**
- The delegate with the Omniverse design for the nodes of the closed state. |
omni.kit.widget.graph.graph_node_delegate_closed.GraphNodeDelegateClosed.md | # GraphNodeDelegateClosed
## GraphNodeDelegateClosed
```
class omni.kit.widget.graph.graph_node_delegate_closed.GraphNodeDelegateClosed(scale_factor=1.0)
```
Bases:
```
omni.kit.widget.graph.graph_node_delegate_full.GraphNodeDelegateFull
```
The delegate with the Omniverse design for the nodes of the closed state.
### Methods
| Method | Description |
|--------|-------------|
| __init__(scale_factor) | |
| node_footer(model, node_desc) | Called to create widgets of the bottom of the node |
| node_header(model, node_desc) | Called to create widgets of the top of the node |
| node_header_input(model, node_desc) | |
| Method | Description |
|--------|-------------|
| `node_header_input(model, node_desc)` | Called to create the left part of the header that will be used as input when the node is collapsed |
| `node_header_output(model, node_desc)` | Called to create the right part of the header that will be used as output when the node is collapsed |
| `__init__(scale_factor=1.0)` | |
| `node_footer(model, node_desc: GraphNodeDescription)` | Called to create widgets of the bottom of the node |
| `node_header(model, node_desc: GraphNodeDescription)` | Called to create widgets of the top of the node |
| `node_header_input(model, node_desc: GraphNodeDescription)` | Called to create the left part of the header that will be used as input when the node is collapsed |
| `node_header_output(model, node_desc: GraphNodeDescription)` | |
# API Reference
## Header
### `create_right_part_of_header`
Called to create the right part of the header that will be used as output when the node is collapsed |
omni.kit.widget.graph.graph_node_delegate_closed.md | # omni.kit.widget.graph.graph_node_delegate_closed
## Classes Summary:
| Class | Description |
| --- | --- |
| [GraphNodeDelegateClosed](omni.kit.widget.graph.graph_node_delegate_closed/omni.kit.widget.graph.graph_node_delegate_closed.GraphNodeDelegateClosed.html) | The delegate with the Omniverse design for the nodes of the closed state. | |
omni.kit.widget.graph.graph_node_delegate_full.Classes.md | # omni.kit.widget.graph.graph_node_delegate_full Classes
## Classes Summary
- **GraphNodeDelegateFull**
- The delegate with the Omniverse design. |
omni.kit.widget.graph.graph_node_delegate_full.color_to_hex.md | # color_to_hex
## color_to_hex
Convert float rgb to int
### Function Definition
```python
omni.kit.widget.graph.graph_node_delegate_full.color_to_hex(color: tuple) -> int
```
``` |
omni.kit.widget.graph.graph_node_delegate_full.Functions.md | # omni.kit.widget.graph.graph_node_delegate_full Functions
## Functions Summary
- **color_to_hex**
- Convert float rgb to int |
omni.kit.widget.graph.graph_node_delegate_full.GraphNodeDelegateFull.md | # GraphNodeDelegateFull
## GraphNodeDelegateFull
```python
class omni.kit.widget.graph.graph_node_delegate_full.GraphNodeDelegateFull(scale_factor=1.0)
```
Bases: `AbstractGraphNodeDelegate`
The delegate with the Omniverse design.
### Methods
```python
__init__(scale_factor=1.0)
```
```python
connection(model, source, target, foreground)
```
Called to create the connection between ports
```python
node_background(model, node_desc)
```
Called to create widgets of the node background
```python
node_footer(model, node_desc)
```
```
| Method | Description |
|--------|-------------|
| `node_footer(model, node_desc)` | Called to create widgets of the bottom of the node |
| `node_header(model, node_desc)` | Called to create widgets of the top of the node |
| `node_header_input(model, node_desc)` | Called to create the left part of the header that will be used as input when the node is collapsed |
| `node_header_output(model, node_desc)` | Called to create the right part of the header that will be used as output when the node is collapsed |
| `port(model, node_desc, port_desc)` | Called to create the middle part of the port |
| `port_input(model, node_desc, port_desc)` | Called to create the left part of the port that will be used as input |
| `port_output(model, node_desc, port_desc)` | Called to create the right part of the port that will be used as output |
### `__init__(scale_factor=1.0)`
### `connection(model, source: GraphConnectionDescription, target: GraphConnectionDescription, foreground: bool = False)`
Called to create the connection between ports
### node_background
Called to create widgets of the node background
### node_footer
Called to create widgets of the bottom of the node
### node_header
Called to create widgets of the top of the node
### node_header_input
Called to create the left part of the header that will be used as input when the node is collapsed
### node_header_output
Called to create the right part of the header that will be used as output when the node is collapsed
### port
### GraphNodeDelegateFull Methods
#### port
```python
def port(model, node_desc: GraphNodeDescription, port_desc: GraphPortDescription):
pass
```
Called to create the middle part of the port
#### port_input
```python
def port_input(model, node_desc: GraphNodeDescription, port_desc: GraphPortDescription):
pass
```
Called to create the left part of the port that will be used as input
#### port_output
```python
def port_output(model, node_desc: GraphNodeDescription, port_desc: GraphPortDescription):
pass
```
Called to create the right part of the port that will be used as output |
omni.kit.widget.graph.graph_node_delegate_full.md | # omni.kit.widget.graph.graph_node_delegate_full
## Classes Summary
- **GraphNodeDelegateFull**
- The delegate with the Omniverse design.
## Functions Summary
- **color_to_hex**
- Convert float rgb to int |
omni.kit.widget.graph.graph_node_delegate_router.Classes.md | # omni.kit.widget.graph.graph_node_delegate_router Classes
## Classes Summary
| Class Name | Description |
|------------|-------------|
| GraphNodeDelegateRouter | The delegate that keeps multiple delegates and pick them depending on the |
| GraphNodeDelegateRoutingError | This exception is used when it’s not possible to do routing. Can only |
| RoutingCondition | RoutingCondition(type, expression, delegate) | |
omni.kit.widget.graph.graph_node_delegate_router.GraphNodeDelegateRouter.md | # GraphNodeDelegateRouter
## GraphNodeDelegateRouter
Bases: `AbstractGraphNodeDelegate`
The delegate that keeps multiple delegates and pick them depending on the routing conditions.
It’s possible to add the routing conditions with `add_route`, and conditions could be a type or a lambda expression.
The latest added routing is stronger than previously added. Routing added without conditions is the default.
We use type routing to make the specific kind of nodes unique, and also we can use the lambda function to make the particular state of nodes unique (ex. full/collapsed).
It’s possible to use type and lambda routing at the same time.
Usage examples:
```
delegate.add_route(TextureDelegate(), type="Texture2d")
delegate.add_route(CollapsedDelegate(), expression=is_collapsed)
```
### Methods
- `__init__()`
- `add_route(delegate[, type, expression])`
- Add delegate to the routing table
- `connection(model, source, target[, foreground])`
| Method | Description |
|--------|-------------|
| `create` | Called to create the connection between ports |
| `destroy()` | |
| `get_node_layout(model, node_desc)` | Called to determine the node layout |
| `node_background(model, node_desc)` | Called to create widgets of the node background |
| `node_background_v2(model, node_desc, draw_icon)` | Called to create widgets of the node background |
| `node_footer(model, node_desc)` | Called to create widgets of the bottom of the node |
| `node_header(model, node_desc)` | Called to create widgets of the top of the node |
| `node_header_input(model, node_desc)` | Called to create the left part of the header that will be used as input when the node is collapsed |
| `node_header_output(model, node_desc)` | Called to create the right part of the header that will be used as output when the node is collapsed |
| `port(model, node_desc, port_desc)` | Called to create the middle part of the port |
| `port_input(model, node_desc, port_desc)` | Called to create the left part of the port that will be used as input |
| `port_output(model, node_desc, port_desc)` | Called to create the right part of the port that will be used as output |
### `__init__()`
### `add_route(delegate:)`
### AbstractGraphNodeDelegate
### type = None
### expression = None
Add delegate to the routing table
### connection(model, source: GraphConnectionDescription, target: GraphConnectionDescription, foreground: bool = False)
Called to create the connection between ports
### get_node_layout(model, node_desc: GraphNodeDescription)
Called to determine the node layout
### node_background(model, node_desc: GraphNodeDescription)
Called to create widgets of the node background
### node_background_v2(model, node_desc: GraphNodeDescription)
### node_background_v2(model, node_desc: GraphNodeDescription, draw_icon: bool)
Called to create widgets of the node background
### node_footer(model, node_desc: GraphNodeDescription)
Called to create widgets of the bottom of the node
### node_header(model, node_desc: GraphNodeDescription)
Called to create widgets of the top of the node
### node_header_input(model, node_desc: GraphNodeDescription)
Called to create the left part of the header that will be used as input when the node is collapsed
### node_header_output(model, node_desc: GraphNodeDescription)
Called to create the right part of the header that will be used as output when the node is collapsed
### port(model, node_desc: GraphNodeDescription)
### GraphNodeDelegateRouter Methods
#### port
```python
def port(node_desc: GraphNodeDescription, port_desc: GraphPortDescription):
...
```
Called to create the middle part of the port.
#### port_input
```python
def port_input(model, node_desc: GraphNodeDescription, port_desc: GraphPortDescription):
...
```
Called to create the left part of the port that will be used as input.
#### port_output
```python
def port_output(model, node_desc: GraphNodeDescription, port_desc: GraphPortDescription):
...
```
Called to create the right part of the port that will be used as output. |
omni.kit.widget.graph.graph_node_delegate_router.GraphNodeDelegateRoutingError.md | # GraphNodeDelegateRoutingError
## GraphNodeDelegateRoutingError
This exception is used when it’s not possible to do routing. Can only happen if there is no default route in the table.
### __init__(*args, **kwargs) |
Subsets and Splits