Decorator undoable allows an instance method to be undone.

    It does this by wrapping the method call as a Command, then calling self.do() on the command.

    Classes which use this decorator should implement a do() method like such:

        def do(self, command):
            return self.undo_manager.do(command)

def undoable(method):
    """
    Decorator undoable allows an instance method to be undone.

    It does this by wrapping the method call as a Command, then calling self.do() on the command.

    Classes which use this decorator should implement a do() method like such:

        def do(self, command):
            return self.undo_manager.do(command)
    """
    def undoable_method(self, *args):
        return self.do(Command(self, method, *args))
    return undoable_method