Example #1
0
 def setUndo(self, doc, replaceBrightRange=None, replaceData=None, isRedo=False):
     undoEvent = [doc.getBrightRange()]
     if replaceData != None:
         undoEvent.append(doc.data)
     else:
         undoEvent.append(None)
     if isRedo == False:
         self.clearRedos()
     self.undoList.append(misc.pickle(undoEvent))
Example #2
0
 def setUndo(self, doc, replaceBrightRange=None, replaceDatas=None, isRedo=False):
     undoEvent = [doc.getBrightRange()]
     for i in range(len(replaceDatas)):
         if replaceDatas[i] != None:
             undoEvent.append(doc.rgb[i].data)
         else:
             undoEvent.append(None)
     if isRedo == False:
         self.clearRedos()
     self.undoList.append(misc.pickle(undoEvent))
Example #3
0
 def undo(self, doc):
     print "Undo.undo()"
     if len(self.undoList) > 0:
         redoEvent = [doc.getBrightRange()]
         undoEvent = misc.unpickle(self.undoList[-1])
         doc.setBrightRange(undoEvent[0])
         if undoEvent[1] != None:
             redoEvent.append(doc.data)
             doc.data = undoEvent[1]
         else:
             redoEvent.append(None)
         self.undoList[-1].close()
         self.undoList = self.undoList[0:-1]
         self.redoList.append(misc.pickle(redoEvent))
Example #4
0
 def undo(self, doc):
     print "UndoRGB.undo()"
     if len(self.undoList) > 0:
         redoEvent = [doc.getBrightRange()]
         undoEvent = misc.unpickle(self.undoList[-1])
         doc.setBrightRange(undoEvent[0])
         for i in range(1, len(undoEvent)):
             if undoEvent[i] != None:
                 redoEvent.append(doc.rgb[i - 1].data)
                 doc.rgb[i - 1].data = undoEvent[i]
             else:
                 redoEvent.append(None)
         self.undoList[-1].close()
         self.undoList = self.undoList[0:-1]
         self.redoList.append(misc.pickle(redoEvent))