InfTextGtk.Buffer

g GObject.GInterface GObject.GInterface InfText.Buffer InfText.Buffer GObject.GInterface->InfText.Buffer Infinity.Buffer Infinity.Buffer GObject.GInterface->Infinity.Buffer GObject.Object GObject.Object InfTextGtk.Buffer InfTextGtk.Buffer GObject.Object->InfTextGtk.Buffer InfText.Buffer->InfTextGtk.Buffer Infinity.Buffer->InfTextGtk.Buffer

Subclasses:

None

Methods

Inherited:

GObject.Object (37), InfText.Buffer (18), Infinity.Buffer (2)

Structs:

GObject.ObjectClass (5)

class

new (buffer, user_table)

backward_to_author_toggle (iter)

ensure_author_tags_priority ()

forward_to_author_toggle (iter)

get_active_user ()

get_author (location)

get_saturation ()

get_show_user_colors ()

get_text_buffer ()

get_user_for_tag (tag)

get_value ()

get_wake_on_cursor_movement ()

is_author_toggle (iter)

set_active_user (user)

set_fade (alpha)

set_saturation_value (saturation, value)

set_show_user_colors (show)

set_wake_on_cursor_movement (wake)

show_user_colors (show, start, end)

Virtual Methods

Inherited:

GObject.Object (7), InfText.Buffer (17), Infinity.Buffer (2)

Properties

Inherited:

Infinity.Buffer (1)

Name

Type

Flags

Short Description

active-user

InfText.User

r/w

The user currently inserting text locally

alpha

float

r/w

The translucency of the user color

buffer

Gtk.TextBuffer

r/w/co

The underlaying Gtk.TextBuffer

saturation

float

r/w

Saturation of user colors in a HSV color model

show-user-colors

bool

r/w

Whether to show user colors initially for newly written text

user-table

Infinity.UserTable

r/w/co

A user table of the participating users

value

float

r/w

Value of user colors in a HSV color model

wake-on-cursor-movement

bool

r/w

Whether to make inactive users active when the insertion mark in the TextBuffer moves

Signals

Inherited:

GObject.Object (1), InfText.Buffer (2)

Fields

Inherited:

GObject.Object (1), InfText.Buffer (2)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class InfTextGtk.Buffer(**kwargs)
Bases:

GObject.Object, InfText.Buffer, Infinity.Buffer

Abstract:

No

Structure:

InfTextGtk.BufferClass

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

classmethod new(buffer, user_table)
Parameters:
Returns:

A InfTextGtk.Buffer.

Return type:

InfTextGtk.Buffer

Creates a new InfTextGtk.Buffer wrapping buffer. It implements the InfText.Buffer interface by using buffer to store the text. User colors are read from the users from user_table.

backward_to_author_toggle(iter)
Parameters:

iter (Gtk.TextIter) – A Gtk.TextIter pointing into self's underlying Gtk.TextBuffer.

Returns:

True if iter was moved, or False otherwise.

user_on:

A location to store a InfText.User, or None.

user_off:

Another location to store a InfText.User, or None.

Return type:

(bool, user_on: InfText.User, user_off: InfText.User)

Moves iter to the previous point in self's underlying Gtk.TextBuffer where the text has been written by another user. If iter points to the beginning of the buffer, then the function does nothing and returns False. Otherwise it returns True and sets user_on to the user which has written the text on the right hand side of the location iter has been moved to (if non-None) and user_off to the user which has written the left hand side of the location iter has been moved to.

ensure_author_tags_priority()

Ensures that all author tags have the lowest priority of all tags in the underlying Gtk.TextBuffer's tag table. Normally you do not need to use this function if you do not set the priority for your tags explicitely. However, if you do (or are forced to do, because you are using a library that does this, such as GtkSourceView), then you can call this function afterwards to make sure all the user tags have the lowest priority.

forward_to_author_toggle(iter)
Parameters:

iter (Gtk.TextIter) – A Gtk.TextIter pointing into self's underlying Gtk.TextBuffer.

Returns:

True if iter was moved, or False otherwise.

user_on:

A location to store a InfText.User, or None.

user_off:

Another location to store a InfText.User, or None.

Return type:

(bool, user_on: InfText.User, user_off: InfText.User)

Moves iter to the next point in self's underlying Gtk.TextBuffer where the text has been written by another user. If iter points to the end of the buffer, then the function does nothing and returns False. Otherwise it returns True and sets user_on to the user which has written the text on the right hand side of the location iter has been moved to (if non-None) and user_off to the user which has written the left hand side of the location iter has been moved to.

get_active_user()
Returns:

A InfText.User.

Return type:

InfText.User or None

Returns the current active user for self.

get_author(location)
Parameters:

location (Gtk.TextIter) – A Gtk.TextIter which is not the end iterator.

Returns:

A InfText.User, or None.

Return type:

InfText.User or None

Returns the InfText.User which wrote the character at location. If there is no such user, then None is returned.

get_saturation()
Returns:

The saturation used for user colors.

Return type:

float

Returns the saturation part of the HSV user color.

get_show_user_colors()
Returns:

True if user color is applied to newly written text, or False otherwise.

Return type:

bool

Returns whether newly written text is attributed with the author’s user color or not.

get_text_buffer()
Returns:

A Gtk.TextBuffer.

Return type:

Gtk.TextBuffer

Returns the underlaying Gtk.TextBuffer.

get_user_for_tag(tag)
Parameters:

