diff options
author | brenda-br | 2023-02-21 13:04:53 +0530 |
---|---|---|
committer | brenda-br | 2023-02-21 13:07:55 +0530 |
commit | 2fd33c0f594531aa473664f5ddf71d3af1c9f427 (patch) | |
tree | 4324a03bccec98df588db447bdaf05c574e1a1e0 /src/main/python | |
parent | ace3fdf49db84e65c78a98a7cb81986bfbff3816 (diff) | |
download | Chemical-PFD-2fd33c0f594531aa473664f5ddf71d3af1c9f427.tar.gz Chemical-PFD-2fd33c0f594531aa473664f5ddf71d3af1c9f427.tar.bz2 Chemical-PFD-2fd33c0f594531aa473664f5ddf71d3af1c9f427.zip |
Fix #32 Select all and delete working
Diffstat (limited to 'src/main/python')
-rw-r--r-- | src/main/python/utils/graphics.py | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/main/python/utils/graphics.py b/src/main/python/utils/graphics.py index b66e68b..c4e1843 100644 --- a/src/main/python/utils/graphics.py +++ b/src/main/python/utils/graphics.py @@ -105,17 +105,15 @@ class CustomScene(QGraphicsScene): # (slot) used to delete all selected items, and add undo action for each of them if self.selectedItems(): for item in self.selectedItems(): - if(issubclass(item.__class__,shapes.LineGripItem) or issubclass(item.__class__,shapes.SizeGripItem) ): - itemToDelete = item.parentItem() - else: - itemToDelete = item - self.count = 0 - if(issubclass(itemToDelete.__class__,shapes.NodeItem)): - for i in itemToDelete.lineGripItems: - for j in i.lines: - self.count+=1 - self.undoStack.push(deleteCommand(j, self)) - self.undoStack.push(deleteCommand(itemToDelete, self)) + if issubclass(item.__class__,shapes.NodeItem) or isinstance(item,shapes.Line): + itemToDelete = item + self.count = 0 + if(issubclass(itemToDelete.__class__,shapes.NodeItem)): + for i in itemToDelete.lineGripItems: + for j in i.lines: + self.count+=1 + self.undoStack.push(deleteCommand(j, self)) + self.undoStack.push(deleteCommand(itemToDelete, self)) def itemMoved(self, movedItem, lastPos): #item move event, checks if item is moved |