Object view#

The cdl.core.gui.objectview module provides widgets to display object (signal/image) trees.

Note

This module provides tree widgets to display signals, images and groups. It is important to note that, by design, the user can only select either individual signals/images or groups, but not both at the same time. This is an important design choice, as it allows to simplify the user experience, and to avoid potential confusion between the two types of selection.

Simple object tree#

class cdl.core.gui.objectview.SimpleObjectTree(parent: QW.QWidget, objmodel: ObjectModel)#

Base object handling panel list widget, object (sig/ima) lists

initialize_from(sobjlist: SimpleObjectTree) None#

Init from another SimpleObjectList, without making copies of objects

iter_items(item: QTreeWidgetItem | None = None) Iterator[QTreeWidgetItem]#

Recursively iterate over all items

get_item_from_id(item_id) QTreeWidgetItem#

Return QTreeWidgetItem from id (stored in item’s data)

get_current_item_id(object_only: bool = False) str | None#

Return current item id

set_current_item_id(uuid: str, extend: bool = False) None#

Set current item by id

get_current_group_id() str#

Return current group ID

populate_tree() None#

Populate tree with objects

update_tree() None#

Update tree

add_group_item(group: ObjectGroup) None#

Add group item

add_object_item(obj: SignalObj | ImageObj, group_id: str, set_current: bool = True) None#

Add item

update_item(uuid: str) None#

Update item

remove_item(oid: str, refresh: bool = True) None#

Remove item

item_double_clicked(item: QTreeWidgetItem) None#

Item was double-clicked: open a pop-up plot dialog

contextMenuEvent(event: QContextMenuEvent) None#

Override Qt method

Get object dialog#

class cdl.core.gui.objectview.GetObjectDialog(parent: QW.QWidget, panel: BaseDataPanel, title: str, minimum_size: tuple[int, int] = None)#

Get object dialog box

Parameters:
  • parent – parent widget

  • panel – data panel

  • title – dialog title

  • minimum_size – minimum size (width, height)

get_current_object_uuid() str#

Return current object uuid

Object view#

class cdl.core.gui.objectview.ObjectView(parent: QW.QWidget, objmodel: ObjectModel)#

Object handling panel list widget, object (sig/ima) lists

paintEvent(event)#

Reimplement Qt method

dragEnterEvent(event: QDragEnterEvent) None#

Reimplement Qt method

dragLeaveEvent(event: QDragLeaveEvent) None#

Reimplement Qt method

dragMoveEvent(event: QDragMoveEvent) None#

Reimplement Qt method

get_all_group_uuids() list[str]#

Return all group uuids, in a list ordered by group position in the tree

get_all_object_uuids() dict[str, list[str]]#

Return all object uuids, in a dictionary that maps group uuids to the list of object uuids in each group, in the correct order

dropEvent(event: QDropEvent) None#

Reimplement Qt method

get_current_object() SignalObj | ImageObj | None#

Return current object

set_current_object(obj: SignalObj | ImageObj) None#

Set current object

get_sel_group_items() list[QTreeWidgetItem]#

Return selected group items

get_sel_group_uuids() list[str]#

Return selected group uuids

get_sel_object_items() list[QTreeWidgetItem]#

Return selected object items

get_sel_object_uuids(include_groups: bool = False) list[str]#

Return selected objects uuids.

Parameters:

include_groups – If True, also return objects from selected groups.

Returns:

List of selected objects uuids.

get_sel_objects(include_groups: bool = False) list[SignalObj | ImageObj]#

Return selected objects.

If include_groups is True, also return objects from selected groups.

get_sel_groups() list[ObjectGroup]#

Return selected groups

item_selection_changed() None#

Refreshing the selection of objects and groups, emitting the SIG_SELECTION_CHANGED signal which triggers the update of the object properties panel, the plot items and the actions of the toolbar and menu bar.

This method is called when the user selects or deselects items in the tree. It is also called when the user clicks on an item that was already selected.

This method emits the SIG_SELECTION_CHANGED signal.

select_objects(selection: list[SignalObj | ImageObj | int | str]) None#

Select multiple objects

Parameters:

selection (list) – list of objects, object numbers (1 to N) or object uuids

select_groups(groups: list[ObjectGroup | int | str] | None = None) None#

Select multiple groups

Parameters:

groups – list of groups, group numbers (1 to N), group names or None (select all groups). Defaults to None.

move_up()#

Move selected objects/groups up

move_down()#

Move selected objects/groups down