Exemplo n.º 1
0
    def updateStyle(self):
        """Reimplemented from :class:`TaurusBaseWritableWidget`"""
        TaurusBaseWritableWidget.updateStyle(self)

        value = self.getValue()

        if value is None or not self.isTextValid() or not self.isEnabled():
            # invalid value
            color, weight = 'gray', 'normal'
        else:
            # check if there are pending operations
            if self.hasPendingOperations():
                color, weight = 'blue', 'bold'
            else:
                color, weight = 'black', 'normal'
            # also check alarms (if applicable)
            modelObj = self.getModelObj()
            if modelObj and modelObj.type in [
                    DataType.Integer, DataType.Float
            ]:
                min_, max_ = modelObj.alarms
                if ((min_ is not None and value < min_)
                        or (max_ is not None and value > max_)):
                    color = 'orange'
        # apply style
        style = ('TaurusValueLineEdit {color: %s; font-weight: %s}' %
                 (color, weight))
        self.setStyleSheet(style)
Exemplo n.º 2
0
 def updateStyle(self):
     TaurusBaseWritableWidget.updateStyle(self)
     if self.hasPendingOperations():
         self.setStyleSheet(
             'QWheelEdit {border: 2px solid; border-radius: 4px; border-color: blue}')
     else:
         self.setStyleSheet(
             'QWheelEdit {border: 2px solid; border-radius: 4px; border-color: rgba(0,0,255,0)}')
Exemplo n.º 3
0
 def updateStyle(self):
     TaurusBaseWritableWidget.updateStyle(self)
     if self.hasPendingOperations():
         self.setStyleSheet(
             'QWheelEdit {border: 2px solid; border-radius: 4px; border-color: blue}')
     else:
         self.setStyleSheet(
             'QWheelEdit {border: 2px solid; border-radius: 4px; border-color: rgba(0,0,255,0)}')
 def updateStyle(self):
     """
     Removed validators that only work for scalar numerics
     """
     TaurusBaseWritableWidget.updateStyle(self)
     color, weight = 'black', 'normal'  #default case: the value is in normal range with no pending changes
     if self.hasPendingOperations(
     ):  #the value is in valid range with pending changes
         color, weight = 'blue', 'bold'
     self.setStyleSheet('QLineEdit {color: %s; font-weight: %s}' %
                        (color, weight))
Exemplo n.º 5
0
 def updateStyle(self):
     self._my_debug("updateStyle()")
     try:
         TaurusBaseWritableWidget.updateStyle(self)
         if self.isResetCheckBox():
             return
         else:
             # If it is not a resetCheckBox,
             # proceed like the TaurusValueCheckBox
             if self.hasPendingOperations():
                 txt = str(self.text()).strip()
                 if len(txt) == 0:
                     self.setText("!")
                 self.setStyleSheet('LinacValueCheckBox {color: blue;}')
             else:
                 if str(self.text()) == "!":
                     self.setText(" ")
                 self.setStyleSheet('LinacValueCheckBox {}')
             self.update()
     except Exception as e:
         self.error("Cannot updateStyle: %s" % (e))
Exemplo n.º 6
0
 def updateStyle(self):
     TaurusBaseWritableWidget.updateStyle(self)
     # Show text only if it is not specifically hidden
     if self._showText:
         try:
             self.setText(str(self.getModelObj().getConfig().getLabel()))
         except:
             self.setText('----')
     else:
         self.setText('')
     # Update pending operations style
     if self.hasPendingOperations():
         txt = str(self.text()).strip()
         if len(txt) == 0:
             self.setText("!")
         self.setStyleSheet('TaurusValueCheckBox {color: blue;}')
     else:
         if str(self.text()) == "!":
             self.setText(" ")
         self.setStyleSheet('TaurusValueCheckBox {}')
     self.update()
Exemplo n.º 7
0
 def updateStyle(self):
     TaurusBaseWritableWidget.updateStyle(self)
     # Show text only if it is not specifically hidden
     if self._showText:
         try:
             self.setText(str(self.getModelObj().getConfig().getLabel()))
         except:
             self.setText('----')
     else:
         self.setText('')
     # Update pending operations style
     if self.hasPendingOperations():
         txt = str(self.text()).strip()
         if len(txt) == 0:
             self.setText("!")
         self.setStyleSheet('TaurusValueCheckBox {color: blue;}')
     else:
         if str(self.text()) == "!":
             self.setText(" ")
         self.setStyleSheet('TaurusValueCheckBox {}')
     self.update()
Exemplo n.º 8
0
    def updateStyle(self):
        TaurusBaseWritableWidget.updateStyle(self)

        value = self.getValue()
        if value is None:
            # invalid value
            color, weight = 'gray', 'normal'
        else:
            # check if there are pending operations
            if self.hasPendingOperations():
                color, weight = 'blue', 'bold'
            else:
                color, weight = 'black', 'normal'
            # also check alarms (if applicable)
            modelObj = self.getModelObj()
            if modelObj and modelObj.type in [DataType.Integer, DataType.Float]:
                min_, max_ = modelObj.alarms
                if value < min_ or value > max_:
                    color = 'orange'
        # apply style
        style = 'TaurusValueLineEdit {color: %s; font-weight: %s}' %\
                (color, weight)
        self.setStyleSheet(style)