QFakeInstrument#
- class QInstrument.lib.QFakeInstrument.QFakeInstrument(*args, **kwargs)[source]#
Bases:
QAbstractInstrumentBase class for fake instruments used in UI development without hardware.
Provides an in-memory property store and a
_register()override so that a concrete fake can be derived from bothQFakeInstrumentand a real instrument class with minimal boilerplate:class QFakeDS345(QFakeInstrument, QDS345): pass
MRO resolution ensures that
_register()here is called instead of the real instrument’s version, wiring every standard property to_storerather than to the serial port.__init__()initializes_store, then callsQAbstractInstrument.__init__directly, bypassingQSerialInstrumentso no serial port is created.QAbstractInstrument.__init__calls_registerProperties()and_registerMethods()automatically.Properties whose getters cannot be expressed through
_register()(non-standard response formats, internal state) must be re-registered by the concrete fake after callingsuper()._registerProperties().registerProperty()overwrites any previous registration for the same name, so this is safe.Subclasses that do not inherit a real instrument class may define their own
__init__, callsuper().__init__(), and then register properties directly viaregisterProperty().