3
6ßL]D  ã               @   s8   d dl mZmZmZmZ ddlmZ G dd„ deƒZdS )é    )ÚBoolÚInstanceÚ	InterfaceÚUnicodeé   )ÚIUndoManagerc               @   sX   e Zd ZdZeZeZee	ƒZ
eZdd„ Zdd„ Zdd„ Zdd	„ Zddd„Zddd„ZdS )ÚICommandStackzµ The command stack interface.  A command stack is responsible for
    managing the changes to a data model and recording those changes so that
    they can be undone or redone.
    c             C   s   dS )a¢   This begins a macro by creating an empty command with the given
        'name'.  The commands passed to all subsequent calls to 'push()' will
        be contained in the macro until the next call to 'end_macro()'.  Macros
        may be nested.  The stack is disabled (ie. nothing can be undone or
        redone) while a macro is being created (ie. while there is an
        outstanding 'end_macro()' call).
        N© )ÚselfÚnamer	   r	   úC/tmp/pip-install-5sebvq2j/apptools/apptools/undo/i_command_stack.pyÚbegin_macro7   s    zICommandStack.begin_macroc             C   s   dS )zÈ This clears the stack, without undoing or redoing any commands, and
        leaves the stack in a clean state.  It is typically used when all
        changes to the data have been abandoned.
        Nr	   )r
   r	   r	   r   Úclear@   s    zICommandStack.clearc             C   s   dS )z This ends a macro. Nr	   )r
   r	   r	   r   Ú	end_macroF   s    zICommandStack.end_macroc             C   s   dS )a   This executes a command and saves it on the command stack so that
        it can be subsequently undone and redone.  'command' is an instance
        that implements the ICommand interface.  Its 'do()' method is called
        to execute the command.  If any value is returned by 'do()' then it is
        returned by 'push()'.  The command stack will keep a reference to the
        result so that it can recognise it as an argument to a subsequent
        command (which allows a script to properly save a result needed later).
        Nr	   )r
   Úcommandr	   r	   r   ÚpushI   s    zICommandStack.pushr   c             C   s   dS )zü If 'sequence_nr' is 0 then the last command that was undone is
        redone and any result returned.  Otherwise commands are redone up to
        and including the given 'sequence_nr' and any result of the last of
        these is returned.
        Nr	   )r
   Úsequence_nrr	   r	   r   ÚredoS   s    zICommandStack.redoc             C   s   dS )z” If 'sequence_nr' is 0 then the last command is undone.  Otherwise
        commands are undone up to and including the given 'sequence_nr'.
        Nr	   )r
   r   r	   r	   r   ÚundoZ   s    zICommandStack.undoN)r   )r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úcleanr   Z	redo_namer   r   Zundo_managerZ	undo_namer   r   r   r   r   r   r	   r	   r	   r   r      s   	

r   N)Z
traits.apir   r   r   r   Zi_undo_managerr   r   r	   r	   r	   r   Ú<module>   s   