InfText.Session¶
- Subclasses:
None
Methods¶
- Inherited:
Infinity.AdoptedSession (7), Infinity.Session (19), GObject.Object (37), Infinity.CommunicationObject (3)
- Structs:
class |
|
class |
|
class |
|
|
|
|
Virtual Methods¶
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/c |
Minimum number of milliseconds between caret update broadcasts |
Signals¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class InfText.Session(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod join_user(proxy, name, status, hue, caret_position, selection_length, func, *user_data)¶
- Parameters:
proxy (
Infinity.SessionProxy
) – AInfinity.SessionProxy
with aInfText.Session
session.name (
str
) – The name of the user to join.status (
Infinity.UserStatus
) – The initial status of the user to join. Must not beInfinity.UserStatus.UNAVAILABLE
.hue (
float
) – The user color of the user to join.caret_position (
int
) – The initial position of the new user’s cursor.selection_length (
int
) – The initial length of the new user’s selection.func (
Infinity.RequestFunc
) – Function to call after completion of the request, orNone
.user_data (
object
orNone
) – Additional data to pass to func.
- Returns:
A
Infinity.Request
, orNone
.- Return type:
This functions creates a user join request for an
InfText.Session
. This is a shortcut forInfinity.SessionProxy.join_user
().
- classmethod new(manager, buffer, io, status, sync_group, sync_connection)¶
- Parameters:
manager (
Infinity.CommunicationManager
) – AInfinity.CommunicationManager
.buffer (
InfText.Buffer
) – An initialInfText.Buffer
.io (
Infinity.Io
) – AInfinity.Io
object.status (
Infinity.SessionStatus
) – The initial status of the session.sync_group (
Infinity.CommunicationGroup
orNone
) – A group in which the session is synchronized. Ignored if status isInfinity.SessionStatus.RUNNING
.sync_connection (
Infinity.XmlConnection
orNone
) – A connection to synchronize the session from. Ignored if status isInfinity.SessionStatus.RUNNING
.
- Returns:
A new
InfText.Session
.- Return type:
Creates a new
InfText.Session
. The communication manager is used to send and receive requests from subscription and synchronization. buffer will be set to be initially empty if the session is initially synchronized (see below). io is required to trigger timeouts.If status is
Infinity.SessionStatus.PRESYNC
orInfinity.SessionStatus.SYNCHRONIZING
, then the session will initially be sychronized, meaning the initial content is retrieved from sync_connection. If you are subscribed to the session, set the subscription group viaInfinity.Session.set_subscription_group
().
- classmethod new_with_user_table(manager, buffer, io, user_table, status, sync_group, sync_connection)¶
- Parameters:
manager (
Infinity.CommunicationManager
) – AInfinity.CommunicationManager
.buffer (
InfText.Buffer
) – An initialInfText.Buffer
.io (
Infinity.Io
) – AInfinity.Io
object.user_table (
Infinity.UserTable
) – AInfinity.UserTable
.status (
Infinity.SessionStatus
) – The initial status for the session.sync_group (
Infinity.CommunicationGroup
orNone
) – A group in which the session is synchronized. Ignored if status isInfinity.SessionStatus.RUNNING
.sync_connection (
Infinity.XmlConnection
orNone
) – A connection to synchronize the session from. Ignored if status isInfinity.SessionStatus.RUNNING
.
- Returns:
A new
InfText.Session
.- Return type:
Creates a new
InfText.Session
. The connection manager is used to send and receive requests from subscription and synchronization. buffer will be set to be initially empty if the session is initially synchronized (see below). io is required to trigger timeouts.If status is
Infinity.SessionStatus.PRESYNC
orInfinity.SessionStatus.SYNCHRONIZING
, then the session will initially be sychronized, meaning the initial content is retrieved from sync_connection. If you are subscribed to the session, set the subscription group viaInfinity.Session.set_subscription_group
().user_table is used as an initial user table. The user table should only contain unavailable users, if any, that may rejoin during the session. If there was an available user in the user table, it would probably belong to another session, but different sessions cannot share the same user object.
- flush_requests_for_user(user)¶
- Parameters:
user (
InfText.User
) – TheInfText.User
for which to flush messages.
This function sends all pending requests for user immediately. Requests that modify the buffer are not queued normally, but cursor movement requests are delayed in case are issued frequently, to save bandwidth.
The main purpose of this function is to send all pending requests before changing a user’s status to inactive or unavailable since inactive users are automatically activated as soon as they issue a request.
TODO: We should probably detect this automatically, without requiring people to call this function, i.e. flush requests for local users just before they become inactive.
user must have the
Infinity.UserFlags.LOCAL
flag set.
- set_user_color(user, hue)¶
- Parameters:
user (
InfText.User
) – A localInfText.User
from self's user table.hue (
float
) – New hue value for user's color. Ranges from 0.0 (red) to 1.0 (red).
Changes the user color of user. user must have the
Infinity.UserFlags.LOCAL
flag set.