diff options
author | brenda-br | 2023-02-24 13:57:46 +0530 |
---|---|---|
committer | brenda-br | 2023-02-24 13:57:46 +0530 |
commit | 81e415e7b1092218fcc456d78405497629e85a0b (patch) | |
tree | debb0d294d2676bd28b65c7b84d1a4157b2c5a15 | |
parent | 061cd655cec06ac51718baa248b3ed0934d8c586 (diff) | |
download | Chemical-Simulator-GUI-81e415e7b1092218fcc456d78405497629e85a0b.tar.gz Chemical-Simulator-GUI-81e415e7b1092218fcc456d78405497629e85a0b.tar.bz2 Chemical-Simulator-GUI-81e415e7b1092218fcc456d78405497629e85a0b.zip |
Fix #64 Limit One Node Socket One Connection
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | src/main/python/utils/Graphics.py | 8 |
2 files changed, 5 insertions, 4 deletions
@@ -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) |