omni.flux.content_viewer.widget#

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

  • SPDX-License-Identifier: Apache-2.0

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

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

  • You may obtain a copy of the License at

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

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

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

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

  • See the License for the specific language governing permissions and

  • limitations under the License.

pydantic model omni.flux.content_viewer.widget.core.BaseContentData#

Bases: BaseModel

Show JSON schema
{
   "title": "BaseContentData",
   "type": "object",
   "properties": {
      "title": {
         "title": "Title",
         "type": "string"
      },
      "path": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "title": "Path"
      }
   },
   "required": [
      "title",
      "path"
   ]
}

Fields:
field path: str | None [Required]#
field title: str [Required]#
pydantic model omni.flux.content_viewer.widget.core.ContentData#

Bases: BaseContentData

Schema of options

Show JSON schema
{
   "title": "ContentData",
   "type": "object",
   "properties": {
      "title": {
         "title": "Title",
         "type": "string"
      },
      "path": {
         "title": "Path",
         "type": "string"
      },
      "image_path_fn": {
         "default": null,
         "title": "Image Path Fn"
      },
      "checkpoint_version": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Checkpoint Version"
      },
      "original_path": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Original Path"
      }
   },
   "required": [
      "title",
      "path"
   ]
}

Config:
  • validate_assignment: bool = True

Fields:
Validators:
field checkpoint_version: int | None = None#
Validated by:
field image_path_fn: Callable[[], str] | None = None#
Validated by:
field original_path: str | None = None#
Validated by:
field path: str [Required]#
Validated by:
validator inject_checkpoint_version  »  all fields#
is_checkpointed() bool#
pydantic model omni.flux.content_viewer.widget.core.ContentDataAdd#

Bases: BaseContentData

Schema of options

Show JSON schema
{
   "title": "ContentDataAdd",
   "type": "object",
   "properties": {
      "title": {
         "title": "Title",
         "type": "string"
      },
      "path": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "title": "Path"
      },
      "image_path_fn": {
         "default": null,
         "title": "Image Path Fn"
      }
   },
   "required": [
      "title",
      "path"
   ]
}

Fields:
field image_path_fn: Callable[[], str] | None = functools.partial(<function get_icons>, 'add')#
class omni.flux.content_viewer.widget.core.ContentViewerCore#

Bases: object

property default_attr#

Attribute that will be set an destroyed

destroy()#
get_current_content()#
get_selection() List[Type[BaseContentData]]#

Get the current selection

is_selection_blocked()#
abstract property name: str#

Name of the core

primary_thumbnail_loaded(path, thumbnail_path)#

Call the event object that has the list of functions

refresh_content()#

Refresh the list of content

set_block_selection(value)#
set_item_was_clicked(value)#
set_selection(
content_data: BaseContentData | None,
append: bool = False,
append_in_between: bool = False,
)#

Set the selected content

subscribe_content_changed(function)#

Return the object that will automatically unsubscribe when destroyed.

subscribe_error_get_data(function)#

Return the object that will automatically unsubscribe when destroyed.

subscribe_primary_thumbnail_loaded(function)#

Return the object that will automatically unsubscribe when destroyed.

subscribe_selection_changed(function)#

Return the object that will automatically unsubscribe when destroyed.

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

  • SPDX-License-Identifier: Apache-2.0

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

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

  • You may obtain a copy of the License at

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

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

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

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

  • See the License for the specific language governing permissions and

  • limitations under the License.

class omni.flux.content_viewer.widget.items.BaseContentItem(
content_data: Type[BaseContentData],
core: Type[ContentViewerCore],
grid_column_width: int,
grid_row_height: int,
grid_root_frame: Widget,
list_mode: bool = False,
)#

Bases: AbstractItem

Base item to use to show an item in the grid or list view

property default_attr: Dict[str, Any]#

Default attribute with default values created in the class that will be destroyed during closing

destroy()#
get_current_grid_scale_size() int#

Get the current grid scale size

get_grid_row_height() int#

Get the grid row height

get_list_root_frames() Dict[str, Frame]#

Get the root frames that the list view use when we scale it

get_list_root_labels() Dict[str, Label]#

Get the root labels that the list view use when we scale it

is_selected() bool#

Tell is th e item is selected

abstract on_mouse_clicked(x, y, b, m)#

Called when the item is clicked on

on_mouse_moved(x, y, b, m)#

Called when the mouse is moved

on_mouse_released(x, y, b, m)#

Called when the mouse is released

on_resized_grid(grid_scale_size: int)#

Called when the grid is resized

Parameters:

grid_scale_size – the scale value of the grid

set_list_root_frames(
value: Dict[str, Frame],
)#

Save frames that will be resized when the scale of the list view change

Parameters:

value – the name of the frame as a key, the ui.Frame as a value

set_list_root_labels(
value: Dict[str, Label],
)#

Save labels that will be resized when the scale of the list view change

Parameters:

value – the name of the label as a key, the ui.Label as a value

set_selected(value: bool)#

Set the item selected or not

Parameters:

value – the selection value

class omni.flux.content_viewer.widget.items.ContentItem(
content_data: Type[ContentData],
core,
grid_column_width,
grid_row_height,
grid_root_frame,
list_mode=False,
)#

Bases: BaseContentItem

Content Item. This is an item that you can use to show any data that has a path

CAN_CHOSE_CHECKPOINT = False#

Instance

DRAG = False#

Say if we would be able to drag the item

MULTI_SELECTION = True#

Say if we would be able to select another item when this one is already selected

NO_FONT_SIZE = 14#

