def setModelData(self, editor, model, index): if not editor.isModified(): return if editor.validator().state == QValidator.Acceptable: new_pname = str(editor.text()) if new_pname in model.mdl.getScalarNameList() + model.mdl.getGasCombScalarsNameList() + model.mdl.getThermalScalarName(): default = {} default['label'] = self.old_pname default['name'] = self.old_pname default['list'] = model.mdl.getScalarNameList() default['regexp'] = self.regExp log.debug("setModelData -> default = %s" % default) from code_saturne.Pages.VerifyExistenceLabelDialogView import VerifyExistenceLabelDialogView dialog = VerifyExistenceLabelDialogView(self.parent, default) if dialog.exec_(): result = dialog.get_result() new_pname = result['name'] log.debug("setModelData -> result = %s" % result) else: new_pname = self.old_pname model.setData(index, str(new_pname), Qt.DisplayRole)
def __verifLabel(self): """ Verif label. """ label = str(self.lineEditBaseName.text()) if label in self.mdl.getProfilesLabelsList(): default = {} default['label'] = label default['list'] = self.mdl.getProfilesLabelsList() rx = "[\-_A-Za-z0-9]{1," + str(LABEL_LENGTH_MAX) + "}" default['regexp'] = QRegExp(rx) from code_saturne.Pages.VerifyExistenceLabelDialogView import VerifyExistenceLabelDialogView dialog = VerifyExistenceLabelDialogView(self, default) if dialog.exec_(): result = dialog.get_result() label = result['label'] if result['label'] == default['label']: label = "" return label
def setModelData(self, editor, model, index): if not editor.isModified(): return if editor.validator().state == QValidator.Acceptable: new_plabel = str(editor.text()) if new_plabel in model.mdl.getNonCondensableLabelList(): default = {} default['label'] = self.old_plabel default['list'] = model.mdl.getNonCondensableLabelList() default['regexp'] = self.regExp log.debug("setModelData -> default = %s" % default) from code_saturne.Pages.VerifyExistenceLabelDialogView import VerifyExistenceLabelDialogView dialog = VerifyExistenceLabelDialogView(self.parent, default) if dialog.exec_(): result = dialog.get_result() new_plabel = result['label'] log.debug("setModelData -> result = %s" % result) else: new_plabel = self.old_plabel model.setData(index, new_plabel, Qt.DisplayRole)
def setModelData(self, editor, model, index): if not editor.isModified(): return if editor.validator().state == QValidator.Acceptable: p_value = str(editor.text()) if p_value in self.mdl.getLabelsList(): default = {} default['label'] = self.p_value default['list'] = self.mdl.getLabelsList() default['regexp'] = self.regExp log.debug("setModelData-> default = %s" % default) from code_saturne.Pages.VerifyExistenceLabelDialogView import VerifyExistenceLabelDialogView dialog = VerifyExistenceLabelDialogView(self.parent, default) if dialog.exec_(): result = dialog.get_result() p_value = result['label'] log.debug("setModelData-> result = %s" % result) else: p_value = self.p_value model.setData(index, to_qvariant(p_value), Qt.DisplayRole)