x2go.backends.info.plain module

X2GoServerSessionList and X2GoServerSessionInfo classes - data handling for X2Go server sessions.

This backend handles X2Go server implementations that respond with session infos via server-side PLAIN text output.

class x2go.backends.info.plain.X2GoServerSessionInfo[source]

Bases: object

x2go.backends.info.plain.X2GoServerSessionInfo is used to store all information that is retrieved from the connected X2Go server on X2GoTerminalSession.start() resp. X2GoTerminalSession.resume().

clear()[source]

Clear all properties of a x2go.backends.info.plain.X2GoServerSessionInfo object.

get_session_type()[source]

Get the session type (i.e. ‘D’, ‘K’, ‘R’, ‘S’ or ‘P’).

Returns:

session type

Return type:

str or None (if not initialized)

get_share_mode()[source]

Get the share mode of a shadow session.

Returns:

share mode (0: view-only, 1: full access), None when used for non-desktop-sharing sessions

Return type:

str or None (if not initialized)

get_status()[source]

Retrieve the session’s status from this session info data structure.

Returns:

session status

Return type:

str or None (if not initalized)

initialize(x2go_output, username='', hostname='', local_container='', remote_container='')[source]

Setup a a session info data block, includes parsing of X2Go server’s x2gostartagent stdout values.

Parameters:
  • x2go_output (str) – X2Go server’s x2gostartagent command output, each value separated by a newline character.

  • username (str) – session user name (Default value = ‘’)

  • hostname (str) – hostname of X2Go server (Default value = ‘’)

  • local_container (str) – X2Go client session directory for config files, cache and session logs (Default value = ‘’)

  • remote_container (str) – X2Go server session directory for config files, cache and session logs (Default value = ‘’)

is_desktop_session()[source]

Is this session a desktop session?

Returns:

True if this session is a desktop session, False otherwise

Return type:

bool or None (if not initialized)

is_initialized()[source]

Check if this session info data structure has been initialized.

is_kdrive_session()[source]

Is this session a KDrive based desktop session?

Returns:

True if this session is a KDrive based desktop session, False otherwise

Return type:

bool

is_nx3_session()[source]

Is this session an NXv3 based desktop/rootless session?

Returns:

True if this session is a NXv3 based desktop/rootless session, False otherwise

Return type:

bool

is_protected()[source]

Check if this session info data structure is Write-protected.

is_published_applications_provider()[source]

Detect from session info if this session is a published applications provider.

Returns:

returns True if this session is a published applications provider

Return type:

bool or None (if not initialized)

is_running()[source]

Is this session running?

Returns:

True if the session is running, False otherwise

Return type:

bool or None (if not initialized)

is_suspended()[source]

Is this session suspended?

Returns:

True if the session is suspended, False otherwise

Return type:

bool or None (if not initialized)

protect()[source]

Write-protect this session info data structure.

unprotect()[source]

Remove write-protection from this session info data structure.

update(session_info)[source]

Update all properties of a x2go.backends.info.plain.X2GoServerSessionInfo object.

Parameters:

session_info (X2GoServerSessionInfo*) – a provided session info data structure

class x2go.backends.info.plain.X2GoServerSessionList(x2go_output=None, info_backend=<class 'x2go.backends.info.plain.X2GoServerSessionInfo'>)[source]

Bases: object

x2go.backends.info.plain.X2GoServerSessionList is used to store all information that is retrieved from a connected X2Go server on a X2GoControlSession.list_sessions() call.

get_session_info(session_name)[source]

Retrieve the session information for <session_name>.

Parameters:

session_name (str) – the queried session name

Returns:

the session info of <session_name>

Return type:

X2GoServerSessionInfo* or None

get_session_with(property_name, value, hostname=None)[source]

Find session with a given display number on a given host.

Parameters:
  • property_name (str) – match a session based on this property name

  • value (str) – the resulting session has to match this value for <property_name>

  • hostname (str) – the result has to match this hostname (Default value = None)

get_sessions()[source]

Get the complete sessions property.

Returns:

get this instance’s dictionary of sessions

Return type:

dict

set_sessions(sessions)[source]

Set the sessions property directly by parsing a complete data structure.

Parameters:

sessions (dict) – set this instance’s list of sessions directly