FilePickerDialog#
- class omni.kit.window.filepicker.FilePickerDialog(title: str, **kwargs)#
Bases:
object
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 :obj:`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: apply_handler(file_name: str, dir_name: str) -> None.
click_cancel_handler (Callable) – Function that will be called when the user clicks the cancel button. Function signature: cancel_handler(file_name: str, dir_name: str) -> None.
other – Additional args listed for
FilePickerWidget
Methods
__init__
(title, **kwargs)add_connections
(connections)Adds specified server connections to the browser.
add_detail_frame_from_controller
(name, ...)Adds subsection to the detail view, and populate it with a custom built widget.
delete_detail_frame
(name)Deletes the named detail frame.
destroy
()Destructor.
Returns the current directory from the browser bar.
get_current_selections
([pane])Returns current selected as list of system path names.
hide
()Hides this dialog.
navigate_to
(path)Navigates to a path, i.e. the path's parent directory will be expanded and leaf selected.
Refreshes the current directory set in the browser bar.
set_click_apply_handler
(click_apply_handler)Sets the function to execute upon clicking apply.
set_current_directory
(path)Procedurally sets the current directory path.
set_file_extension
(extension)Sets the file extension in the file bar.
set_file_postfix
(postfix)Sets the file postfix in the file bar.
set_filebar_label_name
(name)Sets the text of the name label for filebar, at the bottom of dialog.
set_filename
(filename)Sets the filename in the file bar, at bottom of the dialog.
set_item_filter_fn
(item_filter_fn)Sets the item filter function.
set_search_delegate
(delegate)Sets a custom search delegate for the tool bar.
set_visibility_changed_listener
(listener)Call the given handler when window visibility is changed.
show
([path])Shows this dialog.
show_model
(model)Displays the given model in the list view, overriding the default model.
toggle_bookmark_from_path
(name, path, ...[, ...])Adds/deletes the given bookmark with the specified path.
Attributes
Index of current filter option, range 0 .
- __init__(title: str, **kwargs)#
- 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
- 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,
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) – Callback with filename being the name of the file, and dirname being the containing directory path with an ending slash. Function Signature is fn(filename: str, dirname: str) -> None
- 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)#
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: 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.
- property current_filter_option#
Index of current filter option, range 0 .. num_filter_options.
- Type:
int