Canvas Scene (scene)
Canvas Graphics Scene
- class orangecanvas.canvas.scene.CanvasScene(*args: Any, **kwargs: Any)[source]
Bases:
PyQt5.QtWidgets.QGraphicsSceneA Graphics Scene for displaying an
Schemeinstance.- node_item_added(NodeItem)
Signal emitted when a
NodeItemhas been added to the scene.
- node_item_removed(NodeItem)
Signal emitted when a
NodeItemhas been removed from the scene.
- link_item_added(LinkItem)
Signal emitted when a new
LinkItemhas been added to the scene.
- link_item_removed(LinkItem)
Signal emitted when a
LinkItemhas been removed.
- annotation_added(Annotation)
Signal emitted when a
Annotationitem has been added.
- annotation_removed(Annotation)
Signal emitted when a
Annotationitem has been removed.
- node_item_position_changed(NodeItem, QPointF)
Signal emitted when the position of a
NodeItemhas changed.
- node_item_double_clicked(NodeItem)
Signal emitted when an
NodeItemhas 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_hovered(LinkItem)
Link item has been hovered
- link_item_activated
Link item has been activated (double-clicked)
- set_scheme(scheme: orangecanvas.scheme.scheme.Scheme) None[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: orangecanvas.registry.base.WidgetRegistry) None[source]
Set the widget registry.
- add_node_item(item: orangecanvas.canvas.items.nodeitem.NodeItem) orangecanvas.canvas.items.nodeitem.NodeItem[source]
Add a
NodeIteminstance to the scene.
- add_node(node: orangecanvas.scheme.node.SchemeNode) orangecanvas.canvas.items.nodeitem.NodeItem[source]
Add and return a default constructed
NodeItemfor aSchemeNodeinstance node. If the node is already in the scene do nothing and just return its item.
- new_node_item(widget_desc: orangecanvas.registry.description.WidgetDescription, category_desc: Optional[orangecanvas.registry.description.CategoryDescription] = None) orangecanvas.canvas.items.nodeitem.NodeItem[source]
Construct an new
NodeItemfrom a WidgetDescription. Optionally also set CategoryDescription.
- remove_node_item(item: orangecanvas.canvas.items.nodeitem.NodeItem) None[source]
Remove item (
NodeItem) from the scene.
- remove_node(node: orangecanvas.scheme.node.SchemeNode) None[source]
Remove the
NodeIteminstance that was previously constructed for aSchemeNodenode using the add_node method.
- node_items() List[orangecanvas.canvas.items.nodeitem.NodeItem][source]
Return all
NodeIteminstances in the scene.
- add_link_item(item: orangecanvas.canvas.items.linkitem.LinkItem) orangecanvas.canvas.items.linkitem.LinkItem[source]
Add a link (
LinkItem) to the scene.
- add_link(scheme_link: orangecanvas.scheme.link.SchemeLink) orangecanvas.canvas.items.linkitem.LinkItem[source]
Create and add a
LinkIteminstance for aSchemeLinkinstance. If the link is already in the scene do nothing and just return itsLinkItem.
- new_link_item(source_item: orangecanvas.canvas.items.nodeitem.NodeItem, source_channel: orangecanvas.registry.description.OutputSignal, sink_item: orangecanvas.canvas.items.nodeitem.NodeItem, sink_channel: orangecanvas.registry.description.InputSignal) orangecanvas.canvas.items.linkitem.LinkItem[source]
Construct and return a new
LinkItem
- remove_link_item(item: orangecanvas.canvas.items.linkitem.LinkItem) orangecanvas.canvas.items.linkitem.LinkItem[source]
Remove a link (
LinkItem) from the scene.
- remove_link(scheme_link: orangecanvas.scheme.link.SchemeLink) None[source]
Remove a
LinkIteminstance that was previously constructed for aSchemeLinkinstance link using the add_link method.
- link_items() List[orangecanvas.canvas.items.linkitem.LinkItem][source]
Return all
LinkItems in the scene.
- add_annotation_item(annotation: orangecanvas.canvas.items.annotationitem.Annotation) orangecanvas.canvas.items.annotationitem.Annotation[source]
Add an
Annotationitem to the scene.
- add_annotation(scheme_annot: orangecanvas.scheme.annotations.BaseSchemeAnnotation) orangecanvas.canvas.items.annotationitem.Annotation[source]
Create a new item for
SchemeAnnotationand 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: orangecanvas.canvas.items.annotationitem.Annotation) None[source]
Remove an
Annotationinstance from the scene.
- remove_annotation(scheme_annotation: orangecanvas.scheme.annotations.BaseSchemeAnnotation) None[source]
Remove an
Annotationinstance that was previously added usingadd_anotation().
- annotation_items() List[orangecanvas.canvas.items.annotationitem.Annotation][source]
Return all
Annotationitems in the scene.
- node_for_item(item: orangecanvas.canvas.items.nodeitem.NodeItem) orangecanvas.scheme.node.SchemeNode[source]
Return the SchemeNode for the item.
- item_for_node(node: orangecanvas.scheme.node.SchemeNode) orangecanvas.canvas.items.nodeitem.NodeItem[source]
Return the
NodeIteminstance for aSchemeNode.
- link_for_item(item: orangecanvas.canvas.items.linkitem.LinkItem) orangecanvas.scheme.link.SchemeLink[source]
Return the SchemeLink for `item (
LinkItem).
- item_for_link(link: orangecanvas.scheme.link.SchemeLink) orangecanvas.canvas.items.linkitem.LinkItem[source]
Return the
LinkItemfor aSchemeLink
- selected_node_items() List[orangecanvas.canvas.items.nodeitem.NodeItem][source]
Return the selected
NodeItem’s.
- selected_annotation_items() List[orangecanvas.canvas.items.annotationitem.Annotation][source]
Return the selected
Annotation’s
- node_links(node_item: orangecanvas.canvas.items.nodeitem.NodeItem) List[orangecanvas.canvas.items.linkitem.LinkItem][source]
Return all links from the node_item (
NodeItem).
- node_output_links(node_item: orangecanvas.canvas.items.nodeitem.NodeItem) List[orangecanvas.canvas.items.linkitem.LinkItem][source]
Return a list of all output links from node_item.
- node_input_links(node_item: orangecanvas.canvas.items.nodeitem.NodeItem) List[orangecanvas.canvas.items.linkitem.LinkItem][source]
Return a list of all input links for node_item.
- neighbor_nodes(node_item: orangecanvas.canvas.items.nodeitem.NodeItem) List[orangecanvas.canvas.items.nodeitem.NodeItem][source]
Return a list of node_item’s (class:NodeItem) neighbor nodes.
- item_at(pos: QPointF, type_or_tuple: Optional[Type[T]] = None, buttons: Qt.MouseButtons = 0) Optional[T][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).
- orangecanvas.canvas.scene.grab_svg(scene: PyQt5.QtWidgets.QGraphicsScene) str[source]
Return a SVG rendering of the scene contents.
- Parameters
scene (
CanvasScene) –