omni.kit.window.filepicker

Kit Filepicker Dialog and embeddable Widget.

This Kit extension provides both a popup dialog as well as an embeddable widget that you can add to your code for browsing the filesystem. Incorporates BrowserBarWidget and FileBrowserWidget into a general-purpose utility. The filesystem can either be from your local machine or the Omniverse server.

Example

With just a few lines of code, you can create a ready-made dialog window. Then, customize it by setting any number of attributes.

filepicker = FilePickerDialog(

“my-filepicker”, apply_button_label=”Open”, click_apply_handler=on_click_open, click_cancel_handler=on_click_cancel )

filepicker.show()

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

A popup window for browsing the filesystem and taking action on a selected file. Includes a browser bar for keyboard input with auto-completion for navigation of the tree view. For similar but different options, see also FilePickerWidget and FilePickerView.

Parameters

title (str) – Window title. Default None.

Keyword Arguments
  • width (int) – Window width. Default 1000.

  • height (int) – Window height. Default 600.

  • click_apply_handler (Callable) – Function that will be called when the user accepts the selection. Function signature: void apply_handler(file_name: str, dir_name: str).

  • click_cancel_handler (Callable) – Function that will be called when the user clicks the cancel button. Function signature: void cancel_handler(file_name: str, dir_name: str).

  • other – Additional args listed for FilePickerWidget

add_connections(connections: dict)

Adds specified server connections to the browser.

Parameters