The size of the label that will be shown when the content doesn’t exist

TITLE_FONT_SIZE = 14#

The size of the label that will be shown as a title (bottom of the item)

property default_attr#

Default attribute with default values created in the class that will be destroyed during closing

destroy()#
get_current_checkpoint() ListEntry | None#

Get the current checkpoint version

async is_usd_path_valid(
callback: Callable[[bool], Any],
)#

Check is the path exist or not

Parameters:

callback – the function that will be called after the path it checked

on_mouse_clicked(x, y, b, m)#

Called when the item is clicked on

on_mouse_moved(x, y, b, m)#

Called when the mouse is moved

on_mouse_released(x, y, b, m)#

Called when the mouse is released

set_selected(value: bool)#

Set the item selected or not

Parameters:

value – the selection value

class omni.flux.content_viewer.widget.items.ContentItemAdd(
content_data: Type[ContentDataAdd],
core: Type[ContentViewerCore],
grid_column_width: int,
grid_row_height: int,
grid_root_frame: Widget,
list_mode: bool = False,
)#

Bases: BaseContentItem

Content Item Add. This is an item that you can use to “Add” data

NO_FONT_SIZE = 14#

The size of the label that will be shown when the content doesn’t exist

TITLE_FONT_SIZE = 14#

Instance

destroy()#
on_mouse_clicked(x, y, b, m)#

Called when the item is clicked on

on_mouse_moved(x, y, b, m)#

Called when the mouse is moved

on_mouse_released(x, y, b, m)#

Called when the mouse is released

set_selected(value: bool)#

Set the item selected or not

Parameters:

value – the selection value

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

  • SPDX-License-Identifier: Apache-2.0

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

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

  • You may obtain a copy of the License at

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

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

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

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

  • See the License for the specific language governing permissions and

  • limitations under the License.

class omni.flux.content_viewer.widget.setup_ui.ContentViewerWidget(core: ContentViewerCore)#

Bases: object

Widget that let show any data into a grid view or a list view

CONTENT_ITEM_TYPE#

Height of the slider

alias of ContentItem

ENABLE_ADD_ITEM: bool = False#

Height of the column of the grid view

GRID_COLUMN_WIDTH: int = 110#

Show the slider to resize the view or refresh the content

GRID_ROW_HEIGHT: int = 120#

Value that will smooth the slide that will scale the view

HEIGHT_BACKGROUND_SLIDER: int = 60#

Delegate of the list view

LIST_DELEGATE_TREE_VIEW#

Width of the column of the grid view

alias of Delegate

LIST_ROW_HEIGHT: int = 36#

Width of the slider

LIST_VIEW_MODE: bool = False#

Show the view as a list or not by default

SHOW_REFRESH_AND_SLIDER: bool = True#

Class that will be used as an item

SLIDER_SMOOTHER: int = 2#

Instance

WIDTH_BACKGROUND_SLIDER: int = 100#

Height of the row of the list view

property default_attr: Dict[str, Any]#

Default attribute with default values created in the class that will be destroyed during closing

destroy()#
filter_content(text: str | None)#

Filter the content with this text and refresh the view

Parameters:

text – This text will be used as an arg for the _filter_fn() method

get_content_items() List[Type[BaseContentItem]]#

Get all content items

set_filter_content_title_value(text: str | None)#

Set the value text.

Parameters:

text – This text will be used as an arg for the _filter_fn() method

set_list_view_mode(value: bool)#

Set the view as a list

Parameters:

value – show as a list or not

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

  • SPDX-License-Identifier: Apache-2.0

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

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

  • You may obtain a copy of the License at

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

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

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

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

  • See the License for the specific language governing permissions and

  • limitations under the License.

class omni.flux.content_viewer.widget.thumbnail_core.ThumbnailCore#

Bases: object

THUMBNAILS_DIR = 'custom_thumbnails'#
get_additional_thumbnail(path) List[str]#

Get additional thumbnails from the current asset

get_primary_thumbnails(path) str#

Get the primary thumbnail from the current asset

static list_entries_custom_thumbnails_dir(
custom_thumbnails_dir,
)#

List entries

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

  • SPDX-License-Identifier: Apache-2.0

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

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

  • You may obtain a copy of the License at

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

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

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

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

  • See the License for the specific language governing permissions and

  • limitations under the License.

class omni.flux.content_viewer.widget.tree_delegate.Delegate#

Bases: AbstractItemDelegate

build_branch(model, item, column_id, level, expanded)#

Create a branch widget that opens or closes subtree

build_header(column_id)#

Build the header

build_widget(model, item, column_id, level, expanded)#

Create a widget per item

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

  • SPDX-License-Identifier: Apache-2.0

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

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

  • You may obtain a copy of the License at

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

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

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

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

  • See the License for the specific language governing permissions and

  • limitations under the License.

class omni.flux.content_viewer.widget.tree_model.Model#

Bases: AbstractItemModel

List model

destroy()#
get_item_children(item)#

Returns all the children when the widget asks it.

get_item_value_model(item, column_id)#

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

get_item_value_model_count(item)#

The number of columns

refresh(items: List[Type[BaseContentItem]])#

Refresh the list with those items

Parameters:

items – the items

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

  • SPDX-License-Identifier: Apache-2.0

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

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

  • You may obtain a copy of the License at

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

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

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

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

  • See the License for the specific language governing permissions and

  • limitations under the License.

async omni.flux.content_viewer.widget.utils.is_path_readable(path: str)#

Check is a path is readable

Parameters:

path – the path to check