FilePickerView#

class omni.kit.window.filepicker.FilePickerView(title: str, **kwargs)#

Bases: object

An embeddable UI component for browsing the filesystem. This widget is more full-functioned than FileBrowserWidget` but less so than :obj:`FilePickerWidget. More specifically, this is one of the 3 sub-components of its namesake FilePickerWidget. The difference is it doesn’t have the Browser Bar (at top) or the File Bar (at bottom). This gives users the flexibility to substitute in other surrounding components instead.

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.

  • show_grid_view (bool) – Display grid view in the intial layout. Default True.

  • show_recycle_widget (bool) – Display recycle widget in the intial layout. 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.

  • show_only_collections (list[str]) – List of collections to display, any combination of [“bookmarks”, “omniverse”, “my-computer”]. If None, then all are displayed. Default None.

  • tooltip (bool) – Display tooltips when hovering over items. Default True.

  • allow_multi_selection (bool) – Allow multiple items to be selected at once. Default False.

  • mouse_pressed_fn (Callable) – Function called on mouse press. Function signature: void mouse_pressed_fn(pane: int, button: int, key_mode: int, item: FileBrowserItem)

  • 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)

  • selection_changed_fn (Callable) – Function called when selection changed. Function signature: void selection_changed_fn(pane: int, selections: list[FileBrowserItem])

  • drop_handler (Callable) – Function called to handle drag-n-drops. Function signature: void drop_fn(dst_item: FileBrowserItem, src_paths: [str])

  • item_filter_fn (Callable) – This handler should return True if the given tree view item is visible, False otherwise. Function signature: bool item_filter_fn(item: FileBrowserItem)

  • 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).

  • icon_provider (Callable) – This callback provides an icon to replace the default in the tree view. Signature str icon_provider(item: FileBrowserItem)

  • badges_provider (Callable) – This callback provides the list of badges to layer atop the thumbnail in the grid view. Callback signature: [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_bookmark(name, path[, is_folder, ...])

Creates a FileBrowserModel rooted at the given path, and connects its subtree to the tree view.

add_collection(collection_data)

add_custom_collection(collection_data)

add_server(name, path[, server_type, ...])

Creates a FileBrowserModel rooted at the given path, and connects its subtree to the tree view.

all_collection_items([collection])

Returns all connections as items for the specified collection.

delete_bookmark(item[, publish_event])

Deletes the given bookmark.

delete_server(item[, publish_event])

Disconnects the subtree rooted at the given item.

deregister_collection_item(collection_item)

Deregister a collection item from the file picker.

destroy()

Destructor

get_connection_with_url(url)

Gets the connection item with the given url.

get_root([pane])

Returns the root item of the specified pane.

get_selections([pane])

Returns list of currently selected items.

has_connection_with_name(name[, collection])

Returns True if named connection exists within the collection.

hide_notification()

Utility to hide the notification frame.

is_bookmark(item[, path])

Returns true if given item is a bookmarked item, or if a given path is bookmarked.

is_collection_node(item)

Returns true if given item is a collection node.

is_collection_root([url])

Returns True if the given url is a collection root url.

is_connected(url)

Check if a server is connected.

is_connection_point(item)

Returns true if given item is a direct child of a collection node.

is_local_point(item)

Returns true if given item is a direct child of a my-computer's node.

log_out_server(item)

Log out from the server at the given path.

mount_user_folders(folders)

Mounts given set of user folders under the local collection.

reconnect_server(item)

Reconnects the server at the given path.

refresh_ui([item])

Redraws the subtree rooted at the given item.

register_collection_item(collection_item)

Register a collection item to the file picker.

remove_collection(collection_id)

rename_bookmark(item, new_name, new_url[, ...])

Renames the bookmark item.

rename_server(item, new_name[, publish_event])

Renames the connection item.

scale_grid_view(scale)

Scale file picker's grid view icon size.

select_and_center(item)

Selects and centers the view on the given item, expanding the tree if needed.

set_item_filter_fn(item_filter_fn)

Sets the item filter function.

set_selections(selections[, pane])

Selected given items in given pane.

show_connect_dialog(item)

Displays the add connection dialog.

show_model(model)

Displays the model on the right side of the split pane

show_notification()

Utility to show the notification frame.

toggle_grid_view(show_grid_view)

Toggles file picker between grid and list view.

Attributes

collections

Dictionary of collections, e.g. 'bookmarks', 'omniverse', 'my-computer'.

filebrowser

Gets the filebrowser of this view.

navigation_model

Gets the navigation model of this view.

notification_frame

The notification frame.

show_grid_view

Gets file picker stage of grid or list view.

show_only_collections

Gets the collections list only to show.

show_udim_sequence

Whether or not to show UDIM sequence.

__init__(title: str, **kwargs)#
add_bookmark(
name: str,
path: str,
is_folder: bool = True,
publish_event: bool = True,
) BookmarkItem#

Creates a FileBrowserModel rooted at the given path, and connects its subtree to the tree view.

Parameters:
  • name (str) – Name of the bookmark.

  • path (str) – Fullpath of the connection, e.g. “omniverse://ov-content”. Paths to Omniverse servers should contain the prefix, “omniverse://”.

  • is_folder (bool) – If the item to be bookmarked is a folder or not. Default to True.

  • publish_event (bool) – If True, push a notification to the event stream.

Returns:

BookmarkItem

add_server(
name: str,
path: str,
server_type: str | None = None,
publish_event: bool = True,
auto_select: bool = True,
) FileBrowserModel#

Creates a FileBrowserModel rooted at the given path, and connects its subtree to the tree view.

Parameters:
  • name (str) – Name, label really, of the connection.

  • path (str) – Fullpath of the connection, e.g. “omniverse://ov-content”. Paths to Omniverse servers should contain the prefix, “omniverse://”.

  • publish_event (bool) – If True, push a notification to the event stream.

Returns:

FileBrowserModel

Raises:

RuntimeWarning – If unable to add server.

all_collection_items(
collection: str = None,
) List[FileBrowserItem]#

Returns all connections as items for the specified collection. If collection is ‘None’, then return connections from all collections.

Parameters:

collection (str) – One of [‘bookmarks’, ‘omniverse’, ‘my-computer’]. Default None.

Returns:

All connections found.

Return type:

List[FileBrowserItem]

delete_bookmark(
item: BookmarkItem,
publish_event: bool = True,
) bool#

Deletes the given bookmark.

Parameters:
  • item (FileBrowserItem) – Bookmark item.

  • publish_event (bool) – If True, push a notification to the event stream.

delete_server(
item: FileBrowserItem,
publish_event: bool = True,
)#

Disconnects the subtree rooted at the given item.

Parameters:
  • item (FileBrowserItem) – Root of subtree to disconnect.

  • publish_event (bool) – If True, push a notification to the event stream.

deregister_collection_item(
collection_item: CollectionItem,
) bool#

Deregister a collection item from the file picker.

Parameters:

collection_item (CollectionItem) – The collection item to deregister.

Returns:

True if the collection item was deregistered, False otherwise.

Return type:

bool

destroy()#

Destructor

get_connection_with_url(
url: str,
) NucleusConnectionItem | None#

Gets the connection item with the given url.

Parameters:

name (str) – name (could be aliased name) of connection

Returns:

NucleusConnectionItem

get_root(
pane: int = None,
) FileBrowserItem#

Returns the root item of the specified pane.

Parameters:

pane (int) – One of {TREEVIEW_PANE, LISTVIEW_PANE}.

get_selections(
pane: int = 2,
) List[FileBrowserItem]#

Returns list of currently selected items.

Parameters:

pane (int) – One of {TREEVIEW_PANE, LISTVIEW_PANE}.

Returns:

list[FileBrowserItem]

has_connection_with_name(
name: str,
collection: str = None,
) bool#

Returns True if named connection exists within the collection.

Parameters:
  • name (str) – name (could be aliased name) of connection

  • collection (str) – One of {‘bookmarks’, ‘omniverse’, ‘my-computer’}. Default None.

Returns:

bool

hide_notification()#

Utility to hide the notification frame.

is_bookmark(
item: FileBrowserItem,
path: str | None = None,
) bool#

Returns true if given item is a bookmarked item, or if a given path is bookmarked.

Parameters:
  • item (FileBrowserItem) – Item in question.

  • path (Optional[str]) – Path in question.

Returns:

bool

is_collection_node(
item: FileBrowserItem,
) bool#

Returns true if given item is a collection node.

Parameters:

item (FileBrowserItem) – Item in question.

Returns:

bool

is_collection_root(url: str = None) bool#

Returns True if the given url is a collection root url.

Parameters:

url (str) – The url to query. Default None.

Returns:

The result.

Return type:

bool

static is_connected(url: str) bool#

Check if a server is connected.

Parameters:

url – The url of the server

Returns:

True if the server is connected, False if not

is_connection_point(
item: FileBrowserItem,
) bool#

Returns true if given item is a direct child of a collection node.

Parameters:

item (FileBrowserItem) – Item in question.

Returns:

bool

is_local_point(
item: FileBrowserItem,
) bool#

Returns true if given item is a direct child of a my-computer’s node.

Parameters:

item (FileBrowserItem) – Item in question.

Returns:

bool

log_out_server(
item: NucleusConnectionItem,
)#

Log out from the server at the given path.

Parameters:

item (NucleusConnectionItem) – Connection item.

mount_user_folders(folders: dict)#

Mounts given set of user folders under the local collection.

Parameters:

folders (dict) – Name, path pairs.

reconnect_server(
item: FileBrowserItem,
)#

Reconnects the server at the given path. Clears out any cached authentication tokens to force the action.

Parameters:

item (FileBrowserItem) – Connection item.

refresh_ui(
item: FileBrowserItem = None,
)#

Redraws 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.

register_collection_item(
collection_item: CollectionItem,
) bool#

Register a collection item to the file picker.

Parameters:

collection_item (CollectionItem) – The collection item to register.

Returns:

True if the collection item was registered, False otherwise.

Return type:

bool

rename_bookmark(
item: BookmarkItem,
new_name: str,
new_url: str,
publish_event: bool = True,
)#

Renames the bookmark item. Note: doesn’t change the connection itself, only how it’s labeled in the tree view.

Parameters:
  • item (FileBrowserItem) – Bookmark item.

  • new_name (str) – New name.

  • new_url (str) – New url address.

  • publish_event (bool) – If True, push a notification to the event stream.

rename_server(
item: FileBrowserItem,
new_name: str,
publish_event: bool = True,
)#

Renames the connection item. Note: doesn’t change the connection itself, only how it’s labeled in the tree view.

Parameters:
  • item (FileBrowserItem) – Root of subtree to disconnect.

  • new_name (str) – New name.

  • publish_event (bool) – If True, push a notification to the event stream.

scale_grid_view(scale: float)#

Scale file picker’s grid view icon size.

Parameters:

scale (float) – Scale of the icon.

select_and_center(
item: FileBrowserItem,
)#

Selects and centers the view on the given item, expanding the tree if needed.

Parameters:

item (FileBrowserItem) – The selected item.

set_item_filter_fn(
item_filter_fn: Callable[[str], bool],
)#

Sets the item filter function.

Parameters:

item_filter_fn (Callable) – Signature is bool fn(item: FileBrowserItem)

set_selections(
selections: List[FileBrowserItem],
pane: int = 1,
)#

Selected given items in given pane.

Parameters:
  • selections (list[FileBrowserItem]) – list of selections.

  • pane (int) – One of TREEVIEW_PANE, LISTVIEW_PANE, or None for both. Default None.

show_connect_dialog(
item: AddNewCollection | None,
) None#

Displays the add connection dialog.

show_model(
model: FileBrowserModel,
)#

Displays the model on the right side of the split pane

show_notification()#

Utility to show the notification frame.

toggle_grid_view(show_grid_view: bool)#

Toggles file picker between grid and list view.

Parameters:

show_grid_view (bool) – True to show grid view, False to show list view.

property collections#

Dictionary of collections, e.g. ‘bookmarks’, ‘omniverse’, ‘my-computer’.

Type:

dict

property filebrowser#

Gets the filebrowser of this view.

property navigation_model: NavigationModel | None#

Gets the navigation model of this view.

property notification_frame#

The notification frame.

property show_grid_view#

Gets file picker stage of grid or list view.

Returns:

True if grid view shown or False if list view shown.

Return type:

bool

property show_only_collections#

Gets the collections list only to show.

property show_udim_sequence#

Whether or not to show UDIM sequence.