From bba17b5009e7b7542c6df063fb2f57b094b4389c Mon Sep 17 00:00:00 2001 From: brenda-br Date: Sun, 12 Feb 2023 19:03:10 +0530 Subject: reinsertLines Function indexing fix --- src/main/python/utils/graphics.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/python/utils/graphics.py b/src/main/python/utils/graphics.py index c9dbed7..8dc7682 100644 --- a/src/main/python/utils/graphics.py +++ b/src/main/python/utils/graphics.py @@ -148,14 +148,14 @@ class CustomScene(QGraphicsScene): def reInsertLines(self): currentIndex = self.undoStack.index() - index = self.count+1 - if(self.count!=0): - self.count-=1 - currentLine = self.undoStack.command(currentIndex-index).diagramItem - startGrip = self.undoStack.command(currentIndex-index).startGrip - endGrip = self.undoStack.command(currentIndex-index).endGrip - index_LineGripStart = self.undoStack.command(currentIndex-index).indexLGS - index_LineGripEnd = self.undoStack.command(currentIndex-index).indexLGE + i = 2 + while i != self.count+2: + currentLine = self.undoStack.command(currentIndex-i).diagramItem + startGrip = self.undoStack.command(currentIndex-i).startGrip + endGrip = self.undoStack.command(currentIndex-i).endGrip + index_LineGripStart = self.undoStack.command(currentIndex-i).indexLGS + index_LineGripEnd = self.undoStack.command(currentIndex-i).indexLGE startGrip.lineGripItems[index_LineGripStart].lines.append(currentLine) endGrip.lineGripItems[index_LineGripEnd].lines.append(currentLine) - self.undoStack.command(currentIndex-index).undo() + self.undoStack.setIndex(currentIndex-i) + i+=1 -- cgit