From 81e415e7b1092218fcc456d78405497629e85a0b Mon Sep 17 00:00:00 2001 From: brenda-br Date: Fri, 24 Feb 2023 13:57:46 +0530 Subject: Fix #64 Limit One Node Socket One Connection --- .gitignore | 1 + src/main/python/utils/Graphics.py | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index fdd98bd..a78f687 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ src/main/Simulator/simulateEQN.mos src/main/Simulator/Undo.dat src/main/Simulator/Redo.dat +*.pyc diff --git a/src/main/python/utils/Graphics.py b/src/main/python/utils/Graphics.py index 139fcba..e3eab7a 100644 --- a/src/main/python/utils/Graphics.py +++ b/src/main/python/utils/Graphics.py @@ -301,7 +301,7 @@ class NodeSocket(QtWidgets.QGraphicsItem): cursor = QCursor( Qt.ArrowCursor ) QApplication.instance().setOverrideCursor(cursor) - if self.type == 'op': + if self.type == 'op'and len(self.out_lines) == 0: rect = self.boundingRect() pointA = QtCore.QPointF(rect.x() + rect.width()/(2), rect.y() + rect.height()/(2)) pointA = self.mapToScene(pointA) @@ -309,7 +309,7 @@ class NodeSocket(QtWidgets.QGraphicsItem): self.new_line = NodeLine(pointA, pointB ,'op') self.out_lines.append(self.new_line) self.scene().addItem(self.new_line) - elif self.type == 'in': + elif self.type == 'in' and len(self.in_lines) == 0: rect = self.boundingRect() pointA = self.mapToScene(event.pos()) pointB = QtCore.QPointF(rect.x() + rect.width()/(2), rect.y() + rect.height()/(2)) @@ -348,7 +348,7 @@ class NodeSocket(QtWidgets.QGraphicsItem): item = self.scene().itemAt(event.scenePos().toPoint(),QtGui.QTransform()) stm = ['MaterialStream','EngStm'] item.other_line=self.new_line - if (self.type == 'op') and (item.type == 'in'): + if self.type == 'op' and item.type == 'in' and len(item.in_lines) == 0: self.new_line.source = self self.new_line.target = item item.in_lines.append(self.new_line) @@ -370,7 +370,7 @@ class NodeSocket(QtWidgets.QGraphicsItem): if(tg_no_input_lines > 0): tg.obj.disableInputDataTab(tg.dock_widget) - elif (self.type =='in') and (item.type == 'op'): + elif self.type =='in' and item.type == 'op' and len(item.out_lines) == 0: self.new_line.source = item self.new_line.target = self item.out_lines.append(self.new_line) -- cgit