tag (Gtk.TextTag) – A Gtk.TextTag from self's underlying Gtk.TextBuffer's tag table.

Returns:

A InfText.User, or None.

Return type:

InfText.User or None

If tag is an author tag, i.e. used by self to mark text that a certain user has written, then this function returns the InfText.User whose text is marked by tag. If tag is not an author tag then the function returns None.

get_value()
Returns:

The value used for user colors.

Return type:

float

Returns the value part of the HSV user color.

get_wake_on_cursor_movement()
Returns:

Whether to make inactive users active when the insertion mark is moved.

Return type:

bool

Returns whether movement of the insertion point or selection bound of the underlying text buffer causes whether the active user (see InfTextGtk.Buffer.set_active_user()) to become active when its status is Infinity.UserStatus.INACTIVE. See also InfTextGtk.Buffer.set_wake_on_cursor_movement().

is_author_toggle(iter)
Parameters:

iter (Gtk.TextIter) – A Gtk.TextIter pointing into self's underlying Gtk.TextBuffer.

Returns:

Whether text attribution changes at iter.

user_on:

A location to store a InfText.User, or None.

user_off:

Another location to store a InfText.User, or None.

Return type:

(bool, user_on: InfText.User, user_off: InfText.User)

This function returns True if the author of the text in self changes at iter, or False otherwise. If it returns True, then the user who authored the text to the right hand side of iter is stored in user_on (if non-None) and the author of the text to the left hand side of iter is stored in user_off (if non-None). Both can also be set to None if there is unowned text in the buffer or if iter is at the start or end of the buffer.

set_active_user(user)
Parameters:

user (InfText.User or None) – A InfText.User, or None.

Sets the active user for self. The active user is the user by which edits not issued through the InfText.Buffer interface are performed (for example, edits by the user when the underlaying buffer is displayed in a Gtk.TextView).

Note that such modifications should not be performed when no active user is set. Note also the active user must be available and have the Infinity.UserFlags.LOCAL flag set.

set_fade(alpha)
Parameters:

alpha (float) – An alpha value between 0.0 and 1.0.

This functions can be used to show the user background color with limited intensity, such that the background of the Gtk.TextView showing the buffer partly shines through.

An alpha value of 1.0 means to fully show the user background color, a value of 0.0 means to show the given background color. Values inbetween interpolate linearly between the two colors in RGB color space.

The default value for alpha is 1.0.

set_saturation_value(saturation, value)
Parameters:
  • saturation (float) – Saturation to use for user colors.

  • value (float) – Value to use for user colors.

Sets the saturation and value to use for user colors in a HSV color model. The hue is defined by each user’s individual color. The reason why S and V are set locally the same for all users is that they can be adjusted depending on one’s theme: Dark themes want dark user colors, bright themes want bright ones.

set_show_user_colors(show)
Parameters:

show (bool) – Whether to show user colors or not.

If show is True (the default), then the user color is used as background for newly written text by that user. Otherwise, newly written text has no background color.

Note that this setting is for newly written text only. If you want to show or hide user colors for existing text use InfTextGtk.Buffer.show_user_colors().

set_wake_on_cursor_movement(wake)
Parameters:

wake (bool) – Whether to make inactive users active on cursor movement.

This function spcecifies whether movement of the insertion point or selection bound of the underlying text buffer causes the active user (see InfTextGtk.Buffer.set_active_user()) to become active when its status is Infinity.UserStatus.INACTIVE.

If wake is True, then the user status changes to Infinity.UserStatus.ACTIVE in that case. If wake is False, then the user status stays Infinity.UserStatus.INACTIVE, and its caret-position and selection-length properties will be no longer be synchronized to the buffer marks until the user is set active again.

show_user_colors(show, start, end)
Parameters:
  • show (bool) – Whether to show or hide user colors.

  • start (Gtk.TextIter) – Beginning of the range for which to show or hide user colors.

  • end (Gtk.TextIter) – End of the range for which to show or hide user colors.

If show is False, then don’t show user colors (which user wrote what text) as the background of the text, in the range from start to end. If show is True, show user colors if they have previously been hidden via a call to this function with show being False.

Property Details

InfTextGtk.Buffer.props.active_user
Name:

active-user

Type:

InfText.User

Default Value:

None

Flags:

READABLE, WRITABLE

The user currently inserting text locally

InfTextGtk.Buffer.props.alpha
Name:

alpha

Type:

float

Default Value:

1.0

Flags:

READABLE, WRITABLE

The translucency of the user color

InfTextGtk.Buffer.props.buffer
Name:

buffer

Type:

Gtk.TextBuffer

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The underlaying Gtk.TextBuffer

InfTextGtk.Buffer.props.saturation
Name:

saturation

Type:

float

Default Value:

0.35

Flags:

READABLE, WRITABLE

Saturation of user colors in a HSV color model

InfTextGtk.Buffer.props.show_user_colors
Name:

show-user-colors

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Whether to show user colors initially for newly written text

InfTextGtk.Buffer.props.user_table
Name:

user-table

Type:

Infinity.UserTable

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

A user table of the participating users

InfTextGtk.Buffer.props.value
Name:

value

Type:

float

Default Value:

1.0

Flags:

READABLE, WRITABLE

Value of user colors in a HSV color model

InfTextGtk.Buffer.props.wake_on_cursor_movement
Name:

wake-on-cursor-movement

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether to make inactive users active when the insertion mark in the TextBuffer moves