bugfix: FilterOptionsDialog should only provide logic options

This commit is contained in:
Sebastian Wehling 2015-03-04 15:42:08 +01:00
parent 5f0b7fbdc0
commit 567ae16f1d

View File

@ -377,7 +377,7 @@ class FilterOptionsDialog(QDialog):
if parent is not None: if parent is not None:
self.filterOptions = parent.getFilterOptions() self.filterOptions = parent.getFilterOptions()
else: else:
self.filterOptions = FilterOptions() self.filterOptions = FilterOptions(filterOptions)
_enable = True _enable = True
if self.getFilterOptions().getFilterType() is None: if self.getFilterOptions().getFilterType() is None:
@ -403,8 +403,13 @@ class FilterOptionsDialog(QDialog):
if self.getFilterOptions().getFilterType() in ['bandpass', 'bandstop']: if self.getFilterOptions().getFilterType() in ['bandpass', 'bandstop']:
self.freqmaxSpinBox.setValue(self.getFilterOptions().getFreq()[1]) self.freqmaxSpinBox.setValue(self.getFilterOptions().getFreq()[1])
else: else:
try:
self.freqmaxSpinBox.setValue(self.getFilterOptions().getFreq()) self.freqmaxSpinBox.setValue(self.getFilterOptions().getFreq())
self.freqminSpinBox.setValue(self.getFilterOptions().getFreq()) self.freqminSpinBox.setValue(self.getFilterOptions().getFreq())
except TypeError, e:
print e
self.freqmaxSpinBox.setValue(1.)
self.freqminSpinBox.setValue(.1)
typeOptions = [None, "bandpass", "bandstop", "lowpass", "highpass"] typeOptions = [None, "bandpass", "bandstop", "lowpass", "highpass"]
@ -450,20 +455,22 @@ class FilterOptionsDialog(QDialog):
def updateUi(self): def updateUi(self):
_enable = False
if self.selectTypeCombo.currentText() not in ['bandpass', 'bandstop']: if self.selectTypeCombo.currentText() not in ['bandpass', 'bandstop']:
self.freqminLabel.setText("cutoff:") self.freqminLabel.setText("cutoff:")
self.freqmaxLabel.setEnabled(False)
self.freqmaxSpinBox.setEnabled(False)
self.freqmaxSpinBox.setValue(self.freqminSpinBox.value()) self.freqmaxSpinBox.setValue(self.freqminSpinBox.value())
else: else:
_enable = True
self.freqminLabel.setText("minimum:") self.freqminLabel.setText("minimum:")
self.freqmaxLabel.setEnabled(True)
self.freqmaxSpinBox.setEnabled(True) self.freqmaxLabel.setEnabled(_enable)
self.freqmaxSpinBox.setEnabled(_enable)
self.getFilterOptions().setFilterType(self.selectTypeCombo.currentText()) self.getFilterOptions().setFilterType(self.selectTypeCombo.currentText())
freq = [] freq = []
freq.append(self.freqminSpinBox.value()) freq.append(self.freqminSpinBox.value())
if self.getFilterOptions().getFilterType() in ['bandpass', 'bandstop']: if _enable:
if self.freqminSpinBox.value() > self.freqmaxSpinBox.value(): if self.freqminSpinBox.value() > self.freqmaxSpinBox.value():
QMessageBox.warning(self, "Value error", QMessageBox.warning(self, "Value error",
"Maximum frequency must be at least the " "Maximum frequency must be at least the "