PapersView.UndoContext

g GObject.Object GObject.Object PapersView.UndoContext PapersView.UndoContext GObject.Object->PapersView.UndoContext

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (document_model)

add_action (handler, data)

get_last_action ()

get_last_handler ()

redo ()

undo ()

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

document-model

PapersView.DocumentModel

r/w/co

The document model associated with this undo context

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class PapersView.UndoContext(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

PapersView.UndoContextClass

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_undo is being called).

classmethod new(document_model)
Parameters:

document_model (PapersView.DocumentModel) –

Return type:

PapersView.UndoContext

add_action(handler, data)
Parameters:

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_undo will be called on handler with data.

get_last_action()
Return type:

object or None

get_last_handler()
Returns:

The last handler

Return type:

PapersView.UndoHandler

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 PpsUndoHandler associated to the action. While undoing, the PpsUndoHandler should add a new action with pps_undo_context_add_action to 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:

PapersView.DocumentModel

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The document model associated with this undo context