Exemplo n.º 1
0
    def displayValue(self, v):
        """Reimplementation of displayValue for TaurusLabel"""
        if self._permanentText is None:
            value = TaurusBaseWidget.displayValue(self, v)
        else:
            value = self._permanentText

        dev = None
        attr = None

        modeltype = self.getModelType()
        if modeltype == TaurusElementType.Device:
            dev = self.getModelObj()
        elif modeltype == TaurusElementType.Attribute:
            attr = self.getModelObj()
            dev = attr.getParent()

        try:
            v = value.format(dev=dev, attr=attr)
        except Exception as e:
            self.warning(
                "Error formatting display (%r). Reverting to raw string", e)
            v = value

        return v
Exemplo n.º 2
0
 def displayValue(self, v):
     '''see :meth:`TaurusBaseComponent.displayValue`'''
     if self._text is not None:
         return self._text  # make sure the text is not changed once set
     TaurusBaseWidget.displayValue(self, v)
Exemplo n.º 3
0
 def displayValue(self, v):
     '''see :meth:`TaurusBaseComponent.displayValue`'''
     if self._text is not None:
         return self._text  # make sure the text is not changed once set
     TaurusBaseWidget.displayValue(self, v)