connections (dict) – A dictionary of name, path pairs. For example: {“C:”: “C:”, “ov-content”: “omniverse://ov-content”}. Paths to Omniverse servers should be prefixed with “omniverse://”.

add_detail_frame_from_controller(name: str, controller: omni.kit.window.filepicker.detail_view.DetailFrameController)

Adds subsection to the detail view, and populate it with a custom built widget.

Parameters
  • name (str) – Name of the widget sub-section, this name must be unique over all detail sub-sections.

  • controller (DetailFrameController) – Controller object that encapsulates all aspects of creating, updating, and deleting a detail frame widget.

Returns

Handle to created widget.

Return type

ui.Widget

property current_filter_option

Index of current filter option, range 0 .. num_filter_options.

Type

int

delete_detail_frame(name: str)

Deletes the named detail frame.

Parameters

name (str) – Name of the frame.

destroy()

Destructor.

get_current_directory()str

Returns the current directory from the browser bar.

Returns

The system path, which may be different from the displayed path.

Return type

str

get_current_selections(pane: int = 2)List[str]

Returns current selected as list of system path names.

Parameters

pane (int) – Specifies pane to retrieve selections from, one of {TREEVIEW_PANE = 1, LISTVIEW_PANE = 2, BOTH = None}. Default LISTVIEW_PANE.

Returns

List of system paths (which may be different from displayed paths, e.g. bookmarks)

Return type

[str]

get_file_extension()str
Returns

Currently selected filename extension.

Return type

str

get_file_postfix()str
Returns

Currently selected postfix.

Return type

str

get_file_postfix_options()List[str]
Returns

List of all postfix strings.

Return type

List[str]

get_filebar_label_name()str
Returns

Currently text of name label for file bar.

Return type

str

get_filename()str
Returns

Currently selected filename.

Return type

str

hide()

Hides this dialog. Automatically called when “Cancel” buttons is clicked.

navigate_to(path: str)

Navigates to a path, i.e. the path’s parent directory will be expanded and leaf selected.

Parameters

path (str) – The path to navigate to.

refresh_current_directory()

Refreshes the current directory set in the browser bar.

set_click_apply_handler(click_apply_handler: Callable[[str, str], None])

Sets the function to execute upon clicking apply.

Parameters

click_apply_handler (Callable) – Signature is void fn(filename: str, dirname: str)

set_current_directory(path: str)

Procedurally sets the current directory path.

Parameters

path (str) – The full path name of the folder, e.g. “omniverse://ov-content/Users/me.

Raises

RuntimeWarning – If path doesn’t exist or is unreachable.

set_filebar_label_name(name: str)

Sets the text of the name label for filebar, at the bottom of dialog.

Parameters
  • name (str) – By default, it’s “File name” if it’s not set. For some senarios that,

  • only allows to choose folder (it) –

  • can be configured with this API for better UX. (it) –

set_filename(filename: str)

Sets the filename in the file bar, at bottom of the dialog.

Parameters

filename (str) – The filename only (and not the fullpath), e.g. “myfile.usd”.

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_search_delegate(delegate: omni.kit.window.filepicker.search_delegate.SearchDelegate)

Sets a custom search delegate for the tool bar.

Parameters

delegate (SearchDelegate) – Object that creates the search widget.

set_visibility_changed_listener(listener: Callable[[bool], None])

Call the given handler when window visibility is changed.

Parameters

listener (Callable) – Handler with signature listener[visible: bool).

show(path: Optional[str] = None)

Shows this dialog. Currently pops up atop all other windows but is not completely modal, i.e. does not take over input focus.

Parameters

path (str) – If optional path is specified, then navigates to it upon startup.

show_model(model: omni.kit.widget.filebrowser.model.FileBrowserModel)

Displays the given model in the list view, overriding the default model. For example, this model might be the result of a search.

Parameters

model (FileBrowserModel) – Model to display.

toggle_bookmark_from_path(name: str, path: str, is_bookmark: bool)

Adds/deletes the given bookmark with the specified path. If deleting, then the path argument is optional.

Parameters
  • name (str) – Name to call the bookmark or existing name if delete.

  • path (str) – Path to the bookmark.

  • is_bookmark (bool) – True to add, False to delete.

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

An embeddable UI widget for browsing the filesystem and taking action on a selected file. Includes a browser bar for keyboard input with auto-completion for navigation of the tree view. For similar but different options, see also FilePickerDialog and FilePickerView.

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.

  • current_directory (str) – View is set to display this directory. Default None.

  • current_filename (str) – Filename is set to this value. Default None.

  • splitter_offset (int) – Position of vertical splitter bar. Default 300.

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

  • grid_view_scale (int) – Scales grid view, ranges from 0-5. Default 2.

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

  • allow_multi_selection (bool) – Allows multiple selections. Default False.

  • click_apply_handler (Callable) – Function that will be called when the user accepts the selection. Function signature: void apply_handler(file_name: str, dir_name: str).

  • click_cancel_handler (Callable) – Function that will be called when the user clicks the cancel button. Function signature: void cancel_handler(file_name: str, dir_name: str).

  • apply_button_label (str) – Alternative label for the apply button. Default “Okay”.

  • enable_file_bar (bool) – Enables/disables file bar. Default True.

  • enable_filename_input (bool) – Enables/disables filename input. Default True.

  • file_postfix_options (List[str]) – A list of filename postfix options. Default [].

  • file_extension_options (List[Tuple[str, str]]) – A list of filename extension options. Each list element is an (extension name, description) pair, e.g. (“.usdc”, “Binary format”). Default [].

  • item_filter_options (List[str]) – OBSOLETE. Use file_postfix_options & file_extension_options instead. A list of filter options to determine which files should be listed. For example: [‘usd’, ‘wav’]. Default None.

  • item_filter_fn (Callable) – This user function should return True if the given tree view item is visible, False otherwise. To base the decision on which filter option is currently chosen, use the attribute filepicker.current_filter_option. Function signature: bool item_filter_fn(item: FileBrowserItem)

  • error_handler (Callable) – This function is called with error messages when appropriate. It provides the calling app a way to display errors on top of writing them to the console window. Function signature: void error_handler(message: str).

  • show_real_path (bool) – OBSOLETE. Browser bar display system paths only, no aliased paths. Default True.

  • show_detail_view (bool) – Display the details pane.

  • enable_versioning_pane (bool) – OBSOLETE. Use enable_checkpoints instead.

  • enable_checkoints (bool) – Whether the checkoints, a.k.a. versioning pane should be displayed. Default False.

  • options_pane_build_fn (Callable[[List[FileBrowserItem]], bool]) – OBSOLETE, add options in a detail frame instead.

  • options_pane_width (Union[int, omni.ui.Percent]) – OBSOLETE.

  • selection_changed_fn (Callable[[List[FileBrowserItem]]]) – Selections has changed.

  • treeview_identifier (str) – widget identifier for treeview, only used by tests.

property api

Provides API methods to this widget.

Type

FilePickerAPI

property current_filter_option

Index of current filter option, range 0 .. num_filter_options.

Type

OBSOLETE int

destroy()

Destructor.

property file_bar

Returns the file bar widget.

Type

FileBar

get_selected_filename_and_directory()Tuple[str, str]

Get the current directory and filename that has been selected or entered into the filename field

set_click_apply_handler(click_apply_handler: Callable[[str, str], None])

Sets the function to execute upon clicking apply.

Parameters

click_apply_handler (Callable) – Signature is void fn(filename: str, dirname: str)

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)

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

