From 41684cd2820b2a1fb6c9b19e9da0f7b3f1ef5adc Mon Sep 17 00:00:00 2001 From: Sebastian Wehling-Benatelli Date: Mon, 1 Dec 2014 12:44:25 +0100 Subject: [PATCH] filterOptions has now a buttonBox --- pylot/core/util/widgets.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/pylot/core/util/widgets.py b/pylot/core/util/widgets.py index 0cac4620..a6376f73 100644 --- a/pylot/core/util/widgets.py +++ b/pylot/core/util/widgets.py @@ -200,16 +200,22 @@ class FilterOptionsDialog(QDialog): self.freqGroupLayout.addWidget(self.freqmaxSpinBox, 1, 1) self.freqGroupBox.setLayout(self.freqGroupLayout) - self.layoutEditables = QHBoxLayout() - self.layoutEditables.addWidget(self.freqGroupBox) - self.layoutEditables.addLayout(self.selectTypeLayout) + self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok| + QDialogButtonBox.Cancel) + + grid = QGridLayout() + grid.addWidget(self.freqGroupBox, 0, 2, 1, 2) + grid.addLayout(self.selectTypeLayout, 1, 2, 1, 2) + grid.addWidget(self.buttonBox, 2, 2, 1, 2) - self.setLayout(self.layoutEditables) + self.setLayout(grid) self.freqminSpinBox.valueChanged.connect(self.updateUi) self.freqmaxSpinBox.valueChanged.connect(self.updateUi) self.orderSpinBox.valueChanged.connect(self.updateUi) self.selectTypeCombo.currentIndexChanged.connect(self.updateUi) + self.buttonBox.accepted.connect(self.accept) + self.buttonBox.rejected.connect(self.reject) def updateUi(self): if self.selectTypeCombo.currentText() not in ['bandpass', 'bandstop']: @@ -237,11 +243,14 @@ class FilterOptionsDialog(QDialog): freq.append(self.freqmaxSpinBox.value()) self.filterOptions.freq = freq self.filterOptions.order = self.orderSpinBox.value() - return self.getFilterOptions() def getFilterOptions(self): return self.filterOptions + def accept(self): + self.updateUi() + QDialog.accept(self) + class LoadDataDlg(QDialog):