Esempio n. 1
0
 def _createValidator(self):
     validator = QDoubleValidator(self.parent)
     if "min" in self.config:
         validator.setBottom(int(self.config["min"]))
     if "max" in self.config:
         validator.setTop(int(self.config["max"]))
     if "decimals" in self.config:
         validator.setDecimals(int(self.config["decimals"]))
     return validator
Esempio n. 2
0
    def _createWidgets(self):
        '''Create the widgets contained in this box'''

        # Rate or lifetime chooser
        self.rate = QRadioButton('Rate', self)
        self.rate.setToolTip(ttt('Choose this to express exchange as rate'))
        self.lifetime = QRadioButton('Lifetime', self)
        self.lifetime.setToolTip(ttt('Choose this to express exchange as '
                                     'lifetime'))

        # Box containing value
        self.rate_value = QLineEdit(self)
        validate = QDoubleValidator(self.rate_value)
        validate.setDecimals(3)
        validate.setBottom(0.0)
        self.rate_value.setValidator(validate)
        self.rate_value.setToolTip(ttt('The rate or lifetime value'))

        # Unit
        self.unit = QComboBox(self)
        self.unit.setToolTip(ttt('Selects the input unit for the rate '
                                 'or lifetime'))