1
0
forked from IPKM/nmreval
This commit is contained in:
Dominik Demuth 2023-07-05 18:11:58 +02:00
parent 4a04502012
commit 9756bf958b

View File

@ -64,8 +64,6 @@ class QFitResult(QtWidgets.QDialog, Ui_Dialog):
self.cmap = RdBuCMap(vmin=-1, vmax=1)
self.buttonBox.accepted.connect(self.accept)
self.graph_checkBox.stateChanged.connect(lambda x: self.graph_comboBox.setEnabled(x == QtCore.Qt.Unchecked))
self.logy_box.stateChanged.connect(lambda x: self.fit_plot.setLogMode(y=bool(x)))
@ -315,22 +313,27 @@ class QFitResult(QtWidgets.QDialog, Ui_Dialog):
parts = self.partial_checkBox.checkState() == QtCore.Qt.Checked
extrapolate = [None, None, None]
error = []
if self.extrapolate_box.isChecked():
try:
extrapolate[0] = float(self.minx_line.text())
except TypeError:
pass
except (TypeError, ValueError):
error.append('Start value is missing')
try:
extrapolate[1] = float(self.maxx_line.text())
except TypeError:
pass
except (TypeError, ValueError):
error.append('End value is missing')
try:
extrapolate[2] = int(self.numx_line.text())
except TypeError:
pass
except (TypeError, ValueError):
error.append('Number of points is missing')
self.closed.emit(self._results, self._opts, graph, plot_fits, parts, extrapolate)
self.accept()
if error:
msg = QtWidgets.QMessageBox.warning(self, 'Error', 'Extrapolation failed because:\n' + '\n'.join(error))
return
else:
self.closed.emit(self._results, self._opts, graph, plot_fits, parts, extrapolate)
self.accept()
else:
self.reject()