photons.equipment.base module
Base classes and decorators for equipment.
- class photons.equipment.base.BaseEquipment(record, **kwargs)[source]
-
Base class for all equipment connections.
- Parameters:
record (
EquipmentRecord) – The equipment record.**kwargs – Keyword arguments that a subclass requires. Can be specified as attributes of an XML element in a configuration file (with the tag of the element equal to the alias of record).
- __getattr__(item)[source]
Pass all attributes that do not exist to the connection object.
- Return type:
- static convert_to_enum(obj, enum, prefix=None, to_upper=False)[source]
See
convert_to_enum()for more details.
- property logger
Reference to the package logger.
- maybe_emit_notification(*args, **kwargs)[source]
Emit a notification to all Clients that are linked with this Service.
- Return type:
- property notifications_allowed: bool
Returns whether notifications are allowed to be sent to Clients.
- property timeout: float | None
The timeout, in seconds, for read and write operations.
This property is valid only if the underlying connection is
ConnectionMessageBased.
- class photons.equipment.base.BaseEquipmentWidget(connection, *, parent=None, **kwargs)[source]
Bases:
QWidgetBase class for all Qt widgets that connect to equipment.
- Parameters:
connection (
Link|BaseEquipment|Connection) – The connection to the equipment.parent (
QWidget) – The parent widget.**kwargs – All keyword arguments are passed to super().
-
closing:
SignalInstance
- closeEvent(event)[source]
Overrides
QtWidgets.QWidget.closeEvent().- Return type:
- property logger
Reference to the package logger.
- class photons.equipment.base.EquipmentMatcher(cls, manufacturer, model, flags)[source]
Bases:
objectPerforms match operations on an
EquipmentRecord.- Parameters:
cls (
type[BaseEquipment|BaseEquipmentWidget]) – The class to associate with the matcher. The class must not be instantiated.manufacturer (
str|None) – The name of the manufacturer. Can be a regex pattern.model (
str|None) – The model number of the equipment. Can be a regex pattern.flags (
int) – The flags to use to compile the regex patterns.
- matches(record)[source]
Checks if record is a match.
- Parameters:
record (
EquipmentRecord) – The equipment record to check if the manufacturer and the model number are a match.- Return type:
- Returns:
Whether record is a match.
- photons.equipment.base.equipment(*, manufacturer=None, model=None, flags=0)[source]
A decorator to register equipment (for connections).