diff options
author | pravindalve | 2020-12-20 14:33:02 +0530 |
---|---|---|
committer | pravindalve | 2020-12-20 14:33:02 +0530 |
commit | 227d047492feea589f5f9f7d5ecf6cc3d610f84d (patch) | |
tree | a5cea2be4cc9410bcf293e697bd9462018b499ff | |
parent | 6320b12509d638137873ecdb6cb1b948b10d6924 (diff) | |
download | Chemical-Simulator-GUI-227d047492feea589f5f9f7d5ecf6cc3d610f84d.tar.gz Chemical-Simulator-GUI-227d047492feea589f5f9f7d5ecf6cc3d610f84d.tar.bz2 Chemical-Simulator-GUI-227d047492feea589f5f9f7d5ecf6cc3d610f84d.zip |
Fixes for reloading saved connections
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Graphics.py | 20 | ||||
-rw-r--r-- | Undo.dat | bin | 49977 -> 0 bytes |
3 files changed, 12 insertions, 10 deletions
@@ -10,5 +10,5 @@ Simulator/simulateEQN.mos __pycache__/* .idea/* DockWidgets/__pycache__/* -undo.dat +Undo.dat test.py diff --git a/Graphics.py b/Graphics.py index a653d7d..da1954c 100644 --- a/Graphics.py +++ b/Graphics.py @@ -56,38 +56,40 @@ class Graphics(QDialog, QtWidgets.QGraphicsItem): ip = i.input_stms op = i.output_stms for j in ip: + ip_index = ip.index(j) pointA = NodeItem.get_instances(j.name) pointB = NodeItem.get_instances(i.name) rect = pointA.output[0].boundingRect() pointAA = QtCore.QPointF(rect.x() + rect.width()/2, rect.y() + rect.height()/2) pointAA = pointA.output[0].mapToScene(pointAA) - rectB = pointB.input[0].boundingRect() + rectB = pointB.input[ip_index].boundingRect() pointBB = QtCore.QPointF(rectB.x() + rectB.width()/2, rectB.y() + rectB.height()/2) - pointBB = pointB.input[0].mapToScene(pointBB) + pointBB = pointB.input[ip_index].mapToScene(pointBB) self.new_line = NodeLine(pointAA, pointBB, 'in') self.new_line.source = pointA.output[0] self.new_line.target = pointB.input[0] pointA.output[0].out_lines.append(self.new_line) - pointB.input[0].in_lines.append(self.new_line) + pointB.input[ip_index].in_lines.append(self.new_line) pointA.output[0].other_line = self.new_line - pointB.input[0].other_line = self.new_line + pointB.input[ip_index].other_line = self.new_line self.scene.addItem(self.new_line) self.new_line.updatePath() for k in op: + op_index = op.index(k) pointA = NodeItem.get_instances(i.name) pointB = NodeItem.get_instances(k.name) - rect = pointA.output[0].boundingRect() + rect = pointA.output[op_index].boundingRect() pointAA = QtCore.QPointF(rect.x() + rect.width()/2, rect.y() + rect.height()/2) - pointAA = pointA.output[0].mapToScene(pointAA) + pointAA = pointA.output[op_index].mapToScene(pointAA) rectB = pointB.input[0].boundingRect() pointBB = QtCore.QPointF(rectB.x() + rectB.width()/2, rectB.y() + rectB.height()/2) pointBB = pointB.input[0].mapToScene(pointBB) self.new_line = NodeLine(pointAA, pointBB, 'out') - self.new_line.source = pointA.output[0] + self.new_line.source = pointA.output[op.index(k)] self.new_line.target = pointB.input[0] - pointA.output[0].out_lines.append(self.new_line) + pointA.output[op_index].out_lines.append(self.new_line) pointB.input[0].in_lines.append(self.new_line) - pointA.output[0].other_line = self.new_line + pointA.output[op_index].other_line = self.new_line pointB.input[0].other_line = self.new_line self.scene.addItem(self.new_line) self.new_line.updatePath() Binary files differ |