summaryrefslogtreecommitdiff
path: root/src/main/python/shapes/shapes.py
diff options
context:
space:
mode:
authorsumit2020-06-10 08:50:29 +0530
committersumit2020-06-10 08:50:29 +0530
commit6772ab7c10214b816b74d36b37d8ddf68230da5a (patch)
tree29f10fa33293d6b65d6893d6779752d7637223ac /src/main/python/shapes/shapes.py
parent640e2e92688fa79a23aa229d12cb4e4437a377f7 (diff)
downloadChemical-PFD-6772ab7c10214b816b74d36b37d8ddf68230da5a.tar.gz
Chemical-PFD-6772ab7c10214b816b74d36b37d8ddf68230da5a.tar.bz2
Chemical-PFD-6772ab7c10214b816b74d36b37d8ddf68230da5a.zip
fix remove of line with item
Diffstat (limited to 'src/main/python/shapes/shapes.py')
-rw-r--r--src/main/python/shapes/shapes.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/main/python/shapes/shapes.py b/src/main/python/shapes/shapes.py
index a795f6a..fe92938 100644
--- a/src/main/python/shapes/shapes.py
+++ b/src/main/python/shapes/shapes.py
@@ -203,6 +203,15 @@ class LineGripItem(GripItem):
self.setFlag(QGraphicsItem.ItemIsSelectable, True)
self.setPen(QPen(QColor("black"), -1))
+ def itemChange(self, change, value):
+ """
+ Moves position of grip item on resize
+ """
+ if change == QGraphicsItem.ItemSceneHasChanged and not self.scene():
+ if self.line and self.line.scene():
+ self.line.scene().removeItem(self.line)
+ return super(LineGripItem, self).itemChange(change, value)
+
def point(self, index):
"""
yields a list of positions of grip items in a node item
@@ -439,23 +448,13 @@ class NodeItem(QGraphicsSvgItem):
self.updateLineGripItem()
self.updateSizeGripItem()
return
- if change == QGraphicsItem.ItemSceneHasChanged:
+ if change == QGraphicsItem.ItemSceneHasChanged and self.scene():
self.addGripItem()
self.updateLineGripItem()
self.updateSizeGripItem()
return
return super(NodeItem, self).itemChange(change, value)
- def removeFromCanvas(self):
- """This function is used to remove item from canvas
- :return:
- """
- for item in self.lineGripItems:
- item.removeConnectedLines()
- for item in self.sizeGripItems:
- item.removeFromCanvas()
- self.scene().removeItem(self)
-
def hoverEnterEvent(self, event):
"""defines shape highlighting on Mouse Over
"""