Logo Search packages:      
Sourcecode: matplotlib version File versions

def enthought::traits::ui::undo::UndoHistory::add (   self,
  undo_item,
  extend = False 
)

Adds an UndoItem to the history.

Definition at line 329 of file undo.py.

00329                                                :
        """ Adds an UndoItem to the history.
        """
        if extend:
            self.extend( undo_item )
            return

        # Try to merge the new undo item with the previous item if allowed:
        now = self.now
        if now > 0:
            previous = self.history[ now - 1 ]
            if (len( previous ) == 1) and previous[0].merge_undo( undo_item ):
                self.history[ now: ] = []
                return

        old_len = len( self.history )
        self.history[ now: ] = [ [ undo_item ] ]
        self.now += 1
        if self.now == 1:
            self.undoable = True
        if self.now <= old_len:
            self.redoable = False

    #---------------------------------------------------------------------------
    #  Extends the most recent 'undo' item:
    #---------------------------------------------------------------------------

    def extend ( self, undo_item ):


Generated by  Doxygen 1.6.0   Back to index