From 53c58b2bbb7cb3db58e877fdab3083daa855c72d Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Wed, 6 Sep 2023 17:45:57 +0200 Subject: [PATCH] disable validators --- src/gui_qt/fit/fit_forms.py | 15 ++++++++------- src/gui_qt/fit/fit_parameter.py | 11 +++++++---- src/nmreval/fit/minimizer.py | 2 ++ 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/gui_qt/fit/fit_forms.py b/src/gui_qt/fit/fit_forms.py index f0f63f7..983a0db 100644 --- a/src/gui_qt/fit/fit_forms.py +++ b/src/gui_qt/fit/fit_forms.py @@ -19,9 +19,9 @@ class FitModelWidget(QtWidgets.QWidget, Ui_FitParameter): self.parametername.setText(label + ' ') - validator = QtGui.QDoubleValidator() - validator.setDecimals(9) - self.parameter_line.setValidator(validator) + # validator = QtGui.QDoubleValidator() + # validator.setDecimals(9) + # self.parameter_line.setValidator(validator) self.parameter_line.setText('1') self.parameter_line.setMaximumWidth(60) self.lineEdit.setMaximumWidth(60) @@ -97,10 +97,11 @@ class FitModelWidget(QtWidgets.QWidget, Ui_FitParameter): try: p = float(self.parameter_line.text().replace(',', '.')) except ValueError: - _ = QtWidgets.QMessageBox().warning(self, 'Invalid value', - f'{self.parametername.text()} contains invalid values', - QtWidgets.QMessageBox.Cancel) - return None + p = self.parameter_line.text().replace(',', '.') + # _ = QtWidgets.QMessageBox().warning(self, 'Invalid value', + # f'{self.parametername.text()} contains invalid values', + # QtWidgets.QMessageBox.Cancel) + # return None if self.checkBox.isChecked(): try: diff --git a/src/gui_qt/fit/fit_parameter.py b/src/gui_qt/fit/fit_parameter.py index 292c220..b461d23 100644 --- a/src/gui_qt/fit/fit_parameter.py +++ b/src/gui_qt/fit/fit_parameter.py @@ -124,10 +124,12 @@ class QFitParameterWidget(QtWidgets.QWidget, Ui_FormFit): if idx is None: idx = self.global_parameter.index(self.sender()) - self.glob_values[idx] = float(value) + # self.glob_values[idx] = float(value) + self.glob_values[idx] = value if self.data_values[self.comboBox.currentData()][idx] is None: self.data_parameter[idx].blockSignals(True) - self.data_parameter[idx].value = float(value) + # self.data_parameter[idx].value = float(value) + self.data_parameter[idx].value = value self.data_parameter[idx].blockSignals(False) @QtCore.pyqtSlot(str, object) @@ -300,7 +302,7 @@ class ParameterSingleWidget(QtWidgets.QWidget): self.label.setText(convert(name)) self.label.setToolTip('IIf this is bold then this parameter is only for this data. otherwise the general parameter is used and displayed') - self.value_line.setValidator(QtGui.QDoubleValidator()) + # self.value_line.setValidator(QtGui.QDoubleValidator()) self.value_line.textChanged.connect(lambda: self.valueChanged.emit(self.value) if self.value is not None else 0) self.reset_button.clicked.connect(lambda x: self.removeSingleValue.emit()) @@ -334,7 +336,8 @@ class ParameterSingleWidget(QtWidgets.QWidget): @value.setter def value(self, val): - self.value_line.setText(f'{float(val):.5g}') + # self.value_line.setText(f'{float(val):.5g}') + self.value_line.setText(f'{val}') def show_as_local_parameter(self, is_local): if is_local: diff --git a/src/nmreval/fit/minimizer.py b/src/nmreval/fit/minimizer.py index b9dec07..355769d 100644 --- a/src/nmreval/fit/minimizer.py +++ b/src/nmreval/fit/minimizer.py @@ -223,6 +223,8 @@ class FitRoutine(object): def run(self, mode: str = 'lsq'): self._abort = False + print('run') + fit_groups, linked_parameter = self.prepare_links() for data_groups in fit_groups: if len(data_groups) == 1 and not self.linked: