From 2fd33c0f594531aa473664f5ddf71d3af1c9f427 Mon Sep 17 00:00:00 2001 From: brenda-br Date: Tue, 21 Feb 2023 13:04:53 +0530 Subject: Fix #32 Select all and delete working --- src/main/python/utils/graphics.py | 20 +++++++++----------- 1 file 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 -- cgit