ADSMapper
Objects of this class represent a plc process value. The class
accomblishes a connection between plc and the gui. For implementing
the interaction between gui objects and plc values subclass and
implement mapAdsToGui according to the given examples.
sample code:
>>> class TextBoxMapper (ADSMapper):
>>> def mapAdsToGui(self, guiObject, value):
>>> guiObject.setText(str(value))
>>> class ComboBoxMapper (ADSMapper):
>>> def mapAdsToGui(self, guiObject, value):
>>> index = guiObject.findData(QVariant(value))
>>> guiObject.setCurrentIndex(index)
>>> class DSpinBoxMapper (ADSMapper):
>>> def mapAdsToGui(self, guiObject, value):
>>> guiObject.setValue(float(value))
>>> class SpinBoxMapper (ADSMapper):
>>> def mapAdsToGui(self, guiObject, value):
>>> guiObject.setValue(int(value))
>>> class BinaryMapper (ADSMapper):
>>> def mapAdsToGui(self, guiObject, value):
>>> guiObject.setText(__builtin__.bin(int(value)))
|