FileBrowserItemCard

class omni.kit.widget.filebrowser.FileBrowserItemCard(item: FileBrowserItem, **kwargs)

Bases: Widget

Widget used by FileBrowserGridView to build the browser item.

Parameters

item (FileBrowserItem) – Item to build the widget with.

Keyword Arguments
  • width (int) – width of the widget, defaults to 60.

  • height (int) – height of the widget, defaults to 60.

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

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

  • mouse_released_fn (Callable) – Function called on mouse release. Function signature: void mouse_pressed_fn(pane: int, button: int, key_mode: int, item: FileBrowserItem)

  • drop_fn (Callable) – Function called to handle drag-n-drops. Function signature: void drop_fn(dst_item: FileBrowserItem`, event: :obj:`ui.WidgetMouseDropEvent)

  • get_thumbnail_fn (Callable) – Function called to get the thumbnail from the item. Function signature: str badges_provider(item: FileBrowserItem)

  • get_badges_fn (Callable) – Function called to get badges from the item. Function signature: List[str] badges_provider(item: FileBrowserItem)

  • custom_thumbnail (str) – Thumbnail to override the default one.

  • drag_fn (Callable) – Function called to handle dragging thumbnails. Function signature: void drag_fn(thumbnail: str)

Methods

__init__(self, **kwargs)

apply_cut_style()

Apply cut style to the widget.

destroy()

Destructor

draw_badges()

Draw badges if get_badgets_fn is provided in the constructor.

draw_thumbnail(thumbnail)

Asynchronously redraw thumbnail with the given file.

on_drag([thumbnail])

Default drag handler, create a thumbnail at the given path in the current widget container.

refresh_thumbnail_async(thumbnail)

Asynchronously redraw thumbnail with the given file.

remove_cut_style()

Remove cut style from the widget.

Attributes

item

Return the item associated with the widget.

selected

Return True when selected.

__init__(self: omni.ui._ui.Widget, **kwargs) None
apply_cut_style()

Apply cut style to the widget.

destroy()

Destructor

draw_badges()

Draw badges if get_badgets_fn is provided in the constructor.

draw_thumbnail(thumbnail: str)

Asynchronously redraw thumbnail with the given file.

Parameters

thumbnail (str) – thumbnail path.

on_drag(thumbnail: Optional[str] = None)

Default drag handler, create a thumbnail at the given path in the current widget container.

Parameters

thumbnail (str) – thumbnail path.

Returns

The current item path.

async refresh_thumbnail_async(thumbnail: str)

Asynchronously redraw thumbnail with the given file.

Parameters

thumbnail (str) – thumbnail path.

remove_cut_style()

Remove cut style from the widget.

property item: FileBrowserItem

Return the item associated with the widget.

property selected: bool

Return True when selected.