Uranium
Application Framework
Loading...
Searching...
No Matches
UM.Operations.OperationStack.OperationStack Class Reference

Public Member Functions

None __init__ (self, controller)
 
def push (self, operation)
 
def undo (self)
 
def redo (self)
 
def getOperations (self)
 
def canUndo (self)
 
def canRedo (self)
 

Static Public Attributes

Signal changed = Signal()
 

Protected Member Functions

def _onToolOperationStarted (self, tool)
 
def _onToolOperationStopped (self, tool)
 
def _doMerge (self)
 

Protected Attributes

 _operations
 
 _current_index
 
 _lock
 
 _merge_operations
 
 _controller
 

Static Protected Attributes

float _merge_window = 1.0
 

Detailed Description

A stack of operations.

This maintains the history of operations, which allows for undoing and
re-doing these operations.

Member Function Documentation

◆ _doMerge()

def UM.Operations.OperationStack.OperationStack._doMerge (   self)
protected
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.

◆ canRedo()

def UM.Operations.OperationStack.OperationStack.canRedo (   self)
Whether we can redo any more operations.

:return: True if we can redo any more operations, or False otherwise.

◆ canUndo()

def UM.Operations.OperationStack.OperationStack.canUndo (   self)
Whether we can undo any more operations.

:return: True if we can undo any more operations, or False otherwise.

◆ getOperations()

def UM.Operations.OperationStack.OperationStack.getOperations (   self)
Get the list of operations in the stack.

The end of the list represents the more recent operations.

:return: A list of the operations on the stack, in order.

◆ push()

def UM.Operations.OperationStack.OperationStack.push (   self,
  operation 
)
Push an operation on the stack.

This will perform the following things in sequence:
- If the current index is pointing to an item lower in the stack than
the top, remove all operations from the current index to the top.
- Append the operation to the stack.
- Call redo() on the operation.
- Perform merging of operations.

:param operation: :type{Operation} The operation to push onto the stack.

◆ redo()

def UM.Operations.OperationStack.OperationStack.redo (   self)
Redo the next operation.

This will call redo() on the current operation and increment the current index.

◆ undo()

def UM.Operations.OperationStack.OperationStack.undo (   self)
Undo the current operation.

This will call undo() on the current operation and decrement the current index.

The documentation for this class was generated from the following file: