nodedge.scene_history¶
Scene history module containing SceneHistory
class.
-
class
nodedge.scene_history.
SceneHistory
(scene: Scene, maxLength: int = 32)¶ Bases:
object
SceneHistory
classIt contains the code for storing all the previous actions of the user in a dictionary.
-
property
currentStep
¶ Property representing the current step on the history stack loaded in the scene.
- Returns
current step on the history stack
- Return type
int
-
property
stackSize
¶ Number of elements that can be stored in the history stack.
- Returns
History stack size
- Return type
int
-
property
stack
¶ The stack is a private member of the history, it cannot be modified outside of the class. This property only has a getter to implement this constraint.
- Returns
history stack
- Return type
List[dict]
-
addHistoryModifiedListener
(callback: Callable) → None¶ Register the callback associated with a HistoryModified event.
- Parameters
callback – callback function
-
addHistoryStoredListener
(callback: Callable) → None¶ Register the callback associated with a HistoryStored event.
- Parameters
callback – callback function
-
addHistoryRestoredListener
(callback: Callable) → None¶ Register the callback associated with a HistoryRestored event.
- Parameters
callback – callback function
-
clear
(storeInitialStamp: bool = True)¶ Reset the history stack.
- Parameters
storeInitialStamp (
bool
) – if True, an initial stamp will be stored in the history after cleaning. Otherwise, the history will be empty after cleaning, leading to the first actions to be non cancellable.
-
storeInitialStamp
() → None¶ Helper function usually used when new or open file operations are requested.
-
property
canUndo
¶ This property returns
True
if the undo operation is available for the current history stack.- Return type
bool
-
property
canRedo
¶ This property returns
True
if the redo operation is available for the current history stack.- Return type
bool
-
undo
() → None¶ Perform the undo operation.
-
redo
() → None¶ Perform the redo operation
-
store
(desc: str, sceneIsModified: bool = True) → None¶ Store the history stamp into the history stack.
- Parameters
desc (
str
) – Description of current history stampsceneIsModified (
bool
) – ifTrue
marks thatScene
has been modified.
Triggers:
History Modified
History Stored
-
restore
() → None¶ Restore history stamp from history stack.
Triggers:
History Modified event
History Restored event
-
restoreStep
(step: int) → None¶ Restore the step of the stack given as argument.
- Parameters
step (
int
) – index of the stack to be restored
-
property