summaryrefslogtreecommitdiff
path: root/src/main/python/utils/graphics.py
diff options
context:
space:
mode:
authorbrenda-br2023-02-14 11:25:47 +0530
committerbrenda-br2023-02-14 11:25:47 +0530
commit278478886a4023056671700f32b6a6491a835ee2 (patch)
tree4f8fdb6928f850ec92ffa6f16c9f15317ad2fdfc /src/main/python/utils/graphics.py
parentbba17b5009e7b7542c6df063fb2f57b094b4389c (diff)
downloadChemical-PFD-278478886a4023056671700f32b6a6491a835ee2.tar.gz
Chemical-PFD-278478886a4023056671700f32b6a6491a835ee2.tar.bz2
Chemical-PFD-278478886a4023056671700f32b6a6491a835ee2.zip
Minor changes on Deleting Node Line and Filtering Move Command when reinserting Lines
Diffstat (limited to 'src/main/python/utils/graphics.py')
-rw-r--r--src/main/python/utils/graphics.py26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/main/python/utils/graphics.py b/src/main/python/utils/graphics.py
index 8dc7682..615843f 100644
--- a/src/main/python/utils/graphics.py
+++ b/src/main/python/utils/graphics.py
@@ -115,7 +115,8 @@ class CustomScene(QGraphicsScene):
for j in i.lines:
self.count+=1
self.undoStack.push(deleteCommand(j, self))
- self.undoStack.push(deleteCommand(itemToDelete, self))
+ if itemToDelete.__class__ != shapes.line.Grabber:
+ self.undoStack.push(deleteCommand(itemToDelete, self))
def itemMoved(self, movedItem, lastPos):
#item move event, checks if item is moved
@@ -148,14 +149,19 @@ class CustomScene(QGraphicsScene):
def reInsertLines(self):
currentIndex = self.undoStack.index()
- 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)
+ i = 2
+ skipper = 0
+ while i != self.count+2+skipper:
+ currentCommand = self.undoStack.command(currentIndex-i)
+ if not self.undoStack.text(currentIndex-i).__contains__('Move'):
+ currentLine = currentCommand.diagramItem
+ startGrip = currentCommand.startGripItem
+ endGrip = currentCommand.endGripItem
+ index_LineGripStart = currentCommand.indexLGS
+ index_LineGripEnd = currentCommand.indexLGE
+ startGrip.lineGripItems[index_LineGripStart].lines.append(currentLine)
+ endGrip.lineGripItems[index_LineGripEnd].lines.append(currentLine)
+ else:
+ skipper+=1
self.undoStack.setIndex(currentIndex-i)
i+=1