fix index problem in smoothing dialog

This commit is contained in:
Dominik Demuth 2024-01-31 16:53:19 +01:00
parent 813e18a744
commit a3a75f5aee

View File

@ -12,10 +12,10 @@ class QSmooth(QtWidgets.QDialog, Ui_SmoothDialog):
@QtCore.pyqtSlot(int, name='on_comboBox_currentIndexChanged')
def change_mode(self, idx: int):
if idx == 2:
if idx == 1:
self.widget.show()
self.widget_2.hide()
elif idx == 3:
elif idx == 2:
self.widget.show()
self.widget_2.show()
else:
@ -29,12 +29,24 @@ class QSmooth(QtWidgets.QDialog, Ui_SmoothDialog):
idx = self.comboBox.currentIndex()
# this order must match the combobox
para['mode'] = ['mean', 'savgol', 'loess', 'median', 'std', 'var', 'max', 'min', 'sum'][idx]
para['mode'] = [
'mean',
'savgol',
'loess',
'median',
'std',
'var',
'max',
'min',
'sum',
][idx]
if idx == 2:
# Savitzky-Golay needs also polynomial degree
if idx == 1:
para['deg'] = self.polynom_spinBox.value()
if idx == 3:
# LOESS needs also polynomial degree and number of iterations
if idx == 2:
para['deg'] = self.polynom_spinBox.value()
para['it'] = self.iter_spinBox.value()