FilePickerWidget#
- class omni.kit.window.filepicker.FilePickerWidget(title: str, **kwargs)#
Bases:
object
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 :obj:`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”.
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.
apply_path_handler (Callable) – Function that will be called when the user entered in the path field. Function Signature: void apply_path_handler(url: str)
Methods
__init__
(title, **kwargs)destroy
()Destructor.
Get the current directory and filename that has been selected or entered into the filename field
set_click_apply_handler
(click_apply_handler)Sets the function to execute upon clicking apply.
set_item_filter_fn
(item_filter_fn)Sets the item filter function.
Attributes
Provides API methods to this widget.
Index of current filter option, range 0 .
Returns the file bar widget.
Returns the model of this widget.
- __init__(title: str, **kwargs)#
- destroy()#
Destructor.
- 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) – Callback with filename being the name of the file, and dirname being the containing directory path with an ending slash. Signature is fn(filename: str, dirname: str) -> None
- 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)
- 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
- property file_bar: FileBar#
Returns the file bar widget.
- Type:
FileBar
- property model#
Returns the model of this widget.