DetailDelegate#
- class omni.kit.browser.core.DetailDelegate(
- model: AbstractBrowserModel = None,
Bases:
AbstractItemDelegateDelegate to represent detail item. :keyword model: Browser model. Used to execute detail item when double click. Default is None.
- Overridden functions:
str get_thumbnail(item: DetailItem): Function returns thumbnail url when the delegate asks it. Default using thumbnail defined in detail item. str get_label(item: DetailItem): Function returns label string when the delegate asks it. Default using name defined in detail item. Label will be invisible if returns None. int get_label_height(item: DetailItem): Function return label height when display item label. Default is 20. str get_tooltip(item: DetailItem): Function returns tooltip string when the detail delegate asks it. void on_click(item: DetailItem): Function called when clicked on the detail delegate. void on_right_click(item: DetailItem): Function called when right clicked on the detail delegate. void on_double_click(item: DetailItem) Function called when double clicked on the detail delegate. Default to execute the detail item. str on_drag(item: DetailItem): Function called when dragging the detail delegate. void build_thumbnail(item: DetailItem): Function called when drarwing thumbnail
Methods
__init__(self)Constructs AbstractItemDelegate.
build_branch(model, item[, column_id, ...])Create a branch widget that opens or closes subtree.
build_thumbnail(item)Display thumbnail per detail item.
build_widget(model, item[, index, level, expand])Create a widget per detail item :param model: Detail data model :type model: AbstractItemModel :param item: Detail item :type item: DetailItem :param index: ignore :type index: int :param level: ignore :type level: int :param expand: ignore :type expand: int
destroy()Clean up.
get_label(item)Returns label string of detail item when the delegate asks it.
Return label height for detail items.
get_thumbnail(item)Returns thumbnail of detail item when the delegate asks it.
get_tooltip(item)Returns tooltip of detail item when the delegate asks it.
item_changed(model, item)Update the widget when detail item changed.
on_click(item)Function called when clicking on the detail delegate.
on_double_click(item)Function called when double clicking on the detail delegate.
on_drag(item)Function called when dragging on the detail delegate.
on_hover(item, hovered)Function called when hovering on the detail delegate.
on_multiple_drag(item)Function called when dragging on the detail delegate with other items.
on_right_click(item)Function called when right clicking on the detail delegate.
set_drag_fn(drag_fn)Set the drag function for the detail delegate.
- __init__(
- self: omni.ui._ui.AbstractItemDelegate,
Constructs AbstractItemDelegate.
- `kwargsdict`
See below
### Keyword Arguments:
- build_branch(
- model: AbstractItemModel,
- item: DetailItem,
- column_id: int = 0,
- level: int = 0,
- expanded: bool = False,
Create a branch widget that opens or closes subtree.
- Parameters:
model (AbstractItemModel) – Detail data model.
item (CategoryItem) – Detail item.
column_id (int) – ignore.
level (int) – ignore.
expanded (bool) – ignore.
- build_thumbnail(
- item: DetailItem,
Display thumbnail per detail item.
- Parameters:
item (DetailItem) – detail item to display.
- Returns:
Image widget for detail item thumbnail.
- Return type:
Optional[ui.Image]
- build_widget(
- model: AbstractItemModel,
- item: DetailItem,
- index: int = 0,
- level: int = 0,
- expand: bool = False,
Create a widget per detail item :param model: Detail data model :type model: AbstractItemModel :param item: Detail item :type item: DetailItem :param index: ignore :type index: int :param level: ignore :type level: int :param expand: ignore :type expand: int
- destroy()#
Clean up.
- get_label(
- item: DetailItem,
Returns label string of detail item when the delegate asks it. Returns None means do not display label. Default using item name.
- Parameters:
item (DetailItem) – detail item to display.
- Returns:
Label text or None.
- Return type:
Optional[str]
- get_label_height() int#
Return label height for detail items.
- Returns:
Label height in pixels.
- Return type:
int
- get_thumbnail(
- item: DetailItem,
Returns thumbnail of detail item when the delegate asks it. Returns None means do not display thumbnail. Default using thumbnail defined in detail item.
- Parameters:
item (DetailItem) – detail item to display.
- Returns:
Thumbnail url or None.
- Return type:
Optional[str]
- get_tooltip(
- item: DetailItem,
Returns tooltip of detail item when the delegate asks it. Returns None means do not display tooltip. Default is None.
- Parameters:
item (DetailItem) – detail item to display.
- Returns:
Tooltip text or None.
- Return type:
Optional[str]
- item_changed(
- model: AbstractItemModel,
- item: DetailItem | None,
Update the widget when detail item changed. Now will update detail lable text and thumbail url. :param model: Detail data model. Ignored now. :type model: AbstractItemModel :param item: Detail item. None to change all items. :type item: DetailItem
- on_click(
- item: DetailItem,
Function called when clicking on the detail delegate. :param item: detail item to display :type item: DetailItem
- on_double_click(
- item: DetailItem,
Function called when double clicking on the detail delegate. Default to execute this item :param item: detail item to display :type item: DetailItem
- on_drag(
- item: DetailItem,
Function called when dragging on the detail delegate. Used to create widgets for dragged item.
- Parameters:
item (DetailItem) – detail item to display.
- Returns:
Drag string for detail item.
- Return type:
str
- on_hover(
- item: DetailItem,
- hovered: bool,
Function called when hovering on the detail delegate. :param item: detail item to display :type item: DetailItem :param hovered: hovered not not :type hovered: bool
- on_multiple_drag(
- item: DetailItem,
Function called when dragging on the detail delegate with other items. Default same as on_drag.
- Parameters:
item (DetailItem) – detail item to display.
- Returns:
Drag string for detail item.
- Return type:
str
- on_right_click(
- item: DetailItem,
Function called when right clicking on the detail delegate. :param item: detail item to display :type item: DetailItem
- set_drag_fn(
- drag_fn: Callable[[DetailItem], str],
Set the drag function for the detail delegate.
- Parameters:
drag_fn (Callable[[DetailItem], str]) – drag function to handle drag action.