An embeddable UI component for browsing the filesystem. This widget is more full-functioned than FileBrowserWidget but less so than 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.

  • grid_view_scale (int) – Scales grid view, ranges from 0-5. Default 2.

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

  • add_server_post_handler (Callable) – This handler is called whenever a server connection is added. A primary use of this callback is to update settings files or similar bookkeeping. Function signature: void add_server_post_handler(name: str, path: str).

  • delete_server_post_handler (Callable) – This handler is called whenever a server connection is deleted. A primary use of this callback is to update settings files or similar bookkeeping. Function signature: void delete_server_post_handler(name: str, path: 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).

  • thumbnail_dict_provider_async (Callable) – Returns a dictionary of thumbnails for the current folder. It is called from an async thread and typically queries a remote server, e.g. Nucleus. Signature: async dict thumbnail_dict_provider_async(item: FileBrowserItem). Returns a dictionary with item name as key, and fullpath to thumbnail file as value.

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

  • error_handler (Callable) – This function is called with error messages when appropriate. It provides the calling app a way to display errors. Function signature: void error_handler(message: str).

  • treeview_identifier (str) – widget identifier for treeview, only used by tests.

add_bookmark_with_callback(name: str, path: str, callback: Callable)omni.kit.widget.filebrowser.model.FileBrowserModel

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://”.

  • callback (Callable) – Invokes this callback upon success. A typical use is to update settings. Function signature: void callback(name: str, path: str).

Returns

FileBrowserModel

add_server_with_callback(name: str, path: str, callback: Callable)omni.kit.widget.filebrowser.model.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://”.

  • callback (Callable) – Invokes this callback upon success. A typical use is to update saved settings. Function signature: void callback(name: str, path: str).

Returns

FileBrowserModel

Raises

RuntimeWarning – If unable to add server.

all_connection_items(collection: Optional[str] = None)List[omni.kit.widget.filebrowser.model.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]

property collections

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

Type

dict

delete_bookmark_with_callback(item: omni.kit.widget.filebrowser.model.FileBrowserItem, callback: Callable)

Deletes the given bookmark.

Parameters
  • item (FileBrowserItem) – Bookmark item.

  • callback (Callable) – Invokes this callback upon success. A typical use is to update settings. Function signature: void callback(name: str, path: str).

delete_server_with_callback(item: omni.kit.widget.filebrowser.model.FileBrowserItem, callback: Callable)

Disconnects the subtree rooted at the given item.

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

  • callback (Callable) – Invokes this callback upon success. A typical use is to update settings. Function signature: void callback(name: str, path: str).

get_root(pane: Optional[int] = None)omni.kit.widget.filebrowser.model.FileBrowserItem

Returns the root item of the specified pane.

Parameters

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

