From 010d2b2efe951056f5337e2dee586dba30b90bad Mon Sep 17 00:00:00 2001 From: Ales Erjavec Date: Tue, 10 Aug 2021 12:20:41 +0200 Subject: [PATCH] document: Update names --- orangecanvas/document/editlinksdialog.py | 22 +++++++++---------- .../document/tests/test_editlinksdialog.py | 2 +- orangecanvas/document/usagestatistics.py | 14 ++++++------ 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/orangecanvas/document/editlinksdialog.py b/orangecanvas/document/editlinksdialog.py index 35f1be045..d0ffee8e5 100644 --- a/orangecanvas/document/editlinksdialog.py +++ b/orangecanvas/document/editlinksdialog.py @@ -27,12 +27,11 @@ Qt, QObject, QSize, QSizeF, QPointF, QRectF ) -from ..scheme import compatible_channels +from ..scheme import Node, compatible_channels from ..registry import InputSignal, OutputSignal from ..utils import type_str if typing.TYPE_CHECKING: - from ..scheme import SchemeNode IOPair = Tuple[OutputSignal, InputSignal] @@ -89,14 +88,12 @@ def __setupUi(self): self.setSizeGripEnabled(False) - def setNodes(self, source_node, sink_node): - # type: (SchemeNode, SchemeNode) -> None + def setNodes(self, source_node: Node, sink_node: Node) -> None: """ - Set the source/sink nodes (:class:`.SchemeNode` instances) + Set the source/sink nodes (:class:`.Node` instances) between which to edit the links. .. note:: This should be called before :func:`setLinks`. - """ self.scene.editWidget.setNodes(source_node, sink_node) @@ -582,10 +579,10 @@ def __init__(self, parent=None, direction=Qt.LeftToRight, self.layout().setAlignment(self.__channelLayout, Qt.AlignVCenter | channel_alignemnt) - self.node: Optional[SchemeNode] = None + self.node: Optional[Node] = None self.channels: Union[List[InputSignal], List[OutputSignal]] = [] if node is not None: - self.setSchemeNode(node) + self.setNode(node) def setIconSize(self, size): """ @@ -619,11 +616,12 @@ def icon(self): return QIcon(self.__icon) def setSchemeNode(self, node): - # type: (SchemeNode) -> None - """ - Set an instance of `SchemeNode`. The widget will be initialized - with its icon and channels. + self.setNode(node) + def setNode(self, node: Node) -> None: + """ + Set an instance of `Node`. The widget will be initialized with its + icon and channels. """ self.node = node channels: Union[List[InputSignal], List[OutputSignal]] diff --git a/orangecanvas/document/tests/test_editlinksdialog.py b/orangecanvas/document/tests/test_editlinksdialog.py index 127586180..49526df73 100644 --- a/orangecanvas/document/tests/test_editlinksdialog.py +++ b/orangecanvas/document/tests/test_editlinksdialog.py @@ -60,7 +60,7 @@ def test_editlinksnode(self): scene.addItem(node) node = EditLinksNode(direction=Qt.RightToLeft) - node.setSchemeNode(sink_node) + node.setNode(sink_node) node.setPos(300, 0) scene.addItem(node) diff --git a/orangecanvas/document/usagestatistics.py b/orangecanvas/document/usagestatistics.py index 06fbe54d7..2583564ed 100644 --- a/orangecanvas/document/usagestatistics.py +++ b/orangecanvas/document/usagestatistics.py @@ -10,7 +10,7 @@ from AnyQt.QtCore import QCoreApplication, QSettings from orangecanvas import config -from orangecanvas.scheme import SchemeNode, SchemeLink, Scheme +from orangecanvas.scheme import Node, Link, Scheme log = logging.getLogger(__name__) @@ -152,7 +152,7 @@ def begin_extend_action(self, from_sink, extended_widget): Parameters ---------- from_sink : bool - extended_widget : SchemeNode + extended_widget : Node """ if not self.is_enabled(): return @@ -187,7 +187,7 @@ def begin_insert_action(self, via_drag, original_link): Parameters ---------- via_drag : bool - original_link : SchemeLink + original_link : Link """ if not self.is_enabled(): return @@ -275,7 +275,7 @@ def log_node_add(self, widget): Parameters ---------- - widget : SchemeNode + widget : Node """ if not self.is_enabled(): return @@ -302,7 +302,7 @@ def log_node_remove(self, widget): Parameters ---------- - widget : SchemeNode + widget : Node """ if not self.is_enabled(): return @@ -327,7 +327,7 @@ def log_link_add(self, link): Parameters ---------- - link : SchemeLink + link : Link """ if not self.is_enabled(): return @@ -340,7 +340,7 @@ def log_link_remove(self, link): Parameters ---------- - link : SchemeLink + link : Link """ if not self.is_enabled(): return