trspectrometer.signalstorage module

This module is used to store references to Qt Signals for use by various other components of the application.

Since Qt Signals can only be sent by QObjects, an instance of the SignalStorage class is used to store and emit the various Signals. Do not create new instances of the SignalStorage class, instead access the shared instance as the signals attribute of this module.

An example usage is:

from signalstorage import signals
signals.data_changed.emit(True)

This signals instance may be used to store custom signals created dynamically. Do not try to assign to new attributes to it, it won’t work! Instead, use the create_signal() method:

from signalstorage import signals
signals.create_signal("custom_signal", str, int, object)
signals.custom_signal.connect(lambda s, i, o: print(f"Received: {s}, {i}, {o}"))
signals.emit("one", 2, bytearray([0x33, 0x34]))
class trspectrometer.signalstorage.SignalStorage[source]

Bases: QObject

create_signal(signal_name: str, *args)[source]

Create a new signal and store it in this class.

Note, Qt Signals must be created during class definition and can’t normally be created dynamically. We actually make a new class definition and swap this instance’s class type to the newly created class. It’s some arcane python magic.

Parameters:
  • signal_name – Name for the new Signal.

  • args – Type arguments for the new Signal.

acquisition_started
acquisition_stopped
data_changed
laser_reprate_changed
raw_data_updated
raw_selection_changed
staticMetaObject = PySide6.QtCore.QMetaObject("SignalStorage" inherits "QObject": Methods:   #5 type=Signal, signature=data_changed(bool), parameters=bool   #6 type=Signal, signature=raw_data_updated(QVariantList,QVariantList,QVariantList), parameters=QVariantList, QVariantList, QVariantList   #7 type=Signal, signature=raw_selection_changed()   #8 type=Signal, signature=acquisition_started()   #9 type=Signal, signature=acquisition_stopped(PyObject), parameters=PyObject   #10 type=Signal, signature=laser_reprate_changed() )