PapersView.UndoContext¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w/co |
The document model associated with this undo context |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class PapersView.UndoContext(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
This context singleton manages two stacks of #PpsUndoAction that contain actions that may be undone or redone.
These actions may be added by a number of objects that implement
PapersView.UndoHandler(e.g. the annotations context). Each handler provides a pointer to an opaque structure that contains data to undo the action.The switch between the undo/redo stacks is done transparently: actions are added to the redo stack if and only if another action is being undone (i.e.
pps_undo_context_undois being called).- classmethod new(document_model)¶
- Parameters:
document_model (
PapersView.DocumentModel) –- Return type:
- add_action(handler, data)¶
- Parameters:
handler (
PapersView.UndoHandler) – an object implementingPapersView.UndoHandlerdata (
objectorNone) – a pointer to a struct that handler will use to undo an action
This method adds a new action to the undo (or redo if it is used while undoing) stack. If it is undone in the future,
pps_undo_handler_undowill be called on handler with data.
- get_last_handler()¶
- Returns:
The last handler
- Return type:
- redo()¶
Similar to the undo method, but taking an action from the redo stack.
- undo()¶
This pops the last action on the undo stack and undoes it by calling the undo interface method of the
PpsUndoHandlerassociated to the action. While undoing, thePpsUndoHandlershould add a new action withpps_undo_context_add_actionto redo what has just been undone, it will be added to the redo stack by the undo context.
Property Details¶
- PapersView.UndoContext.props.document_model¶
- Name:
document-model- Type:
- Default Value:
- Flags:
The document model associated with this undo context