schrodinger.application.livedesign.ldclient_proxy module

LDClient proxy module to maintain global access of LDClient in the entire session. Proxy delegates attribute access to the underlying LDClient instance and so can be used as a drop-in replacement for LDClient.

Proxy will notify listeners when the underlying LDClient instance is changed. Listeners should reload any data that depends on the LDClient instance. See LDClientProxy for example usage.

Users should ensure ldclient package is installed and importable.

class schrodinger.application.livedesign.ldclient_proxy.Version(major, minor)

Bases: tuple

major

Alias for field number 0

minor

Alias for field number 1

class schrodinger.application.livedesign.ldclient_proxy.LDMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: str, enum.Enum

Enumerate the different LiveDesign modes.

DRUG_DISCOVERY = 'DRUG_DISCOVERY'
MATERIALS_SCIENCE = 'MATERIALS_SCIENCE'
exception schrodinger.application.livedesign.ldclient_proxy.LDClientConnectionError

Bases: Exception

Exception when connection to LiveDesign fails.

class schrodinger.application.livedesign.ldclient_proxy.LDClientProxy(*args, **kwargs)

Bases: PyQt6.QtCore.QObject

Proxy class for LDClient. It’s a singleton class that will delegate attribute access to the underlying LDClient instance when one is connected.

Example usage for users fetching/uploading data from/to LiveDesign,

Usage:

class LDProjectsManager:

    def __init__(self):
        self.projects = []
        self.ld_client = ldclient_proxy.LDClientProxy.getInstance()
        self.ld_client.connectionChanged.connect(self._reloadProjects)

    def _reloadProjects(self):
        # Get projects from the new LiveDesign server.
        projects = []
        if ld_client.check_connection():
            projects = ld_client.projects()
        self.projects = projects

Example usage for users connecting/disconnecting from LiveDesign,

Usage:

ld_client = ldclient_proxy.LDClientProxy.getInstance()
ld_client.connect(
    host='https://livedesign.schrodinger.com',
    username='username',
    password='password',
)
# Disconnect from LiveDesign.
ld_client.disconnect()
Variables
  • connectionChanged (QtCore.pyqtSignal) – Signal emitted when the underlying LDClient instance is changed on connecting to a LiveDesign server or disconnecting from the current LiveDesign server. Listeners should reload any data that depends on the LDClient instance.

  • connectToLiveDesignRequested (QtCore.pyqtSignal) – Signal emitted when we try to access attribute on underlying LDClient instance but aren’t connected.

connectionChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

connectToLiveDesignRequested

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

classmethod getInstance() schrodinger.application.livedesign.ldclient_proxy.LDClientProxy

Get singleton LDClientProxy instance.

connect(host: str, username: Optional[str] = None, password: Optional[str] = None, token: Optional[str] = None, compatibility_mode: Optional[schrodinger.application.livedesign.ldclient_proxy.Version] = Version(major=2023, minor=1))

Connect to LiveDesign and notify listeners. Username and password or refresh token is required to log in.

See _create_ld_client() for argument documentation.

disconnect()

Disconnect from LiveDesign and notify listeners if required.

check_connection() bool

Check if LDClient instance is available.

get_host() Optional[str]
get_username() Optional[str]

Return user connected to LiveDesign if connected else None.

get_token() Optional[str]
get_password() Optional[str]
get_LD_version() Optional[schrodinger.application.livedesign.ldclient_proxy.Version]

Version of the LD Server if connected, else None.

get_LD_mode() Optional[str]

Return the LD instance mode. For example, if the instance is in DRUG_DISCOVERY or MATERIAL_SCIENCE mode, etc. Note, that for older LD versions (< 8.6), there was no concept of a LD mode, and thus we assume the default mode of DRUG_DISCOVERY.

Checks if the current LD server supports structure group search

Returns

True/False if supported, None if not connected to LD.

__init__(*args, **kwargs)
af2SettingsGetValue()
af2SettingsSetValue(value)