def parameter_changed(self, text): try: value = self.tx2v(text) setattr(self.paras, self.name, value) self.accepted = True self.err_label.setText("") self.err_label.setVisible(False) self.edit.setStyleSheet(Style.default()) self.label.setStyleSheet(Style.default()) self.edit.setToolTip(None) except ValueError as err: self.accepted = False self.err_label.setText(str(err)) self.err_label.setVisible(True) self.edit.setStyleSheet(Style.error()) self.label.setStyleSheet(Style.error())
def parameter_finished(self): try: value = self.tx2v(self.edit.text()) setattr(self.paras, self.name, value) self.paras.save_configuration() self.accepted = True self.err_label.setText("") self.err_label.setVisible(False) value = self.v2tx(getattr(self.paras, self.name)) self.edit.setText(value) self.edit.setStyleSheet(Style.default()) self.label.setStyleSheet(Style.default()) except ValueError as err: self.accepted = False self.err_label.setText(str(err)) self.err_label.setVisible(True) self.edit.setStyleSheet(Style.error()) self.label.setStyleSheet(Style.error())