InfTextGtk.Buffer¶
- Subclasses:
None
Methods¶
- Inherited:
GObject.Object (37), InfText.Buffer (18), Infinity.Buffer (2)
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
GObject.Object (7), InfText.Buffer (17), Infinity.Buffer (2)
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w |
The user currently inserting text locally |
||
r/w |
The translucency of the user color |
||
r/w/co |
The underlaying |
||
r/w |
Saturation of user colors in a HSV color model |
||
r/w |
Whether to show user colors initially for newly written text |
||
r/w/co |
A user table of the participating users |
||
r/w |
Value of user colors in a HSV color model |
||
r/w |
Whether to make inactive users active when the insertion mark in the TextBuffer moves |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class InfTextGtk.Buffer(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
InfTextGtk.Buffer
is an opaque data type. You should only access it via the public API functions.- classmethod new(buffer, user_table)¶
- Parameters:
buffer (
Gtk.TextBuffer
) – The underlayingGtk.TextBuffer
.user_table (
Infinity.UserTable
) – TheInfinity.UserTable
containing the participating users.
- Returns:
- Return type:
Creates a new
InfTextGtk.Buffer
wrapping buffer. It implements theInfText.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
) – AGtk.TextIter
pointing into self's underlyingGtk.TextBuffer
.- Returns:
True
if iter was moved, orFalse
otherwise.- user_on:
A location to store a
InfText.User
, orNone
.- user_off:
Another location to store a
InfText.User
, orNone
.
- 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 returnsFalse
. Otherwise it returnsTrue
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
) – AGtk.TextIter
pointing into self's underlyingGtk.TextBuffer
.- Returns:
True
if iter was moved, orFalse
otherwise.- user_on:
A location to store a
InfText.User
, orNone
.- user_off:
Another location to store a
InfText.User
, orNone
.
- 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 returnsFalse
. Otherwise it returnsTrue
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
orNone
Returns the current active user for self.
- get_author(location)¶
- Parameters:
location (
Gtk.TextIter
) – AGtk.TextIter
which is not the end iterator.- Returns:
A
InfText.User
, orNone
.- Return type:
InfText.User
orNone
Returns the
InfText.User
which wrote the character at location. If there is no such user, thenNone
is returned.
- get_saturation()¶
- Returns:
The saturation used for user colors.
- Return type:
Returns the saturation part of the HSV user color.
- get_show_user_colors()¶
-
Returns whether newly written text is attributed with the author’s user color or not.
- get_text_buffer()¶
- Returns:
- Return type:
Returns the underlaying
Gtk.TextBuffer
.
- get_user_for_tag(tag)¶
- Parameters:
tag (
Gtk.TextTag
) – AGtk.TextTag
from self's underlyingGtk.TextBuffer
's tag table.- Returns:
A
InfText.User
, orNone
.- Return type:
InfText.User
orNone
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 returnsNone
.
- get_value()¶
- Returns:
The value used for user colors.
- Return type:
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:
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 isInfinity.UserStatus.INACTIVE
. See alsoInfTextGtk.Buffer.set_wake_on_cursor_movement
().
- is_author_toggle(iter)¶
- Parameters:
iter (
Gtk.TextIter
) – AGtk.TextIter
pointing into self's underlyingGtk.TextBuffer
.- Returns:
Whether text attribution changes at iter.
- user_on:
A location to store a
InfText.User
, orNone
.- user_off:
Another location to store a
InfText.User
, orNone
.
- 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, orFalse
otherwise. If it returnsTrue
, 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 toNone
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
orNone
) – AInfText.User
, orNone
.
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 aGtk.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:
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 isInfinity.UserStatus.INACTIVE
.If wake is
True
, then the user status changes toInfinity.UserStatus.ACTIVE
in that case. If wake isFalse
, then the user status staysInfinity.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 isTrue
, show user colors if they have previously been hidden via a call to this function with show beingFalse
.
Property Details¶
- InfTextGtk.Buffer.props.active_user¶
- Name:
active-user
- Type:
- Default Value:
- Flags:
The user currently inserting text locally
- InfTextGtk.Buffer.props.alpha¶
-
The translucency of the user color
- InfTextGtk.Buffer.props.buffer¶
- Name:
buffer
- Type:
- Default Value:
- Flags:
The underlaying
Gtk.TextBuffer
- InfTextGtk.Buffer.props.saturation¶
-
Saturation of user colors in a HSV color model
- InfTextGtk.Buffer.props.show_user_colors¶
-
Whether to show user colors initially for newly written text
- InfTextGtk.Buffer.props.user_table¶
- Name:
user-table
- Type:
- Default Value:
- Flags:
A user table of the participating users
- InfTextGtk.Buffer.props.value¶
-
Value of user colors in a HSV color model