Canvas Scene (scene)

Canvas Graphics Scene

class orangecanvas.canvas.scene.CanvasScene(*args, **kwargs)[source]

Bases: PyQt5.QtWidgets.QGraphicsScene

A Graphics Scene for displaying an Scheme instance.

node_item_added(NodeItem)

Signal emitted when a NodeItem has been added to the scene.

node_item_removed(NodeItem)

Signal emitted when a NodeItem has been removed from the scene.

Signal emitted when a new LinkItem has been added to the scene.

Signal emitted when a LinkItem has been removed.

annotation_added(Annotation)

Signal emitted when a Annotation item has been added.

annotation_removed(Annotation)

Signal emitted when a Annotation item has been removed.

node_item_position_changed(NodeItem, QPointF)

Signal emitted when the position of a NodeItem has changed.

node_item_double_clicked(NodeItem)

Signal emitted when an NodeItem has been double clicked.

node_item_activated(NodeItem)

An node item has been activated (double-clicked)

node_item_hovered(NodeItem)

An node item has been hovered

Link item has been hovered

Link item has been activated (double-clicked)

clear_scene()[source]

Clear (reset) the scene.

set_scheme(scheme)[source]

Set the scheme to display. Populates the scene with nodes and links already in the scheme. Any further change to the scheme will be reflected in the scene.

Parameters

scheme (Scheme) –

set_registry(registry)[source]

Set the widget registry.

set_anchor_layout(layout)[source]

Set an AnchorLayout

anchor_layout()[source]

Return the anchor layout instance.

set_channel_names_visible(visible)[source]

Set the channel names visibility.

channel_names_visible()[source]

Return the channel names visibility state.

set_node_animation_enabled(enabled)[source]

Set node animation enabled state.

add_node_item(item)[source]

Add a NodeItem instance to the scene.

add_node(node)[source]

Add and return a default constructed NodeItem for a SchemeNode instance node. If the node is already in the scene do nothing and just return its item.

new_node_item(widget_desc, category_desc=None)[source]

Construct an new NodeItem from a WidgetDescription. Optionally also set CategoryDescription.

remove_node_item(item)[source]

Remove item (NodeItem) from the scene.

remove_node(node)[source]

Remove the NodeItem instance that was previously constructed for a SchemeNode node using the add_node method.

node_items()[source]

Return all NodeItem instances in the scene.

Add a link (LinkItem) to the scene.

Create and add a LinkItem instance for a SchemeLink instance. If the link is already in the scene do nothing and just return its LinkItem.

Construct and return a new LinkItem

Remove a link (LinkItem) from the scene.

Remove a LinkItem instance that was previously constructed for a SchemeLink instance link using the add_link method.

Return all LinkItem s in the scene.

add_annotation_item(annotation)[source]

Add an Annotation item to the scene.

add_annotation(scheme_annot)[source]

Create a new item for SchemeAnnotation and add it to the scene. If the scheme_annot is already in the scene do nothing and just return its item.

remove_annotation_item(annotation)[source]

Remove an Annotation instance from the scene.

remove_annotation(scheme_annotation)[source]

Remove an Annotation instance that was previously added using add_anotation().

annotation_items()[source]

Return all Annotation items in the scene.

commit_scheme_node(node)[source]

Commit the node into the scheme.

Commit a scheme link.

node_for_item(item)[source]

Return the SchemeNode for the item.

item_for_node(node)[source]

Return the NodeItem instance for a SchemeNode.

Return the SchemeLink for `item (LinkItem).

Return the LinkItem for a SchemeLink

selected_node_items()[source]

Return the selected NodeItem’s.

selected_annotation_items()[source]

Return the selected Annotation’s

Return all links from the node_item (NodeItem).

Return a list of all output links from node_item.

Return a list of all input links for node_item.

neighbor_nodes(node_item)[source]

Return a list of node_item’s (class:NodeItem) neighbor nodes.

item_at(pos, type_or_tuple=None, buttons=0)[source]

Return the item at pos that is an instance of the specified type (type_or_tuple). If buttons (Qt.MouseButtons) is given only return the item if it is the top level item that would accept any of the buttons (QGraphicsItem.acceptedMouseButtons).

mousePressEvent(self, QGraphicsSceneMouseEvent)[source]
mouseMoveEvent(self, QGraphicsSceneMouseEvent)[source]
mouseReleaseEvent(self, QGraphicsSceneMouseEvent)[source]
mouseDoubleClickEvent(self, QGraphicsSceneMouseEvent)[source]
keyPressEvent(self, QKeyEvent)[source]
keyReleaseEvent(self, QKeyEvent)[source]
contextMenuEvent(self, QGraphicsSceneContextMenuEvent)[source]
dragEnterEvent(self, QGraphicsSceneDragDropEvent)[source]
dragMoveEvent(self, QGraphicsSceneDragDropEvent)[source]
dragLeaveEvent(self, QGraphicsSceneDragDropEvent)[source]
dropEvent(self, QGraphicsSceneDragDropEvent)[source]
orangecanvas.canvas.scene.grab_svg(scene)[source]

Return a SVG rendering of the scene contents.

Parameters

scene (CanvasScene) –