Class Session

class ooodev.utils.session.Session[source]

Session Class for handling user paths within the LibreOffice environment.

property path_sub

Static read-only property

Gets com.sun.star.util.PathSubstitution instance

Returns:

PathSubstitution

Return type:

str

property share

Static read-only property

Gets Program Share dir, such as C:\Program Files\LibreOffice\share

Returns:

directory

Return type:

str

property shared_scripts

Static read-only property

Gets Program Share scripts dir, such as C:\Program Files\LibreOffice\share\Scripts

Returns:

directory

Return type:

str

property shared_py_scripts

Static read-only property

Gets Program Share python dir, such as C:\Program Files\LibreOffice\share\Scripts\python

Returns:

directory

Return type:

str

property user_name

Static read-only property

Get the username from the environment or password database.

First try various environment variables, then the password database. This works on Windows as long as USERNAME is set.

Returns:

user name

Return type:

str

property user_profile

Static read-only property

Gets path to user profile such as, C:\Users\user\AppData\Roaming\LibreOffice\4\user

Returns:

directory

Return type:

str

property user_scripts

Static read-only property

Gets path to user profile scripts such as, C:\Users\user\AppData\Roaming\LibreOffice\4\user\Scripts

Returns:

directory

Return type:

str

property user_py_scripts

Static read-only property

Gets path to user profile python such as, C:\Users\user\AppData\Roaming\LibreOffice\4\user\Scripts\python

Returns:

directory

Return type:

str

PathEnum

alias of PathKind

classmethod register_path(path)[source]

Registers a path into sys.path if it does not exist

Parameters:

path (PathKind) – Type of path to register.

Return type:

None

static substitute(var_name)[source]

Returns the current value of a variable.

The method iterates through its internal variable list and tries to find the given variable. If the variable is unknown a com.sun.star.container.NoSuchElementException is thrown.

Parameters:

var_name (str) – name to search for.

Raises:

com.sun.star.container.NoSuchElementExceptionNoSuchElementException

class ooodev.utils.session.PathKind(value)[source]

Kind of path to register

SHARE_PYTHON = 1
SHARE_USER_PYTHON = 2