Logo Search packages:      
Sourcecode: matplotlib version File versions

def enthought::traits::ui::undo::ListUndoItem::merge_undo (   self,
  undo_item 
)

Merges two undo items if possible.

Reimplemented from enthought::traits::ui::undo::AbstractUndoItem.

Definition at line 265 of file undo.py.

00265                                       :
        """ Merges two undo items if possible.
        """
        # Discard undo items that are identical to us. This is to eliminate
        # the same undo item being created by multiple listeners monitoring the
        # same list for changes:
        if (isinstance( undo_item, self.__class__ )        and
           (self.object is undo_item.object)               and
           (self.name  == undo_item.name)                  and
           (self.index == undo_item.index)):
            added   = undo_item.added
            removed = undo_item.removed
            if ((len( self.added )   == len( added )) and
                (len( self.removed ) == len( removed ))):
                for i, item in enumerate( self.added ):
                    if item is not added[i]:
                        break
                else:
                    for i, item in enumerate( self.removed ):
                        if item is not removed[i]:
                            break
                    else:
                        return True
        return False

    #---------------------------------------------------------------------------
    #  Returns a 'pretty print' form of the object:
    #---------------------------------------------------------------------------

    def __repr__ ( self ):


Generated by  Doxygen 1.6.0   Back to index