get_selections(pane: int = 2)List[omni.kit.widget.filebrowser.model.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: Optional[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

has_server_connection(server_url: str, collection: Optional[str] = None)bool

Returns True if speficied server connection exists within the collection.

Parameters
  • server (str) – server Url

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

Returns

bool

is_bookmark(item: omni.kit.widget.filebrowser.model.FileBrowserItem)bool

Returns true if given item is a bookmarked item.

Parameters

item (FileBrowserItem) – Item in question.

Returns

bool

is_connection_point(item: omni.kit.widget.filebrowser.model.FileBrowserItem)bool

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

Parameters

item (FileBrowserItem) – Item in question.

Returns

bool

mount_user_folders(folders: dict)

Mounts given set of user folders under the local collection.

Parameters

folders (dict) – Name, path pairs.

reconnect_server(item: omni.kit.widget.filebrowser.model.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: Optional[omni.kit.widget.filebrowser.model.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.

rename_bookmark_with_callback(item: omni.kit.widget.filebrowser.model.FileBrowserItem, new_name: str, callback: Callable)

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.

  • callback (Callable) – Invokes this callback upon success. A typical use is to update settings. Function signature: void callback(name: str, path: str, old_name: str).

rename_server_with_callback(item: omni.kit.widget.filebrowser.model.FileBrowserItem, new_name: str, callback: Callable)

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.

  • callback (Callable) – Invokes this callback upon success. A typical use is to update settings. Function signature: void callback(name: str, path: str, old_name: str).

scale_grid_view(scale: float)

Scale file picker’s grid view icon size.

Parameters

scale (float) – Scale of the icon.

select_and_center(item: omni.kit.widget.filebrowser.model.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[omni.kit.widget.filebrowser.model.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.

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

show_model(model: omni.kit.widget.filebrowser.model.FileBrowserModel)

Displays the model on the right side of the split pane

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.

class omni.kit.window.filepicker.FilePickerModel(theme='NvidiaDark', timeout=10.0)

The model class for FilePickerWidget.

add_saved_bookmark(name: str, path: str)

When a bookmark is added, update the settings dictionary.

add_saved_connection(name: str, path: str)

When a connection is added, update the settings dictionary.

assert_settings_name_exists(settings_name: str)

Checks that specified setting exists. If not, then create empty placeholder.

Parameters

settings_name (str) – Name of the setting.

property collections

The collections loaded for this widget

Type

[FileBrowseItem]

copy_items_with_callback(dst_path: str, src_paths: List[str], callback: Optional[Callable] = None)

Copies items. Upon success, executes the given callback.

Parameters
  • dst_path (str) – Destination folder.

  • src_items ([str]) – Paths of items to download.

  • callback (func) – Callback to execute upon success. Function signature is void callback([str]).

Raises

Exception

create_folder_with_callback(item: omni.kit.widget.filebrowser.model.FileBrowserItem, folder_name: str, callback: Optional[Callable] = None)

Creates folder under given item. Upon success, executes the given callback.

Parameters
  • item (FileBrowserItem) – Item under which to create the folder.

  • folder_name (str) – Name of new folder.

  • callback (Callable) – Callback to execute upon success. Function signature is void callback([str]).

Raises

Exception

delete_items_with_callback(items: [<class 'omni.kit.widget.filebrowser.model.FileBrowserItem'>], callback: Optional[Callable] = None)

Deletes given items. Upon success, executes the given callback.

Parameters
  • items ([FileBrowserItem]) – Items to delete.

  • callback (Callable) – Callback to execute upon success. Function signature is void callback([str]).

Raises

Exception

delete_saved_bookmark(name: str, path: str)

When a connection is deleted, update the settings dictionary.

delete_saved_connection(name: str, path: str)

When a connection is deleted, update the settings dictionary.

async find_item_async(url: str, callback: Optional[Callable] = None, timeout: float = 0)omni.kit.widget.filebrowser.model.FileBrowserItem

Searches model for the given path and executes callback on found item.

Parameters
  • url (str) – Url of item to search for.

  • callback (Callable) – Invokes this callback on found item or None if not found. Function signature is void callback(item: FileBrowserItem)

find_item_with_callback(url: str, callback: Optional[Callable] = None)

Searches filebrowser model for the item with the given url. Executes callback on found item.

Parameters
  • url (str) – Url of item to search for.

  • callback (Callable) – Invokes this callback on found item or None if not found. Function signature is void callback(item: FileBrowserItem)

get_asset_type(item: omni.kit.widget.filebrowser.model.FileBrowserItem)str

Returns asset type of given item.

Parameters

item (FileBrowseritem) – Item in question.

Returns

str

get_badges(item: omni.kit.widget.filebrowser.model.FileBrowserItem)List[Tuple[str, str]]

Returns fullpaths to badges for given item. Override this method to implement custom badges.

Parameters

item (FileBrowseritem) – Item in question.

Returns

Where each tuple is an (icon path, tooltip string) pair.

Return type

List[Tuple[str, str]]

get_icon(item: omni.kit.widget.filebrowser.model.FileBrowserItem, expanded: bool)str

Returns fullpath to icon for given item. Override this method to implement custom icons.

Parameters
  • item (FileBrowseritem) – Item in question.

  • expanded (bool) – True if item is expanded.

Returns

str

get_saved_bookmarks_dict()dict

Returns dictionary of saved bookmarks as name, path pairs

get_saved_connections_dict()dict

Returns persistent connections as dict.

Returns

dict

get_thumbnail(item: omni.kit.widget.filebrowser.model.FileBrowserItem)str

Returns fullpath to thumbnail for given item.

Parameters

item (FileBrowseritem) – Item in question.

Returns

Fullpath to the thumbnail file, None if not found.

Return type

str

async get_thumbnail_dict_async(_: omni.kit.widget.filebrowser.model.FileBrowserModel, item: omni.kit.widget.filebrowser.model.FileBrowserItem, retry=True)dict

Returns a dictionary of thumbnails for the current folder by listing the adjacent “.thumbs” folder.

Parameters
  • model (FileBrowsermodel) – Ignored.

  • item (FileBrowseritem) – Current folder.

Returns

With item name as key, and fullpath to thumbnail file as value.

Return type

dict

get_user_folders_dict()dict

Returns dictionary of user folders as name, path pairs

is_local_path(path: str)bool

Returns True if given path is a local path

item_filter_fn(item: omni.kit.widget.filebrowser.model.FileBrowserItem)bool

Default item filter callback. Returning True makes the item visible.

Parameters

item (FileBrowseritem) – Item in question.

Returns

bool

rename_saved_bookmark(name: str, path: str, prev_name: str)

When a connection is deleted, update the settings dictionary.

rename_saved_connection(name: str, path: str, old_name: str)

When a connection is renamed, update the settings dictionary.

sanitize_path(path: str)str

Helper function for normalizing a path that may have been copied and pasted int to browser bar. This makes the tool more resiliant to user inputs from other apps.

Parameters

path (str) – Raw path

Returns

str

class omni.kit.window.filepicker.FilePickerAPI(model: Optional[omni.kit.window.filepicker.model.FilePickerModel] = None, view: Optional[omni.kit.window.filepicker.view.FilePickerView] = None, timeout=10.0)

This class defines the API methods for FilePickerWidget.

add_connections(connections: dict)

Adds specified server connections to the tree browser. To facilitate quick startup time, doesn’t check whether the connection is actually valid.

Parameters

connections (dict) – A dictionary of name, path pairs. For example: {“C:”: “C:”, “ov-content”: “omniverse://ov-content”}. Paths to Omniverse servers should be prefixed with “omniverse://”.

add_context_menu(name: str, glyph: str, click_fn: Callable, show_fn: Callable, index: int = - 1)str

Adds menu item, with corresponding callbacks, to the context menu.

Parameters
  • name (str) – Name of the menu item (e.g. ‘Open’), this name must be unique across the context menu.

  • glyph (str) – Associated glyph to display for this menu item.

  • click_fn (Callable) – This callback function is executed when the menu item is clicked. Function signature: void fn(name: str, path: str), where name is menu name and path is absolute path to clicked item.

  • show_fn (Callable) – Returns True to display this menu item. Function signature: bool fn(path: str). For example, test filename extension to decide whether to display a ‘Play Sound’ action.

  • index (int) – The postion that this menu item will be inserted to.

Returns

Name of menu item if successful, None otherwise.

Return type

str

add_detail_frame(name: str, glyph: str, build_fn: Callable[], None], selection_changed_fn: Optional[Callable[[List[str]], None]] = None, filename_changed_fn: Optional[Callable[[str], None]] = None, destroy_fn: Optional[Callable[], None]] = None)

Adds sub-frame to the detail view, and populates it with a custom built widget.

Parameters
  • name (str) – Name of the widget sub-section, this name must be unique over all detail sub-sections.

  • glyph (str) – Associated glyph to display for this subj-section

  • build_fn (Callable) – This callback function builds the widget.

Keyword Arguments
  • selection_changed_fn (Callable) – This callback is invoked to handle selection changes.

  • filename_changed_fn (Callable) – This callback is invoked when filename is changed.

  • destroy_fn (Callable) – Cleanup function called when destroyed.

add_detail_frame_from_controller(name: str, controller: omni.kit.window.filepicker.detail_view.DetailFrameController)

Adds sub-frame to the detail view, and populates it with a custom built widget.

Parameters
  • name (str) – Name of the widget sub-section, this name must be unique over all detail sub-sections.

  • controller (DetailFrameController) – Controller object that encapsulates all aspects of creating, updating, and deleting a detail frame widget.

add_listview_menu(name: str, glyph: str, click_fn: Callable, show_fn: Callable, index: int = - 1)str

Adds menu item, with corresponding callbacks, to the list view menu.

Parameters
  • name (str) – Name of the menu item (e.g. ‘Open’), this name must be unique across the list view menu.

  • glyph (str) – Associated glyph to display for this menu item.

  • click_fn (Callable) – This callback function is executed when the menu item is clicked. Function signature: void fn(name: str, path: str), where name is menu name and path is absolute path to clicked item.

  • show_fn (Callable) – Returns True to display this menu item. Function signature: bool fn(path: str). For example, test filename extension to decide whether to display a ‘Play Sound’ action.

  • index (int) – The postion that this menu item will be inserted to.

Returns

Name of menu item if successful, None otherwise.

Return type

str

connect_server(url: str, callback: Optional[Callable] = None)

Connects the server for given url.

Parameters
  • url (str) – Given url.

  • callback (Callable) – On successfully connecting the server, executes this callback. Function signature: void callback(name: str, server_url: str)

delete_context_menu(name: str)

Deletes the menu item, with the given name, from the context menu.

Parameters

name (str) – Name of the menu item (e.g. ‘Open’).

delete_detail_frame(name: str)

Deletes the specified detail subsection.

Parameters

name (str) – Name previously assigned to the detail frame.

delete_listview_menu(name: str)

Deletes the menu item, with the given name, from the list view menu.

Parameters

name (str) – Name of the menu item (e.g. ‘Open’).

async find_subdirs_async(url: str, callback: Callable)List[str]

Asynchronously executes callback on list of subdirectories at given url.

Parameters
  • url (str) – Url.

  • callback (Callable) – On success executes this callback with the list of subdir names. Function signature: void callback(subdirs: List[str])

find_subdirs_with_callback(url: str, callback: Callable)

Executes callback on list of subdirectories at given url.

Parameters
  • url (str) – Url.

  • callback (Callable) – On success executes this callback with the list of subdir names. Function signature: void callback(subdirs: List[str])

get_current_directory()str

Returns the current directory fom the browser bar.

Returns

The system path, which may be different from the displayed path.

Return type

str

get_current_selections(pane: int = 2)List[str]

Returns current selected as list of system path names.

Parameters

pane (int) – Specifies pane to retrieve selections from, one of {TREEVIEW_PANE = 1, LISTVIEW_PANE = 2, BOTH = None}. Default LISTVIEW_PANE.

Returns

List of system paths (which may be different from displayed paths, e.g. bookmarks)

Return type

[str]

get_filename()str
Returns

Currently selected filename.

Return type

str

navigate_to(url: str, callback: Optional[Callable] = None)

Navigates to the given url, expanding all parent directories in the path.

Parameters
  • url (str) – The url to navigate to.

  • callback (Callable) – On successfully finding the item, executes this callback. Function signature: void callback(item: FileBrowserItem)

async navigate_to_async(url: str, callback: Optional[Callable] = None)

Asynchronously navigates to the given url, expanding the all parent directories in the path.

Parameters
  • url (str) – The url to navigate to.

  • callback (Callable) – On successfully finding the item, executes this callback. Function signature: void callback(item: FileBrowserItem)

refresh_current_directory()

Refreshes the current directory set in the browser bar.

set_current_directory(path: str)

Procedurally sets the current directory. Use this method to set the path in the browser bar.

Parameters

path (str) – The full path name of the folder, e.g. “omniverse://ov-content/Users/me.

set_filename(filename: str)

Sets the filename in the file bar, at bottom of the dialog. The file is not required to already exist.

Parameters

filename (str) – The filename only (and not the fullpath), e.g. “myfile.usd”.

set_search_delegate(delegate: omni.kit.window.filepicker.search_delegate.SearchDelegate)

Sets a custom search delegate for the tool bar.

Parameters

delegate (SearchDelegate) – Object that creates the search widget.

show_model(model: omni.kit.widget.filebrowser.model.FileBrowserModel)

Displays the given model in the list view, overriding the default model. For example, this model might be the result of a search.

Parameters

model (FileBrowserModel) – Model to display.

subscribe_bookmarks_settings_changed()

Updates bookmarks when settings changed.

subscribe_connections_settings_changed()

Updates connections when settings changed.

toggle_bookmark_from_path(name: str, path: str, is_bookmark: bool)

Adds/deletes the given bookmark with the specified path. If deleting, then the path argument is optional.

Parameters
  • name (str) – Name to call the bookmark or existing name if delete.

  • path (str) – Path to the bookmark.

  • is_bookmark (bool) – True to add, False to delete.

class omni.kit.window.filepicker.ContextMenu(**kwargs)

Creates popup menu for the hovered FileBrowserItem. In addition to the set of default actions below, users can add more via the add_menu_item API.

Keyword Arguments
  • rename_item_fn – void rename_item(item: FileBrowserItem, new_name: str). Default None.

  • create_folder_fn – void create_folder(item: FileBrowserItem, name: str). Default None.

  • add_bookmark_fn – void add_bookmark(item: FileBrowserItem, name: str). Default None.

  • delete_bookmark_fn – void delete_bookmark(item: FileBrowserItem). Default None.

  • delete_items_fn – void delete_items(items: [FileBrowserItem]). Default None.

  • reconnect_server_fn – void reconnect_server(item: FileBrowserItem). Default None.

  • remove_connection_fn – void remove_connection(item: FileBrowserItem). Default None.

  • refresh_item_fn – void refresh_item(item: FileBrowserItem). Default None.

add_menu_item(name: str, glyph: str, onclick_fn: Callable, show_fn: Callable, index: int = - 1)str

Adds menu item, with corresponding callbacks, to this context menu.

Parameters
  • name (str) – Name of the menu item (e.g. ‘Open’), this name must be unique across the context menu.

  • glyph (str) – Associated glyph to display for this menu item.

  • onclick_fn (Callable) – This callback function is executed when the menu item is clicked. Function signature: void fn(name: str, path: str), where name is menu name and path is absolute path to clicked item.

  • show_fn (Callable) – Returns True to display this menu item. Function signature: bool fn(path: str). For example, test filename extension to decide whether to display a ‘Play Sound’ action.

  • index (int) – The position that this menu item will be inserted to.

Returns

Name of menu item if successful, None otherwise.

Return type

str

property context

Provides data to the callback. Available keys are {‘item’, ‘is_bookmark’, ‘is_connection’, ‘selected’}

Type

dict

delete_menu_item(name: str)

Deletes the menu item, with the given name, from this context menu.

Parameters

name (str) – Name of the menu item (e.g. ‘Open’).

property menu

omni.ui.Menu The menu widget

show(item: omni.kit.widget.filebrowser.model.FileBrowserItem, is_bookmark: bool = False, is_connection_point: bool = False, selected: [<class 'omni.kit.widget.filebrowser.model.FileBrowserItem'>] = [])

Creates the popup menu from definition for immediate display. Receives as input, information about the item. These values are made available to the callback via the ‘context’ dictionary.

Parameters
  • item (FileBrowseritem) – Item for which to create menu.,

  • is_bookmark (bool) – True if this item is a bookmark. Default False.

  • is_connection_point (bool) – True if item is a connection point. Default False.

  • selected ([FileBrowserItem]) – List of currently selected items. Default [].

class omni.kit.window.filepicker.ToolBar(**kwargs)
set_search_delegate(delegate: omni.kit.window.filepicker.search_delegate.SearchDelegate)

Sets a custom search delegate for the tool bar.

Parameters

delegate (SearchDelegate) – Object that creates the search widget.

class omni.kit.window.filepicker.DetailView(**kwargs)
add_detail_frame(name: str, glyph: str, build_fn: Callable[], omni.ui._ui.Widget], selection_changed_fn: Optional[Callable[[List[str]], None]] = None, filename_changed_fn: Optional[Callable[[str], None]] = None, destroy_fn: Optional[Callable[[omni.ui._ui.Widget], None]] = None)

Adds sub-frame to the detail view, and populates it with a custom built widget.

Parameters
  • name (str) – Name of the widget sub-section, this name must be unique over all detail sub-sections.

  • glyph (str) – Associated glyph to display for this subj-section

  • build_fn (Callable) – This callback function builds the widget.

Keyword Arguments
  • selection_changed_fn (Callable) – This callback is invoked to handle selection changes.

  • filename_changed_fn (Callable) – This callback is invoked when filename is changed.

  • destroy_fn (Callable) – Cleanup function called when destroyed.

add_detail_frame_from_controller(name: str, detail_frame: Optional[omni.kit.window.filepicker.detail_view.DetailFrameController] = None)

Adds sub-frame to the detail view, and populates it with a custom built widget.

Parameters
  • name (str) – Name of the widget sub-section, this name must be unique over all detail sub-sections.

  • controller (DetailFrameController) – Controller object that encapsulates all aspects of creating, updating, and deleting a detail frame widget.

delete_detail_frame(name: str)

Deletes the specified detail frame.

Parameters

name (str) – Name of the detail frame.

on_filename_changed(filename: str = '')

When the user edits the filename, invokes the callbacks for the detail frames.

Parameters

filename (str) – Current filename.

on_selection_changed(selected: List[omni.kit.widget.filebrowser.model.FileBrowserItem] = [])

When the user changes their filebrowser selection(s), invokes the callbacks for the detail frames.

Parameters

selected (FileBrowserItem) – List of new selections.

class omni.kit.window.filepicker.DetailFrameController(glyph: Optional[str] = None, build_fn: Optional[Callable[], None]] = None, selection_changed_fn: Optional[Callable[[List[str]], None]] = None, filename_changed_fn: Optional[Callable[[str], None]] = None, destroy_fn: Optional[Callable[], None]] = None, **kwargs)