summaryrefslogtreecommitdiff
path: root/src/main/python
diff options
context:
space:
mode:
authorbrenda-br2023-02-24 13:57:46 +0530
committerbrenda-br2023-02-24 13:57:46 +0530
commit81e415e7b1092218fcc456d78405497629e85a0b (patch)
treedebb0d294d2676bd28b65c7b84d1a4157b2c5a15 /src/main/python
parent061cd655cec06ac51718baa248b3ed0934d8c586 (diff)
downloadChemical-Simulator-GUI-81e415e7b1092218fcc456d78405497629e85a0b.tar.gz
Chemical-Simulator-GUI-81e415e7b1092218fcc456d78405497629e85a0b.tar.bz2
Chemical-Simulator-GUI-81e415e7b1092218fcc456d78405497629e85a0b.zip
Fix #64 Limit One Node Socket One Connection
Diffstat (limited to 'src/main/python')
-rw-r--r--src/main/python/utils/Graphics.py8
1 files changed, 4 insertions, 4 deletions
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)