Infinity.AdoptedUndoGrouping

g GObject.Object GObject.Object Infinity.AdoptedUndoGrouping Infinity.AdoptedUndoGrouping GObject.Object->Infinity.AdoptedUndoGrouping

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

end_group (allow_group_with_next)

get_algorithm ()

get_redo_size ()

get_undo_size ()

set_algorithm (algorithm, user)

start_group (allow_group_with_prev)

Virtual Methods

Inherited:

GObject.Object (7)

do_group_requests (first, second)

Properties

Name

Type

Flags

Short Description

algorithm

Infinity.AdoptedAlgorithm

r/w

The algorithm for which to group requests

user

Infinity.AdoptedUser

r/w

The user for which to group requests

Signals

Inherited:

GObject.Object (1)

Name

Short Description

group-requests

This signal is emitted whenever the Infinity.AdoptedUndoGrouping needs to decide whether to put two requests into the same undo group or not.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class Infinity.AdoptedUndoGrouping(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Infinity.AdoptedUndoGroupingClass

Infinity.AdoptedUndoGrouping is an opaque data type. You should only access it via the public API functions.

classmethod new()
Returns:

A new Infinity.AdoptedUndoGrouping, to be freed via GObject.Object.unref().

Return type:

Infinity.AdoptedUndoGrouping

Creates a new Infinity.AdoptedUndoGrouping. To start grouping requests, set a user whose requests to group via Infinity.AdoptedUndoGrouping.set_algorithm(). Before doing so you might want to connect to Infinity.AdoptedUndoGrouping ::group-requests, so the user’s initial requests can be grouped correctly.

end_group(allow_group_with_next)
Parameters:

allow_group_with_next (bool) – Whether subsequent requests are allow to be part of this group if Infinity.AdoptedUndoGrouping ::group-requests allows.

When Infinity.AdoptedUndoGrouping.start_group() was called before, then this function restores the normal behaviour of grouping requests.

get_algorithm()
Returns:

self's algorithm.

Return type:

Infinity.AdoptedAlgorithm

Returns the Infinity.AdoptedAlgorithm for self.

get_redo_size()
Returns:

The number of requests in the current redo group.

Return type:

int

Returns the number of requests to redo so that a whole group is being redone. This takes into account that possibly not the whole group cannot be undone due to the Infinity.AdoptedAlgorithm :max-total-log-size constraint.

get_undo_size()
Returns:

The number of requests in the current undo group.

Return type:

int

Returns the number of requests to undo so that a whole group is being undone. This takes into account that possibly not the whole group cannot be undone due to the Infinity.AdoptedAlgorithm :max-total-log-size constraint.

set_algorithm(algorithm, user)
Parameters:

Sets the algorithm and user to group requests for. This function will group all requests in user’s request log, and also each new request that is added to it’s log. Requests that cannot be undone anymore (because they are too old), will be correctly taken care off.

start_group(allow_group_with_prev)
Parameters:

allow_group_with_prev (bool) – Whether the new group can be part of the previous group if Infinity.AdoptedUndoGrouping ::group-requests allows.

Makes all requests issued after this call belong into the same group, i.e. they will be undone at once. This can make sense for example when the user copy+pastes something into the document which causes multiple requests to be generated. A call to Infinity.AdoptedUndoGrouping.end_group() restores the normal behavior.

do_group_requests(first, second) virtual
Parameters:
Return type:

bool

Signal Details

Infinity.AdoptedUndoGrouping.signals.group_requests(adopted_undo_grouping, first, second)
Signal Name:

group-requests

Flags:

RUN_LAST

Parameters:
Return type:

bool

This signal is emitted whenever the Infinity.AdoptedUndoGrouping needs to decide whether to put two requests into the same undo group or not. A signal handler should return True if they belong into the same group or False otherwise. Note however that the two requests may not immediately follow each other because other users may have issued requests inbetween. Check the vector times of the requests to find out, using Infinity.AdoptedRequest.get_vector().

Property Details

Infinity.AdoptedUndoGrouping.props.algorithm
Name:

algorithm

Type:

Infinity.AdoptedAlgorithm

Default Value:

None

Flags:

READABLE, WRITABLE

The algorithm for which to group requests

Infinity.AdoptedUndoGrouping.props.user
Name:

user

Type:

Infinity.AdoptedUser

Default Value:

None

Flags:

READABLE, WRITABLE

The user for which to group requests