Uranium
Application Framework
|
A stack of operations. More...
Public Member Functions | |
__init__ (self, controller) | |
push (self, operation) | |
Push an operation on the stack. | |
undo (self) | |
Undo the current operation. | |
redo (self) | |
Redo the next operation. | |
getOperations (self) | |
Get the list of operations in the stack. | |
canUndo (self) | |
Whether we can undo any more operations. | |
canRedo (self) | |
Whether we can redo any more operations. | |
Static Public Attributes | |
changed = Signal() | |
Signal for when the operation stack changes. | |
Protected Member Functions | |
_onToolOperationStarted (self, tool) | |
_onToolOperationStopped (self, tool) | |
_doMerge (self) | |
private: | |
Protected Attributes | |
_operations | |
_current_index | |
_lock | |
_merge_operations | |
_controller | |
_onToolOperationStarted | |
_onToolOperationStopped | |
Static Protected Attributes | |
float | _merge_window = 1.0 |
A stack of operations.
This maintains the history of operations, which allows for undoing and re-doing these operations.
|
protected |
private:
Merges two operations at the current position in the stack.
This merges the "most recent" operation with the one before it. The "most recent" operation is the one that would be undone if the user would trigger an undo, i.e. the one at _current_index.
UM.Operations.OperationStack.OperationStack.canRedo | ( | self | ) |
Whether we can redo any more operations.
UM.Operations.OperationStack.OperationStack.canUndo | ( | self | ) |
Whether we can undo any more operations.
UM.Operations.OperationStack.OperationStack.getOperations | ( | self | ) |
Get the list of operations in the stack.
The end of the list represents the more recent operations.
UM.Operations.OperationStack.OperationStack.push | ( | self, | |
operation | |||
) |
Push an operation on the stack.
This will perform the following things in sequence:
operation | Operation The operation to push onto the stack. |
UM.Operations.OperationStack.OperationStack.redo | ( | self | ) |
Redo the next operation.
This will call redo() on the current operation and increment the current index.
UM.Operations.OperationStack.OperationStack.undo | ( | self | ) |
Undo the current operation.
This will call undo() on the current operation and decrement the current index.