summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrenda-br2023-02-12 19:03:10 +0530
committerbrenda-br2023-02-12 19:03:10 +0530
commitbba17b5009e7b7542c6df063fb2f57b094b4389c (patch)
tree1801c15a429d33c20bdac0a4f4e4298aec63b34b
parentef7ea4c100e23b4e1ef19d64fc144ea39531d25d (diff)
downloadChemical-PFD-bba17b5009e7b7542c6df063fb2f57b094b4389c.tar.gz
Chemical-PFD-bba17b5009e7b7542c6df063fb2f57b094b4389c.tar.bz2
Chemical-PFD-bba17b5009e7b7542c6df063fb2f57b094b4389c.zip
reinsertLines Function indexing fix
-rw-r--r--src/main/python/utils/graphics.py18
1 files 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