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

__contains__(key, /)

Return key in self.

__len__()

Return len(self).

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

major

Alias for field number 0

minor

Alias for field number 1

class schrodinger.application.livedesign.ldclient_proxy.LDMode(value)

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.

__init__(*args, **kwargs)
args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

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
connectToLiveDesignRequested
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(reconnect: bool = True) bool

Check if connected to LiveDesign. If reconnect is True and not connected but has stored credentials to reconnect, then attempt to reconnect.

Parameters

reconnect – Whether to reconnect

Returns

Whether connected to LiveDesign.

Raises

Exception – If not connected and reconnecting raises an exception. See LDClientProxy.connect for details.

get_host() Optional[str]

Host of the LiveDesign server if connected, else None.

get_username() Optional[str]

Username if connected, else None.

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)
blockSignals(self, b: bool) bool
childEvent(self, a0: QChildEvent)
children(self) List[QObject]
connectNotify(self, signal: QMetaMethod)
customEvent(self, a0: QEvent)
deleteLater(self)
destroyed

destroyed(self, object: typing.Optional[QObject] = None) [signal]

disconnectNotify(self, signal: QMetaMethod)
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) List[QByteArray]
event(self, a0: QEvent) bool
eventFilter(self, a0: QObject, a1: QEvent) bool
findChild(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChild(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChildren(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, type: type, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, types: Tuple, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
inherits(self, classname: str) bool
installEventFilter(self, a0: QObject)
isSignalConnected(self, signal: QMetaMethod) bool
isWidgetType(self) bool
isWindowType(self) bool
killTimer(self, id: int)
metaObject(self) QMetaObject
moveToThread(self, thread: QThread)
objectName(self) str
objectNameChanged

objectNameChanged(self, objectName: str) [signal]

parent(self) QObject
property(self, name: str) Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

receivers(self, signal: PYQT_SIGNAL) int
removeEventFilter(self, a0: QObject)
sender(self) QObject
senderSignalIndex(self) int
setObjectName(self, name: str)
setParent(self, a0: QObject)
setProperty(self, name: str, value: Any) bool
signalsBlocked(self) bool
startTimer(self, interval: int, timerType: Qt.TimerType = Qt.CoarseTimer) int
staticMetaObject = <PyQt6.QtCore.QMetaObject object>
thread(self) QThread
timerEvent(self, a0: QTimerEvent)
tr(sourceText: str, disambiguation: typing.Optional[str] = None, n: int = - 1) str