EditableDelegate

class omni.kit.window.extensions.exts_properties_paths.EditableDelegate

Bases: AbstractItemDelegate

A delegate class for handling editable UI elements within a tree view structure.

This delegate is responsible for managing interactive UI components such as buttons and text fields within a tree view. It enables actions such as opening file paths in the OS file explorer, editing item names directly within the UI, and triggering context menus for additional options like copying text. It also supports special functionalities for user-defined paths, cache management, and git repository updates.

The delegate utilizes a context menu for copy actions and dynamically updates the UI based on user interactions, such as double-clicking to edit names or clicking buttons to add, remove, or clean items. It plays a crucial role in managing the appearance and functionality of editable items within the tree view, ensuring a responsive and intuitive user experience.

Methods

__init__()

Initializes the EditableDelegate instance.

build_header(column_id)

Builds the header for a specified column in the tree view.

build_widget(model, item, column_id, level, ...)

Create a widget per column per item

destroy()

Cleans up resources and references held by the delegate instance.

on_double_click(button, field, label, model, ...)

Called when the user double-clicked the item in TreeView

on_end_edit(text, field, label, model)

Called when the user is editing the item and pressed Enter or clicked outside of the item

__init__()

Initializes the EditableDelegate instance.

build_header(column_id)

Builds the header for a specified column in the tree view.

Parameters

column_id (int) – The column index for which to build the header.

build_widget(model, item, column_id, level, expanded)

Create a widget per column per item

Parameters
  • model (ui.AbstractItemModel) – The model associated with the tree view.

  • item (ui.AbstractItem) – The item in the model for which to build the widget.

  • column_id (int) – The column index where the widget will be placed.

  • level (int) – The level of indentation for the item in the tree view.

  • expanded (bool) – Whether the item’s children are currently expanded.

destroy()

Cleans up resources and references held by the delegate instance.

on_double_click(button, field, label, model, item)

Called when the user double-clicked the item in TreeView

Parameters
  • button (int) – The mouse button clicked (0 for left-click).

  • field (ui.StringField) – The field to be edited on double-click.

  • label (ui.Label) – The label associated with the item.

  • model (ui.AbstractItemModel) – The model associated with the tree view.

  • item (ui.AbstractItem) – The item that was double-clicked.

on_end_edit(text, field, label, model)

Called when the user is editing the item and pressed Enter or clicked outside of the item

Parameters
  • text (str) – The new text entered into the field.

  • field (ui.StringField) – The text field that was being edited.

  • label (ui.Label) – The label associated with the item.

  • model (ui.AbstractItemModel) – The model to update with new text.