exopy.instruments.plugin module¶
Instrument manager plugin.
-
exopy.instruments.plugin.
validate_user
(user)[source]¶ Validate that the user does declare a validate method if its policy is releasable.
-
exopy.instruments.plugin.
validate_starter
(starter)[source]¶ Validate a starter declaration by checking for members and provided starter.
-
class
exopy.instruments.plugin.
InstrumentManagerPlugin
[source]¶ Bases:
exopy.utils.plugin_tools.HasPreferencesPlugin
The instrument plugin manages the instrument drivers and their use.
-
profiles
¶ List of the known instrument profile ids.
-
instruments
¶ List of instruments for which at least one driver is declared.
-
users
¶ List of registered intrument users. Only registered users can be granted the use of an instrument.
-
starters
¶ List of registered instrument starters.
-
connections
¶ List of registered connection types.
-
settings
¶ List of registered settings.
-
used_profiles
¶ Currently used profiles. This dict should be edited by user code.
-
create_connection
(connection_id, infos, read_only=False)[source]¶ Create a connection and initialize it.
- Parameters
- Returns
connection – Ready to use widget.
- Return type
-
create_settings
(settings_id, infos, read_only=False)[source]¶ Create a settings and initialize it.
- Parameters
- Returns
connection – Ready to use widget.
- Return type
-
get_drivers
(drivers)[source]¶ Query drivers class and the associated starters.
- Parameters
drivers (list) – List of driver ids for which the matching class should be returned.
- Returns
drivers (dict) – Requested drivers and associated starter indexed by id.
missing (list) – List of ids which do not correspond to any known valid driver.
-
get_profiles
(user_id, profiles, try_release=True, partial=False)[source]¶ Query profiles for use by a declared user.
- Parameters
user_id (unicode) – Id of the user which request the authorization to use the instrument.
profiles (list) – Ids of the instrument profiles which are requested.
try_release (bool, optional) – Should we attempt to release currently used profiles.
partial (bool, optional) – Should only a subset of the requested profiles be returned if some profiles are not available.
- Returns
profiles (dict) – Requested profiles as a dictionary.
unavailable (list) – List of profiles that are not currently available and cannot be released.
-
release_profiles
(user_id, profiles)[source]¶ Release some previously acquired profiles.
The user should not maintain any communication with the instruments whose profiles have been released after calling this method.
- Parameters
user_id (unicode) – Id of the user releasing the profiles.
profiles (iterable) – Profiles (ids) which are no longer needed by the user.
-