summaryrefslogtreecommitdiff
path: root/Graphics.py
diff options
context:
space:
mode:
Diffstat (limited to 'Graphics.py')
-rw-r--r--Graphics.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/Graphics.py b/Graphics.py
index f5129d4..6e7a086 100644
--- a/Graphics.py
+++ b/Graphics.py
@@ -17,7 +17,9 @@ import PyQt5.QtWidgets as QtWidgets
from component_selector import *
from dockWidget import dockWidget
import datetime
+
from container import *
+import container
from Streams import *
from UnitOperations import *
@@ -336,6 +338,7 @@ class NodeSocket(QtWidgets.QGraphicsItem):
self.newLine.source.parent.obj.add_connection(0,self.newLine.target.parent.obj)
if self.newLine.target.parent.obj.type not in stm:
self.newLine.target.parent.obj.add_connection(1,self.newLine.source.parent.obj)
+
elif (self.type =='in') and (item.type == 'op'):
self.newLine.source = item
self.newLine.target = self
@@ -345,6 +348,7 @@ class NodeSocket(QtWidgets.QGraphicsItem):
self.newLine.source.parent.obj.add_connection(0,self.newLine.target.parent.obj)
if self.newLine.target.parent.obj.type not in stm:
self.newLine.target.parent.obj.add_connection(1,self.newLine.source.parent.obj)
+
else:
self.scene().removeItem(self.newLine)
if(self.newLine in self.inLines):
@@ -352,7 +356,21 @@ class NodeSocket(QtWidgets.QGraphicsItem):
if(self.newLine in self.outLines):
self.outLines.remove(self.newLine)
del self.newLine
- super(NodeSocket, self).mouseReleaseEvent(event)
+ super(NodeSocket, self).mouseReleaseEvent(event)
+
+ try:
+ data = container.get_last_list('Undo')
+ comp_selected = data[-1]
+ data.remove(comp_selected)
+ for i in range(len(data)):
+ if data[i].name == self.newLine.source.parent.obj.name:
+ data[i] = self.newLine.source.parent.obj
+ elif data[i].name == self.newLine.target.parent.obj.name:
+ data[i] = self.newLine.target.parent.obj
+ data.append(comp_selected)
+ container.PUSH('Undo', data)
+ except Exception as e:
+ print(e)
def getCenter(self):
rect = self.boundingRect()