FileImporterExtension
- class omni.kit.window.file_importer.FileImporterExtension
Bases:
IExt
A Standardized file import dialog.
Methods
__init__
(self)add_import_options_frame
(name, delegate)Adds a set of import options to the dialog.
click_apply
([filename_url, postfix, extension])Helper function to progammatically execute the apply callback.
click_cancel
([cancel_handler])Helper function to progammatically execute the cancel callback.
destroy_dialog
()Detach the current file importer dialog from main window.
Hides and destroys the dialog window.
on_shutdown
()on_startup
(ext_id)select_items_async
(url[, filenames])Helper function to programatically select multiple items in filepicker.
show_window
([title, width, height, ...])Displays the import dialog with the specified settings.
Attributes
is_ui_ready
is_window_visible
- __init__(self: omni.ext._extensions.IExt) None
- add_import_options_frame(name: str, delegate: DetailFrameController)
Adds a set of import options to the dialog. Should be called after show_window.
- Parameters
name (str) – Title of the options box.
delegate (ImportOptionsDelegate) – Subclasses specified delegate and overrides the _build_ui_impl method to provide a custom widget for getting user input.
- click_apply(filename_url: Optional[str] = None, postfix: Optional[str] = None, extension: Optional[str] = None)
Helper function to progammatically execute the apply callback. Useful in unittests
- click_cancel(cancel_handler: Optional[Callable[[str, str], None]] = None)
Helper function to progammatically execute the cancel callback. Useful in unittests
- detach_from_main_window()
Detach the current file importer dialog from main window.
- hide_window()
Hides and destroys the dialog window.
- async select_items_async(url: str, filenames: List[str] = []) List[FileBrowserItem]
Helper function to programatically select multiple items in filepicker. Useful in unittests.
- show_window(title: Optional[str] = None, width: int = 1080, height: int = 450, show_only_collections: Optional[List[str]] = None, show_only_folders: bool = False, file_postfix_options: Optional[List[str]] = None, file_extension_types: Optional[List[Tuple[str, str]]] = None, file_filter_handler: Optional[Callable[[str, str, str], bool]] = None, import_button_label: str = 'Import', import_handler: Optional[Callable[[str, str, List[str]], None]] = None, filename_url: Optional[str] = None, file_postfix: Optional[str] = None, file_extension: Optional[str] = None, hide_window_on_import: bool = True, should_validate: bool = False, focus_filename_input: bool = True, allow_multi_files_selection: bool = False)
Displays the import dialog with the specified settings.
- Keyword Arguments
title (str) – The name of the dialog
width (int) – Width of the window (Default=1250)
height (int) – Height of the window (Default=450)
show_only_collections (List[str]) – Which of these collections, [“bookmarks”, “omniverse”, “my-computer”] to display.
show_only_folders (bool) – Show only folders in the list view.
file_postfix_options (List[str]) – A list of filename postfix options. Nvidia defaults.
file_extension_types (List[Tuple[str, str]]) – A list of filename extension options. Each list element is a (extension name, description) pair, e.g. (“.usd”, “USD format”). Nvidia defaults.
file_filter_handler (Callable) – The filter handler that is called to decide whether or not to display a file. Function signature is filter_handler(filename: str, filter_postfix: str, filter_ext: str) -> bool
import_button_label (str) – Label for the import button (Default=”Import”)
import_handler (Callable) – The callback to handle the import. Function signature is import_handler(filename: str, dirname: str, selections: List[str]) -> None
filename_url (str) – Url of the file to import, if any.
file_postfix (str) – Sets selected postfix to this value if specified.
file_extension (str) – Sets selected extension to this value if specified.
hide_window_on_import (bool) – Whether the dialog hides on apply; if False, it means that whether to hide the dialog should be decided by import handler.
should_validate (bool) – Whether filename validation should be performed.