FilePickerModel#

class omni.kit.window.filepicker.FilePickerModel(**kwargs)#

Bases: object

The model class for FilePickerWidget.

Methods

__init__(**kwargs)

destroy()

Destructor

find_item_async(url[, callback])

Searches model for the given path and executes callback on found item.

find_item_in_subtree_async(root, path)

Finds the given item in the current model recursively asynchronously.

find_item_with_callback(url[, callback])

Searches filebrowser model for the item with the given url.

get_badges(item)

Returns fullpaths to badges for given item.

get_icon(item, expanded)

Returns fullpath to icon for given item.

get_thumbnail(item)

Returns fullpath to thumbnail for given item.

is_local_path(path)

Returns True if given path is a local path

sanitize_path(path)

Helper function for normalizing a path that may have been copied and pasted int to browser bar.

Attributes

collections

The collections loaded for this widget

__init__(**kwargs)#
destroy()#

Destructor

async find_item_async(
url: str,
callback: 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)

async find_item_in_subtree_async(
root: FileBrowserItem,
path: str,
) FileBrowserItem#

Finds the given item in the current model recursively asynchronously.

Parameters:
  • ( (root) – obj: ‘FileBrowserItem’): The root item to search.

  • path (str) – Path of item to search for.

Returns:

obj: ‘FileBrowserItem’: item that has the path and under the root item.

find_item_with_callback(
url: str,
callback: 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

property collections: dict#

The collections loaded for this widget

Type:

[FileBrowseItem]