iblrig.gui.tools.AlyxObject

Inheritance diagram of AlyxObject

class iblrig.gui.tools.AlyxObject[source]

A class to manage user authentication with an AlyxClient.

This class provides methods to log in and log out users, emitting signals to indicate changes in authentication status.

Parameters:
  • alyxUrl (str, optional) – The base URL for the Alyx API. If provided, an AlyxClient will be created.

  • alyxClient (AlyxClient, optional) – An existing AlyxClient instance. If provided, it will be used for authentication.

isLoggedIn

Indicates whether a user is currently logged in.

Type:

bool

username

The username of the logged-in user, or None if not logged in.

Type:

str or None

statusChanged

Emitted when the login status changes (logged in or out). The signal carries a boolean indicating the new status.

Type:

pyqtSignal

loggedIn

Emitted when a user logs in. The signal carries a string representing the username.

Type:

pyqtSignal

loggedOut

Emitted when a user logs out. The signal carries a string representing the username.

Type:

pyqtSignal

loginFailed

Emitted when a login attempt fails. The signal carries a string representing the username.

Type:

pyqtSignal

__init__(*args, alyxUrl=None, alyxClient=None, **kwargs)[source]

Initializes the AlyxObject.

Parameters:
  • *args (tuple) – Positional arguments for QObject.

  • alyxUrl (str, optional) – The base URL for the Alyx API.

  • alyxClient (AlyxClient, optional) – An existing AlyxClient instance.

  • **kwargs (dict) – Keyword arguments for QObject.

Parameters:
logIn(username, password=None, cacheToken=False)[source]

Logs in a user with the provided username and password.

Emits the loggedIn and statusChanged signals if the logout is successful, and the loginFailed signal otherwise.

Parameters:
  • username (str) – The username of the user attempting to log in.

  • password (str or None, optional) – The password of the user. If None, the login will proceed without a password.

  • cacheToken (bool, optional) – Whether to cache the authentication token.

Returns:

True if the login was successful, False otherwise.

Return type:

bool

Parameters:
  • username (str)

  • password (str | None)

  • cacheToken (bool)

logOut()[source]

Logs out the currently logged-in user.

Emits the loggedOut and statusChanged signals if the logout is successful.

Return type:

None

property isLoggedIn

Indicates whether a user is currently logged in.

loggedIn

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.

Type:

pyqtSignal(*types, name

loggedOut

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.

Type:

pyqtSignal(*types, name

loginFailed

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.

Type:

pyqtSignal(*types, name

statusChanged

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.

Type:

pyqtSignal(*types, name

property username: str | None

The username of the logged-in user, or None if not logged in.