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)[source]#

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

initialize_from(sobjlist: SimpleObjectTree) None[source]#

Init from another SimpleObjectList, without making copies of objects

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

Recursively iterate over all items

get_item_from_id(item_id) QTreeWidgetItem[source]#

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

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

Return current item id

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

Set current item by id

get_current_group_id() str[source]#

Return current group ID

populate_tree() None[source]#

Populate tree with objects

update_tree() None[source]#

Update tree

add_group_item(group: ObjectGroup) None[source]#

Add group item

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

Add item

update_item(uuid: str) None[source]#

Update item

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

Remove item

item_double_clicked(item: QTreeWidgetItem) None[source]#

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

contextMenuEvent(event: QContextMenuEvent) None[source]#

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)[source]#

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[source]#

Return current object uuid

Object view#

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

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

paintEvent(event)[source]#

Reimplement Qt method

dragEnterEvent(event: QDragEnterEvent) None[source]#

Reimplement Qt method

dragLeaveEvent(event: QDragLeaveEvent) None[source]#

Reimplement Qt method

dragMoveEvent(event: QDragMoveEvent) None[source]#

Reimplement Qt method

get_all_group_uuids() list[str][source]#

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

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

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[source]#

Reimplement Qt method

get_current_object() SignalObj | ImageObj | None[source]#

Return current object

set_current_object(obj: SignalObj | ImageObj) None[source]#

Set current object

get_sel_group_items() list[QTreeWidgetItem][source]#

Return selected group items

get_sel_group_uuids() list[str][source]#

Return selected group uuids

get_sel_object_items() list[QTreeWidgetItem][source]#

Return selected object items

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

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][source]#

Return selected objects.

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

get_sel_groups() list[ObjectGroup][source]#

Return selected groups

item_selection_changed() None[source]#

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[source]#

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[source]#

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()[source]#

Move selected objects/groups up

move_down()[source]#

Move selected objects/groups down