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
andFilePickerView
.- 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: 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_extension_options() List[Tuple[str, str]]
- Returns
List of all extension options strings.
- Return type
List[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.
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_file_extension(extension: str)
Sets the file extension in the file bar.
- set_file_postfix(postfix: str)
Sets the file postfix in the file bar.
- 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,
folder (it only allows to choose) –
UX. (it can be configured with this API for better) –
- 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: 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: 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, is_folder: bool = True)
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.
is_folder (bool) – Whether the item to be bookmarked is a folder.
- 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
andFilePickerView
.- 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”.
cancel_button_label (str) – Alternative label for the cancel button. Default “Cancel”.
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) – OBSOLETE. 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_detail_view (bool) – Display the details pane.
enable_versioning_pane (bool) – OBSOLETE. Use enable_checkpoints instead.
enable_checkpoints (bool) – Whether the checkpoints, a.k.a. versioning pane should be displayed. Default False.
enable_timestamp (bool) – Whether the show timestamp panel. need show with checkpoint, 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.
enable_tool_bar (bool) – Enables/disables tool bar. Default True.
enable_zoombar (bool) – Enables/disables filename input. Default True.
save_grid_view (bool) – Save grid view mode if toggled. Default True.
- property api: FilePickerAPI
Provides API methods to this widget.
- Type
- property current_filter_option: int
Index of current filter option, range 0 .. num_filter_options.
- Type
OBSOLETE int
- destroy()
Destructor.
- property file_bar: FileBar
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 thanFilePickerWidget
. More specifically, this is one of the 3 sub-components of its namesakeFilePickerWidget
. 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.
- 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, publish_event: 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: Optional[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]
- property collections
Dictionary of collections, e.g. ‘bookmarks’, ‘omniverse’, ‘my-computer’.
- Type
dict
- delete_bookmark(item: BookmarkItem, publish_event: bool = True)
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.
- get_connection_with_url(url: str) Optional[NucleusConnectionItem]
Gets the connection item with the given url.
- Parameters
name (str) – name (could be aliased name) of connection
- Returns
NucleusConnectionItem
- get_root(pane: Optional[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: 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
- hide_notification()
Utility to hide the notification frame.
- is_bookmark(item: FileBrowserItem, path: Optional[str] = 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: Optional[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
- 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
- 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: Optional[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(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()
Displays the add connection dialog.
- 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: 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.
- class omni.kit.window.filepicker.FilePickerModel(**kwargs)
The model class for
FilePickerWidget
.- property collections: dict
The collections loaded for this widget
- Type
[
FileBrowseItem
]
- async find_item_async(url: str, callback: Optional[Callable] = None) 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_badges(item: 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: 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_thumbnail(item: 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
- static is_local_path(path: str) bool
Returns True if given path is a local path
- 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[FilePickerModel] = None, view: Optional[FilePickerView] = None)
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://”.
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.
separator_name (str) – The separator name of the separator menu item. Default to ‘_placeholder_’. When the index is not explicitly set, or if the index is out of range, this will be used to locate where to add the menu item; if specified, the index passed in will be counted from the saparator with the provided name. This is for OM-86768 as part of the effort to match Navigator and Kit UX for Filepicker/Content Browser for context menus.
- 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: 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.
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)
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.
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
- hide_loading_pane()
Hide the loading icon if it exist.
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)
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: SearchDelegate)
Sets a custom search delegate for the tool bar.
- Parameters
delegate (
SearchDelegate
) – Object that creates the search widget.
- show_model(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_client_bookmarks_changed()
Subscribe to omni.client bookmark changes.
- toggle_bookmark_from_path(name: str, path: str, is_bookmark: bool, is_folder: bool = True)
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.
is_folder (bool) – Whether the item to be bookmarked is a folder.
- 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.
- class omni.kit.window.filepicker.ToolBar(**kwargs)
- set_search_delegate(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[[], Widget], selection_changed_fn: Optional[Callable[[List[str]], None]] = None, filename_changed_fn: Optional[Callable[[str], None]] = None, destroy_fn: Optional[Callable[[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[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[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)