From: Tom Rondeau Date: Tue, 25 Aug 2009 15:15:25 +0000 (-0400) Subject: Manages window/filter types better. Disables filter types if the designing algorithm... X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=6fa1fc320b539cac0add465652c0cac170a88db1;p=debian%2Fgnuradio Manages window/filter types better. Disables filter types if the designing algorithm doesn't support it (no RRC or Gaussian for equiripple filters). --- diff --git a/gr-utils/src/python/gr_filter_design.py b/gr-utils/src/python/gr_filter_design.py index 1253056b..bf83cf69 100755 --- a/gr-utils/src/python/gr_filter_design.py +++ b/gr-utils/src/python/gr_filter_design.py @@ -64,14 +64,12 @@ class gr_plot_filter(QtGui.QMainWindow): self.nfftpts = int(10000) self.gui.nfftEdit.setText(Qt.QString("%1").arg(self.nfftpts)) - self.gui.lpfPassBandRippleLabel.setVisible(False) - self.gui.lpfPassBandRippleEdit.setVisible(False) - self.gui.bpfPassBandRippleLabel.setVisible(False) - self.gui.bpfPassBandRippleEdit.setVisible(False) - self.gui.bnfPassBandRippleLabel.setVisible(False) - self.gui.bnfPassBandRippleEdit.setVisible(False) - self.gui.hpfPassBandRippleLabel.setVisible(False) - self.gui.hpfPassBandRippleEdit.setVisible(False) + self.firFilters = ("Low Pass", "Band Pass", "Complex Band Pass", "Band Notch", + "High Pass", "Root Raised Cosine", "Gaussian") + self.optFilters = ("Low Pass", "Band Pass", "Complex Band Pass", + "Band Notch", "High Pass") + + self.set_windowed() # Initialize to LPF self.gui.filterTypeWidget.setCurrentWidget(self.gui.firlpfPage) @@ -137,8 +135,11 @@ class gr_plot_filter(QtGui.QMainWindow): # Set up pen for colors and line width blue = QtGui.qRgb(0x00, 0x00, 0xFF) blueBrush = Qt.QBrush(Qt.QColor(blue)) + red = QtGui.qRgb(0xFF, 0x00, 0x00) + redBrush = Qt.QBrush(Qt.QColor(red)) self.freqcurve.setPen(Qt.QPen(blueBrush, 2)) self.rcurve.setPen(Qt.QPen(blueBrush, 2)) + self.icurve.setPen(Qt.QPen(redBrush, 2)) self.phasecurve.setPen(Qt.QPen(blueBrush, 2)) self.groupcurve.setPen(Qt.QPen(blueBrush, 2)) @@ -212,6 +213,9 @@ class gr_plot_filter(QtGui.QMainWindow): self.design() def set_equiripple(self): + # Stop sending the signal for this function + self.gui.filterTypeComboBox.blockSignals(True) + self.equiripple = True self.gui.lpfPassBandRippleLabel.setVisible(True) self.gui.lpfPassBandRippleEdit.setVisible(True) @@ -221,8 +225,30 @@ class gr_plot_filter(QtGui.QMainWindow): self.gui.bnfPassBandRippleEdit.setVisible(True) self.gui.hpfPassBandRippleLabel.setVisible(True) self.gui.hpfPassBandRippleEdit.setVisible(True) + + # Save current type and repopulate the combo box for + # filters this window type can handle + currenttype = self.gui.filterTypeComboBox.currentText() + items = self.gui.filterTypeComboBox.count() + for i in xrange(items): + self.gui.filterTypeComboBox.removeItem(0) + self.gui.filterTypeComboBox.addItems(self.optFilters) + + # If the last filter type was valid for this window type, + # go back to it; otherwise, reset + try: + index = self.optFilters.index(currenttype) + self.gui.filterTypeComboBox.setCurrentIndex(index) + except ValueError: + pass + + # Tell gui its ok to start sending this signal again + self.gui.filterTypeComboBox.blockSignals(False) def set_windowed(self): + # Stop sending the signal for this function + self.gui.filterTypeComboBox.blockSignals(True) + self.equiripple = False self.gui.lpfPassBandRippleLabel.setVisible(False) self.gui.lpfPassBandRippleEdit.setVisible(False) @@ -232,7 +258,26 @@ class gr_plot_filter(QtGui.QMainWindow): self.gui.bnfPassBandRippleEdit.setVisible(False) self.gui.hpfPassBandRippleLabel.setVisible(False) self.gui.hpfPassBandRippleEdit.setVisible(False) - + + # Save current type and repopulate the combo box for + # filters this window type can handle + currenttype = self.gui.filterTypeComboBox.currentText() + items = self.gui.filterTypeComboBox.count() + for i in xrange(items): + self.gui.filterTypeComboBox.removeItem(0) + self.gui.filterTypeComboBox.addItems(self.firFilters) + + # If the last filter type was valid for this window type, + # go back to it; otherwise, reset + try: + index = self.optFilters.index(currenttype) + self.gui.filterTypeComboBox.setCurrentIndex(index) + except ValueError: + pass + + # Tell gui its ok to start sending this signal again + self.gui.filterTypeComboBox.blockSignals(False) + def design(self): ret = True fs,r = self.gui.sampleRateEdit.text().toDouble() diff --git a/gr-utils/src/python/pyqt_filter.py b/gr-utils/src/python/pyqt_filter.py index e2bdeb8b..12ad183b 100644 --- a/gr-utils/src/python/pyqt_filter.py +++ b/gr-utils/src/python/pyqt_filter.py @@ -2,8 +2,8 @@ # Form implementation generated from reading ui file 'pyqt_filter.ui' # -# Created: Mon Aug 24 23:10:31 2009 -# by: PyQt4 UI code generator 4.4.4 +# Created: Tue Aug 25 11:13:57 2009 +# by: PyQt4 UI code generator 4.4.3 # # WARNING! All changes made in this file will be lost! @@ -316,7 +316,7 @@ class Ui_MainWindow(object): self.gridLayout.addWidget(self.tabGroup, 1, 1, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 1124, 25)) + self.menubar.setGeometry(QtCore.QRect(0, 0, 1124, 24)) self.menubar.setObjectName("menubar") self.menu_File = QtGui.QMenu(self.menubar) self.menu_File.setObjectName("menu_File") diff --git a/gr-utils/src/python/pyqt_filter.ui b/gr-utils/src/python/pyqt_filter.ui index 497ea691..9b31112e 100644 --- a/gr-utils/src/python/pyqt_filter.ui +++ b/gr-utils/src/python/pyqt_filter.ui @@ -1,8 +1,7 @@ - - + MainWindow - - + + 0 0 @@ -10,131 +9,131 @@ 696 - + GNU Radio Filter Design Tool - - - - - + + + + + 300 0 - + 300 16777215 - + QFrame::StyledPanel - + QFrame::Raised - + - + - + Low Pass - + Band Pass - + Complex Band Pass - + Band Notch - + High Pass - + Root Raised Cosine - + Gaussian - + - + Hamming Window - + Hann Window - + Blackman Window - + Rectangular Window - + Kaiser Window - + Blackman-harris Window - + Equiripple - - + + QFormLayout::AllNonFixedFieldsGrow - - - + + + 16777215 30 - + Sample Rate (sps) - - - + + + 16777215 30 @@ -142,332 +141,332 @@ - - - + + + Filter Gain - - + + - - + + 0 - - - - - + + + + + End of Pass Band (Hz) - - + + - - - + + + Start of Stop Band (Hz) - - + + - - - + + + Stop Band Attenuation (dB) - - + + - - + + - - - + + + Pass Band Ripple (dB) - - - - - + + + + + Start of Pass Band (Hz) - - + + - - - + + + End of Pass Band (Hz) - - + + - - + + - - - + + + Stop Band Attenuation (dB) - - - + + + Transition Width (Hz) - - + + - - + + - - - + + + Pass Band Ripple (dB) - - - + + + QFormLayout::AllNonFixedFieldsGrow - - - + + + Start of Stop Band (Hz) - - + + - - - + + + End of Stop Band (Hz) - - + + - - - + + + Transition Width (Hz) - - + + - - - + + + Stop Band Attenuation (dB) - - + + - - - + + + Pass Band Ripple (dB) - - + + - - - + + + QFormLayout::AllNonFixedFieldsGrow - - - + + + End of Stop Band (Hz) - - + + - - - + + + Start of Pass Band (Hz) - - + + - - - + + + Stop Band Attenuation (dB) - - + + - - - + + + Pass Band Ripple (dB) - - + + - - - - - + + + + + Symbol Rate (sps) - - - + + + Roll-off Factor - - - + + + Number of Taps - - + + - - + + - - + + - - - - - + + + + + Symbol Rate (sps) - - + + - - - + + + Roll-off Factor - - + + - - - + + + Number of Taps - - + + - - + + Filter Properties - - + + QFormLayout::AllNonFixedFieldsGrow - - - + + + 150 0 - + Number of Taps: - - - + + + 100 16777215 - + QFrame::Box - + QFrame::Raised - + @@ -476,23 +475,23 @@ - - + + System Parameters - - - + + + - - - + + + 150 0 - + Num FFT points @@ -501,26 +500,26 @@ - - + + 0 0 - + 200 16777215 - + Design - + true - + true @@ -528,54 +527,54 @@ - - - + + + 800 0 - + 0 - - + + Frequency Domain - + - + - - + + Time Domain - + - + - - + + Phase - + - + - - + + Group Delay - + - + @@ -583,34 +582,34 @@ - - + + 0 0 1124 - 25 + 24 - - + + &File - + - + - - - + + + &Open - + Ctrl+O - - + + E&xit @@ -663,11 +662,11 @@ MainWindow close() - + -1 -1 - + 399 347