pycrossword
0.4
Pure-Python implementation of a crossword puzzle generator and editor
|
Abstract undoable operation (action) with a do/undo callback pair. More...
Public Member Functions | |
def | __init__ (self, command, undocommand, description='', **kwargs) |
Constructor. More... | |
def | __call__ (self) |
operator () overload to call Operation::command from the instance directly. More... | |
def | undo (self) |
Undoes the executed Operation::command by calling Operation::undocommand. More... | |
Public Attributes | |
command | |
dict the command that can be undone (see constructor for description) More... | |
undocommand | |
dict the reverse command undoing Operation::command (see constructor for description) More... | |
description | |
str optional description of the command (what is does) More... | |
Private Member Functions | |
def | _do_cmd (self, cmd) |
Util method that executes the Do or the Undo command passing their arguments. More... | |
Abstract undoable operation (action) with a do/undo callback pair.
def pycross.utils.undo.Operation.__init__ | ( | self, | |
command, | |||
undocommand, | |||
description = '' , |
|||
** | kwargs | ||
) |
Constructor.
command | dict the 'do' command (direct action) constisting of a pointer to a function/method and arguments passed to it. The dictionary keys are as follows:
|
undocommand | dict the 'undo' command (reverse action undoing whatever 'command' does). Its keys are the same as in 'command'. |
description | str optional description of the command (what is does). The default is an empty string. |
kwargs | keyword arguments any extra objects that can be stored in the Operation instance to address in the do / undo callbacks. |
None
) def pycross.utils.undo.Operation.__call__ | ( | self | ) |
operator () overload to call Operation::command from the instance directly.
|
private |
Util method that executes the Do or the Undo command passing their arguments.
cmd | dict either Operation::command or Operation::undocommand |
def pycross.utils.undo.Operation.undo | ( | self | ) |
Undoes the executed Operation::command by calling Operation::undocommand.
pycross.utils.undo.Operation.command |
dict
the command that can be undone (see constructor for description)
pycross.utils.undo.Operation.description |
str
optional description of the command (what is does)
pycross.utils.undo.Operation.undocommand |
dict
the reverse command undoing Operation::command (see constructor for description)