FileBrowserTreeView

class omni.kit.widget.filebrowser.tree_view.FileBrowserTreeView(model: FileBrowserModel, **kwargs)

Bases: FileBrowserView

UI Widget for display files or folders as icons in a directory in tree view.

Keyword Arguments
  • root_visible (bool) – Set to True to show the root item.

  • header_visible (bool) – Set to True to show the column headers.

  • allow_multi_selection (bool) – Optional argument to enable multi selection, defaults to True.

  • selection_changed_fn (Callable) – Function called when selection changed. Function signature: void selection_changed_fn(selections: List[FileBrowserItem])

  • mouse_pressed_fn (Callable) – Function called on mouse press. Function signature: void mouse_pressed_fn(item: FileBrowserItem, x: float, y: float, button: int, key_mode: int)

  • mouse_double_clicked_fn (Callable) – Function called on mouse double click. Function signature: void mouse_double_clicked_fn(item: FileBrowserItem, x: float, y: float, button: int, key_mode: int)

  • treeview_identifier (str) – widget identifier for treeview, only used by tests.

Methods

__init__(model, **kwargs)

build_ui()

Build the tree view.

destroy()

Destructor.

is_expanded(item)

Return True if the item is expanded.

refresh_ui([item])

Throttle the refreshes so that the UI can keep up with multiple refresh directives in succession.

scroll_top()

Scroll the widget to top

select_and_center(item)

Select and center the view on the given item.

set_expanded(item, expanded[, recursive])

Set the expansion state of the given item.

Attributes

selections

Get selected items in the tree view.

tree_view

Get the tree view.

__init__(model: FileBrowserModel, **kwargs)
build_ui()

Build the tree view.

destroy()

Destructor.

is_expanded(item: FileBrowserItem) bool

Return True if the item is expanded.

refresh_ui(item: Optional[FileBrowserItem] = None)

Throttle the refreshes so that the UI can keep up with multiple refresh directives in succession.

Parameters

item (FileBrowserItem) – The item to refresh.

scroll_top()

Scroll the widget to top

select_and_center(item: FileBrowserItem)

Select and center the view on the given item.

Parameters

item (FileBrowserItem) – the item to set the new selection to.

set_expanded(item: FileBrowserItem, expanded: bool, recursive: bool = False)

Set the expansion state of the given item.

Parameters
  • item (FileBrowserItem) – The item to effect.

  • expanded (bool) – True to expand, False to collapse.

  • recursive (bool) – Apply state recursively to descendent nodes. Default False.

property selections

Get selected items in the tree view.

property tree_view

Get the tree view.