omni.kit.window.file_importer

A standardized dialog for importing files

class omni.kit.window.file_importer.FileImporterExtension

Bases: IExt

A Standardized file import dialog.

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

destroy_dialog()
detach_from_main_window()

Detach the current file importer dialog from main window.

hide_window()

Hides and destroys the dialog window.

property is_ui_ready: bool
property is_window_visible: bool
on_shutdown()
on_startup(ext_id)
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], 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)

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(menu_option: int, filename: 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.

omni.kit.window.file_importer.get_file_importer() FileImporterExtension

Returns the singleton file_importer extension instance