From 471ebf621da0426fefda870dfe29d75cd9ef2da6 Mon Sep 17 00:00:00 2001 From: trondeau Date: Mon, 6 Jul 2009 04:39:24 +0000 Subject: [PATCH] Merging trondeau/qt branch r11231:11360. This merge improves the usability and examples of the QT-based interface. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11361 221aa14e-8319-0410-a670-987f0aec2ac5 --- .../python/digital/benchmark_qt_loopback.py | 4 +- .../python/digital/benchmark_qt_rx.py | 15 +- .../python/digital/qt_digital_window.py | 267 +++-- .../python/digital/qt_digital_window.ui | 910 +++++++++++------- .../python/digital/qt_rx_window.py | 102 +- .../python/digital/qt_rx_window.ui | 668 +++++++------ .../python/usrp2/qt_wfm_interface.py | 99 ++ .../python/usrp2/qt_wfm_interface.ui | 253 +++++ .../python/usrp2/usrp2_wfm_qt.py | 352 +++++++ gr-qtgui/src/lib/ConstellationDisplayPlot.h | 1 + gr-qtgui/src/lib/FrequencyDisplayPlot.cc | 25 +- gr-qtgui/src/lib/FrequencyDisplayPlot.h | 5 +- gr-qtgui/src/lib/SpectrumGUIClass.cc | 8 +- gr-qtgui/src/lib/SpectrumGUIClass.h | 4 +- gr-qtgui/src/lib/TimeDomainDisplayPlot.h | 1 + gr-qtgui/src/lib/Waterfall3DDisplayPlot.h | 1 + gr-qtgui/src/lib/WaterfallDisplayPlot.h | 1 + gr-qtgui/src/lib/qtgui.i | 21 +- gr-qtgui/src/lib/qtgui_sink_c.cc | 27 +- gr-qtgui/src/lib/qtgui_sink_c.h | 15 +- gr-qtgui/src/lib/qtgui_sink_f.cc | 31 +- gr-qtgui/src/lib/qtgui_sink_f.h | 18 +- gr-qtgui/src/lib/spectrumUpdateEvents.h | 1 + gr-qtgui/src/lib/spectrumdisplayform.cc | 29 +- gr-qtgui/src/lib/spectrumdisplayform.h | 6 +- gr-qtgui/src/python/pyqt_example.py | 2 +- gr-qtgui/src/python/pyqt_example_f.py | 2 +- gr-qtgui/src/python/qt_digital.py | 4 +- gr-qtgui/src/python/usrp_display.py | 270 ++++-- gr-qtgui/src/python/usrp_display_qtgui.py | 164 ++++ gr-qtgui/src/python/usrp_display_qtgui.ui | 313 ++++++ 31 files changed, 2730 insertions(+), 889 deletions(-) create mode 100644 gnuradio-examples/python/usrp2/qt_wfm_interface.py create mode 100644 gnuradio-examples/python/usrp2/qt_wfm_interface.ui create mode 100755 gnuradio-examples/python/usrp2/usrp2_wfm_qt.py create mode 100644 gr-qtgui/src/python/usrp_display_qtgui.py create mode 100644 gr-qtgui/src/python/usrp_display_qtgui.ui diff --git a/gnuradio-examples/python/digital/benchmark_qt_loopback.py b/gnuradio-examples/python/digital/benchmark_qt_loopback.py index 3fd76fdf..cd77f074 100755 --- a/gnuradio-examples/python/digital/benchmark_qt_loopback.py +++ b/gnuradio-examples/python/digital/benchmark_qt_loopback.py @@ -229,10 +229,10 @@ class my_top_block(gr.top_block): fftsize = 2048 self.snk_tx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, - -1/2, 1/2, + 0, 1, "Tx", True, True, False, True, True) self.snk_rx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, - -1/2, 1/2, + 0, 1, "Rx", True, True, False, True, True) self.snk_tx.set_frequency_axis(-80, 0) diff --git a/gnuradio-examples/python/digital/benchmark_qt_rx.py b/gnuradio-examples/python/digital/benchmark_qt_rx.py index 62f9f34a..33cf94a5 100755 --- a/gnuradio-examples/python/digital/benchmark_qt_rx.py +++ b/gnuradio-examples/python/digital/benchmark_qt_rx.py @@ -48,7 +48,7 @@ try: except ImportError: print "Error: could not find qt_rx_window.py:" print "\tYou must first build this from qt_rx_window.ui with the following command:" - print "\t pyuic4 qt_rx_window.ui -o qt_rx_window.py" + print "\t\"pyuic4 qt_rx_window.ui -o qt_rx_window.py\"" sys.exit(1) #import os @@ -213,12 +213,13 @@ class my_top_block(gr.top_block): if self.gui_on: self.qapp = QtGui.QApplication(sys.argv) fftsize = 2048 - + + bw_in = self.u.adc_rate() / self.decim() self.snk_rxin = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, - -1/2, 1/2, + self._rx_freq, bw_in, "Received", True, True, False, True, True, False) self.snk_rx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, - -1/2, 1/2, + 0, self._bitrate, "Post-Synchronizer", True, True, False, True, True, False) self.snk_rxin.set_frequency_axis(-60, 60) @@ -285,6 +286,12 @@ class my_top_block(gr.top_block): self._decim = decim self.u.set_decim(self._decim) + if(self.gui_on): + bw_in = self.u.adc_rate() / self._decim + self._bitrate = bw_in / self._samples_per_symbol + self.snk_rxin.set_frequency_range(0, -bw_in/2.0, bw_in/2.0) + self.snk_rx.set_frequency_range(0, -self._bitrate/2.0, self._bitrate/2.0) + def frequency(self): return self._rx_freq diff --git a/gnuradio-examples/python/digital/qt_digital_window.py b/gnuradio-examples/python/digital/qt_digital_window.py index 5e888591..e3feb57c 100644 --- a/gnuradio-examples/python/digital/qt_digital_window.py +++ b/gnuradio-examples/python/digital/qt_digital_window.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'qt_digital_window.ui' # -# Created: Thu Jun 18 08:08:38 2009 +# Created: Fri Jul 3 10:03:54 2009 # by: PyQt4 UI code generator 4.4.3 # # WARNING! All changes made in this file will be lost! @@ -12,94 +12,210 @@ from PyQt4 import QtCore, QtGui class Ui_DigitalWindow(object): def setupUi(self, DigitalWindow): DigitalWindow.setObjectName("DigitalWindow") - DigitalWindow.resize(1236, 739) + DigitalWindow.resize(1050, 752) self.centralwidget = QtGui.QWidget(DigitalWindow) self.centralwidget.setObjectName("centralwidget") - self.closeButton = QtGui.QPushButton(self.centralwidget) - self.closeButton.setGeometry(QtCore.QRect(1120, 640, 101, 31)) - self.closeButton.setObjectName("closeButton") + self.gridLayout = QtGui.QGridLayout(self.centralwidget) + self.gridLayout.setObjectName("gridLayout") + self.verticalLayout_2 = QtGui.QVBoxLayout() + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.sysBox = QtGui.QGroupBox(self.centralwidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.sysBox.sizePolicy().hasHeightForWidth()) + self.sysBox.setSizePolicy(sizePolicy) + self.sysBox.setMinimumSize(QtCore.QSize(240, 60)) + self.sysBox.setMaximumSize(QtCore.QSize(240, 16777215)) + self.sysBox.setObjectName("sysBox") + self.formLayoutWidget = QtGui.QWidget(self.sysBox) + self.formLayoutWidget.setGeometry(QtCore.QRect(10, 20, 221, 31)) + self.formLayoutWidget.setObjectName("formLayoutWidget") + self.formLayout = QtGui.QFormLayout(self.formLayoutWidget) + self.formLayout.setSizeConstraint(QtGui.QLayout.SetFixedSize) + self.formLayout.setVerticalSpacing(20) + self.formLayout.setObjectName("formLayout") + self.sampleRateEdit = QtGui.QLineEdit(self.formLayoutWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.sampleRateEdit.sizePolicy().hasHeightForWidth()) + self.sampleRateEdit.setSizePolicy(sizePolicy) + self.sampleRateEdit.setMinimumSize(QtCore.QSize(100, 26)) + self.sampleRateEdit.setMaximumSize(QtCore.QSize(100, 26)) + self.sampleRateEdit.setObjectName("sampleRateEdit") + self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.sampleRateEdit) + self.sampleRateLabel = QtGui.QLabel(self.formLayoutWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.sampleRateLabel.sizePolicy().hasHeightForWidth()) + self.sampleRateLabel.setSizePolicy(sizePolicy) + self.sampleRateLabel.setMinimumSize(QtCore.QSize(0, 20)) + self.sampleRateLabel.setMaximumSize(QtCore.QSize(16777215, 20)) + self.sampleRateLabel.setObjectName("sampleRateLabel") + self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel) + self.verticalLayout_2.addWidget(self.sysBox) + spacerItem = QtGui.QSpacerItem(20, 60, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + self.verticalLayout_2.addItem(spacerItem) + self.gridLayout.addLayout(self.verticalLayout_2, 2, 0, 1, 1) + self.channelModeBox = QtGui.QGroupBox(self.centralwidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.channelModeBox.sizePolicy().hasHeightForWidth()) + self.channelModeBox.setSizePolicy(sizePolicy) + self.channelModeBox.setMinimumSize(QtCore.QSize(245, 130)) + self.channelModeBox.setMaximumSize(QtCore.QSize(245, 16777215)) + self.channelModeBox.setObjectName("channelModeBox") + self.formLayoutWidget_2 = QtGui.QWidget(self.channelModeBox) + self.formLayoutWidget_2.setGeometry(QtCore.QRect(10, 20, 231, 98)) + self.formLayoutWidget_2.setObjectName("formLayoutWidget_2") + self.formLayout_2 = QtGui.QFormLayout(self.formLayoutWidget_2) + self.formLayout_2.setSizeConstraint(QtGui.QLayout.SetFixedSize) + self.formLayout_2.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) + self.formLayout_2.setObjectName("formLayout_2") + self.snrLabel = QtGui.QLabel(self.formLayoutWidget_2) + self.snrLabel.setObjectName("snrLabel") + self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.snrLabel) + self.snrEdit = QtGui.QLineEdit(self.formLayoutWidget_2) + self.snrEdit.setMinimumSize(QtCore.QSize(100, 0)) + self.snrEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.snrEdit.setObjectName("snrEdit") + self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.snrEdit) + self.freqLabel = QtGui.QLabel(self.formLayoutWidget_2) + self.freqLabel.setObjectName("freqLabel") + self.formLayout_2.setWidget(1, QtGui.QFormLayout.LabelRole, self.freqLabel) + self.freqEdit = QtGui.QLineEdit(self.formLayoutWidget_2) + self.freqEdit.setMinimumSize(QtCore.QSize(100, 0)) + self.freqEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.freqEdit.setObjectName("freqEdit") + self.formLayout_2.setWidget(1, QtGui.QFormLayout.FieldRole, self.freqEdit) + self.timeLabel = QtGui.QLabel(self.formLayoutWidget_2) + self.timeLabel.setObjectName("timeLabel") + self.formLayout_2.setWidget(2, QtGui.QFormLayout.LabelRole, self.timeLabel) + self.timeEdit = QtGui.QLineEdit(self.formLayoutWidget_2) + self.timeEdit.setMinimumSize(QtCore.QSize(100, 0)) + self.timeEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.timeEdit.setObjectName("timeEdit") + self.formLayout_2.setWidget(2, QtGui.QFormLayout.FieldRole, self.timeEdit) + self.gridLayout.addWidget(self.channelModeBox, 2, 1, 1, 1) + self.verticalLayout_5 = QtGui.QVBoxLayout() + self.verticalLayout_5.setObjectName("verticalLayout_5") self.sinkFrame = QtGui.QFrame(self.centralwidget) - self.sinkFrame.setGeometry(QtCore.QRect(10, 10, 1221, 501)) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.sinkFrame.sizePolicy().hasHeightForWidth()) + self.sinkFrame.setSizePolicy(sizePolicy) + self.sinkFrame.setMinimumSize(QtCore.QSize(1000, 550)) self.sinkFrame.setFrameShape(QtGui.QFrame.StyledPanel) self.sinkFrame.setFrameShadow(QtGui.QFrame.Raised) self.sinkFrame.setObjectName("sinkFrame") - self.horizontalLayoutWidget = QtGui.QWidget(self.sinkFrame) - self.horizontalLayoutWidget.setGeometry(QtCore.QRect(10, 10, 1201, 481)) - self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget") - self.sinkLayout = QtGui.QHBoxLayout(self.horizontalLayoutWidget) + self.gridLayout_2 = QtGui.QGridLayout(self.sinkFrame) + self.gridLayout_2.setObjectName("gridLayout_2") + self.sinkLayout = QtGui.QHBoxLayout() self.sinkLayout.setObjectName("sinkLayout") - self.channelModeBox = QtGui.QGroupBox(self.centralwidget) - self.channelModeBox.setGeometry(QtCore.QRect(290, 520, 291, 161)) - self.channelModeBox.setObjectName("channelModeBox") - self.timeLabel = QtGui.QLabel(self.channelModeBox) - self.timeLabel.setGeometry(QtCore.QRect(10, 90, 101, 17)) - self.timeLabel.setObjectName("timeLabel") - self.timeEdit = QtGui.QLineEdit(self.channelModeBox) - self.timeEdit.setGeometry(QtCore.QRect(160, 90, 113, 23)) - self.timeEdit.setObjectName("timeEdit") - self.snrEdit = QtGui.QLineEdit(self.channelModeBox) - self.snrEdit.setGeometry(QtCore.QRect(160, 30, 113, 23)) - self.snrEdit.setObjectName("snrEdit") - self.snrLabel = QtGui.QLabel(self.channelModeBox) - self.snrLabel.setGeometry(QtCore.QRect(10, 30, 111, 20)) - self.snrLabel.setObjectName("snrLabel") - self.freqEdit = QtGui.QLineEdit(self.channelModeBox) - self.freqEdit.setGeometry(QtCore.QRect(160, 60, 113, 23)) - self.freqEdit.setObjectName("freqEdit") - self.freqLabel = QtGui.QLabel(self.channelModeBox) - self.freqLabel.setGeometry(QtCore.QRect(10, 60, 141, 17)) - self.freqLabel.setObjectName("freqLabel") + self.gridLayout_2.addLayout(self.sinkLayout, 1, 0, 1, 1) + self.verticalLayout_5.addWidget(self.sinkFrame) + self.gridLayout.addLayout(self.verticalLayout_5, 0, 0, 1, 6) + self.verticalLayout_3 = QtGui.QVBoxLayout() + self.verticalLayout_3.setObjectName("verticalLayout_3") self.rxBox = QtGui.QGroupBox(self.centralwidget) - self.rxBox.setGeometry(QtCore.QRect(590, 520, 251, 161)) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.rxBox.sizePolicy().hasHeightForWidth()) + self.rxBox.setSizePolicy(sizePolicy) + self.rxBox.setMinimumSize(QtCore.QSize(180, 90)) + self.rxBox.setMaximumSize(QtCore.QSize(180, 16777215)) self.rxBox.setObjectName("rxBox") - self.gainMuEdit = QtGui.QLineEdit(self.rxBox) - self.gainMuEdit.setGeometry(QtCore.QRect(120, 30, 113, 23)) - self.gainMuEdit.setObjectName("gainMuEdit") - self.gainMuLabel = QtGui.QLabel(self.rxBox) - self.gainMuLabel.setGeometry(QtCore.QRect(10, 30, 111, 20)) + self.formLayoutWidget_3 = QtGui.QWidget(self.rxBox) + self.formLayoutWidget_3.setGeometry(QtCore.QRect(10, 20, 161, 61)) + self.formLayoutWidget_3.setObjectName("formLayoutWidget_3") + self.formLayout_3 = QtGui.QFormLayout(self.formLayoutWidget_3) + self.formLayout_3.setSizeConstraint(QtGui.QLayout.SetFixedSize) + self.formLayout_3.setObjectName("formLayout_3") + self.gainMuLabel = QtGui.QLabel(self.formLayoutWidget_3) self.gainMuLabel.setObjectName("gainMuLabel") - self.alphaEdit = QtGui.QLineEdit(self.rxBox) - self.alphaEdit.setGeometry(QtCore.QRect(120, 60, 113, 23)) - self.alphaEdit.setObjectName("alphaEdit") - self.alphaLabel = QtGui.QLabel(self.rxBox) - self.alphaLabel.setGeometry(QtCore.QRect(10, 60, 111, 20)) + self.formLayout_3.setWidget(0, QtGui.QFormLayout.LabelRole, self.gainMuLabel) + self.alphaLabel = QtGui.QLabel(self.formLayoutWidget_3) self.alphaLabel.setObjectName("alphaLabel") - self.sysBox = QtGui.QGroupBox(self.centralwidget) - self.sysBox.setGeometry(QtCore.QRect(20, 520, 261, 161)) - self.sysBox.setObjectName("sysBox") - self.sampleRateEdit = QtGui.QLineEdit(self.sysBox) - self.sampleRateEdit.setGeometry(QtCore.QRect(140, 30, 113, 23)) - self.sampleRateEdit.setObjectName("sampleRateEdit") - self.sampleRateLabel = QtGui.QLabel(self.sysBox) - self.sampleRateLabel.setGeometry(QtCore.QRect(10, 30, 121, 20)) - self.sampleRateLabel.setObjectName("sampleRateLabel") - self.pauseButton = QtGui.QPushButton(self.centralwidget) - self.pauseButton.setGeometry(QtCore.QRect(1120, 520, 101, 31)) - self.pauseButton.setObjectName("pauseButton") + self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole, self.alphaLabel) + self.gainMuEdit = QtGui.QLineEdit(self.formLayoutWidget_3) + self.gainMuEdit.setMinimumSize(QtCore.QSize(100, 0)) + self.gainMuEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.gainMuEdit.setObjectName("gainMuEdit") + self.formLayout_3.setWidget(0, QtGui.QFormLayout.FieldRole, self.gainMuEdit) + self.alphaEdit = QtGui.QLineEdit(self.formLayoutWidget_3) + self.alphaEdit.setMinimumSize(QtCore.QSize(100, 0)) + self.alphaEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.alphaEdit.setObjectName("alphaEdit") + self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.alphaEdit) + self.verticalLayout_3.addWidget(self.rxBox) + spacerItem1 = QtGui.QSpacerItem(20, 30, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + self.verticalLayout_3.addItem(spacerItem1) + self.gridLayout.addLayout(self.verticalLayout_3, 2, 2, 1, 1) self.rxBox_2 = QtGui.QGroupBox(self.centralwidget) - self.rxBox_2.setGeometry(QtCore.QRect(850, 520, 251, 161)) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.rxBox_2.sizePolicy().hasHeightForWidth()) + self.rxBox_2.setSizePolicy(sizePolicy) + self.rxBox_2.setMinimumSize(QtCore.QSize(220, 125)) + self.rxBox_2.setMaximumSize(QtCore.QSize(265, 125)) self.rxBox_2.setObjectName("rxBox_2") - self.pktsRcvdEdit = QtGui.QLineEdit(self.rxBox_2) - self.pktsRcvdEdit.setGeometry(QtCore.QRect(120, 30, 113, 23)) - self.pktsRcvdEdit.setObjectName("pktsRcvdEdit") - self.pktsRcvdLabel = QtGui.QLabel(self.rxBox_2) - self.pktsRcvdLabel.setGeometry(QtCore.QRect(10, 30, 111, 20)) + self.formLayoutWidget_4 = QtGui.QWidget(self.rxBox_2) + self.formLayoutWidget_4.setGeometry(QtCore.QRect(10, 20, 201, 92)) + self.formLayoutWidget_4.setObjectName("formLayoutWidget_4") + self.formLayout_4 = QtGui.QFormLayout(self.formLayoutWidget_4) + self.formLayout_4.setSizeConstraint(QtGui.QLayout.SetFixedSize) + self.formLayout_4.setObjectName("formLayout_4") + self.pktsRcvdLabel = QtGui.QLabel(self.formLayoutWidget_4) self.pktsRcvdLabel.setObjectName("pktsRcvdLabel") - self.pktsCorrectEdit = QtGui.QLineEdit(self.rxBox_2) - self.pktsCorrectEdit.setGeometry(QtCore.QRect(120, 60, 113, 23)) - self.pktsCorrectEdit.setObjectName("pktsCorrectEdit") - self.pktsCorrectLabel = QtGui.QLabel(self.rxBox_2) - self.pktsCorrectLabel.setGeometry(QtCore.QRect(10, 60, 111, 20)) + self.formLayout_4.setWidget(0, QtGui.QFormLayout.LabelRole, self.pktsRcvdLabel) + self.pktsCorrectLabel = QtGui.QLabel(self.formLayoutWidget_4) self.pktsCorrectLabel.setObjectName("pktsCorrectLabel") - self.perLabel = QtGui.QLabel(self.rxBox_2) - self.perLabel.setGeometry(QtCore.QRect(10, 90, 111, 20)) + self.formLayout_4.setWidget(1, QtGui.QFormLayout.LabelRole, self.pktsCorrectLabel) + self.perLabel = QtGui.QLabel(self.formLayoutWidget_4) self.perLabel.setObjectName("perLabel") - self.perEdit = QtGui.QLineEdit(self.rxBox_2) - self.perEdit.setGeometry(QtCore.QRect(120, 90, 113, 23)) + self.formLayout_4.setWidget(2, QtGui.QFormLayout.LabelRole, self.perLabel) + self.pktsRcvdEdit = QtGui.QLineEdit(self.formLayoutWidget_4) + self.pktsRcvdEdit.setMinimumSize(QtCore.QSize(100, 0)) + self.pktsRcvdEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.pktsRcvdEdit.setObjectName("pktsRcvdEdit") + self.formLayout_4.setWidget(0, QtGui.QFormLayout.FieldRole, self.pktsRcvdEdit) + self.pktsCorrectEdit = QtGui.QLineEdit(self.formLayoutWidget_4) + self.pktsCorrectEdit.setMinimumSize(QtCore.QSize(100, 0)) + self.pktsCorrectEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.pktsCorrectEdit.setObjectName("pktsCorrectEdit") + self.formLayout_4.setWidget(1, QtGui.QFormLayout.FieldRole, self.pktsCorrectEdit) + self.perEdit = QtGui.QLineEdit(self.formLayoutWidget_4) + self.perEdit.setMinimumSize(QtCore.QSize(100, 0)) + self.perEdit.setMaximumSize(QtCore.QSize(100, 16777215)) self.perEdit.setObjectName("perEdit") + self.formLayout_4.setWidget(2, QtGui.QFormLayout.FieldRole, self.perEdit) + self.gridLayout.addWidget(self.rxBox_2, 2, 3, 1, 1) + spacerItem2 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.gridLayout.addItem(spacerItem2, 2, 4, 1, 1) + self.verticalLayout = QtGui.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + self.pauseButton = QtGui.QPushButton(self.centralwidget) + self.pauseButton.setMinimumSize(QtCore.QSize(80, 0)) + self.pauseButton.setMaximumSize(QtCore.QSize(80, 16777215)) + self.pauseButton.setObjectName("pauseButton") + self.verticalLayout.addWidget(self.pauseButton) + spacerItem3 = QtGui.QSpacerItem(20, 60, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + self.verticalLayout.addItem(spacerItem3) + self.closeButton = QtGui.QPushButton(self.centralwidget) + self.closeButton.setMinimumSize(QtCore.QSize(80, 0)) + self.closeButton.setMaximumSize(QtCore.QSize(80, 16777215)) + self.closeButton.setObjectName("closeButton") + self.verticalLayout.addWidget(self.closeButton) + self.gridLayout.addLayout(self.verticalLayout, 2, 5, 1, 1) DigitalWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(DigitalWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 1236, 25)) + self.menubar.setGeometry(QtCore.QRect(0, 0, 1050, 24)) self.menubar.setObjectName("menubar") self.menuFile = QtGui.QMenu(self.menubar) self.menuFile.setObjectName("menuFile") @@ -116,27 +232,26 @@ class Ui_DigitalWindow(object): QtCore.QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), DigitalWindow.close) QtCore.QObject.connect(self.actionExit, QtCore.SIGNAL("triggered()"), DigitalWindow.close) QtCore.QMetaObject.connectSlotsByName(DigitalWindow) - DigitalWindow.setTabOrder(self.closeButton, self.snrEdit) DigitalWindow.setTabOrder(self.snrEdit, self.freqEdit) DigitalWindow.setTabOrder(self.freqEdit, self.timeEdit) def retranslateUi(self, DigitalWindow): DigitalWindow.setWindowTitle(QtGui.QApplication.translate("DigitalWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8)) - self.closeButton.setText(QtGui.QApplication.translate("DigitalWindow", "Close", None, QtGui.QApplication.UnicodeUTF8)) + self.sysBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "System Parameters", None, QtGui.QApplication.UnicodeUTF8)) + self.sampleRateLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Sample Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) self.channelModeBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Channel Model Parameters", None, QtGui.QApplication.UnicodeUTF8)) - self.timeLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Timing Offset", None, QtGui.QApplication.UnicodeUTF8)) self.snrLabel.setText(QtGui.QApplication.translate("DigitalWindow", "SNR (dB)", None, QtGui.QApplication.UnicodeUTF8)) self.freqLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Frequency Offset (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.timeLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Timing Offset", None, QtGui.QApplication.UnicodeUTF8)) self.rxBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Receiver Parameters", None, QtGui.QApplication.UnicodeUTF8)) self.gainMuLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Gain mu", None, QtGui.QApplication.UnicodeUTF8)) self.alphaLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Alpha", None, QtGui.QApplication.UnicodeUTF8)) - self.sysBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "System Parameters", None, QtGui.QApplication.UnicodeUTF8)) - self.sampleRateLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Sample Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) - self.pauseButton.setText(QtGui.QApplication.translate("DigitalWindow", "Pause", None, QtGui.QApplication.UnicodeUTF8)) self.rxBox_2.setTitle(QtGui.QApplication.translate("DigitalWindow", "Received Packet Info", None, QtGui.QApplication.UnicodeUTF8)) self.pktsRcvdLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Packets Rcvd.", None, QtGui.QApplication.UnicodeUTF8)) self.pktsCorrectLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Packets Correct", None, QtGui.QApplication.UnicodeUTF8)) self.perLabel.setText(QtGui.QApplication.translate("DigitalWindow", "PER", None, QtGui.QApplication.UnicodeUTF8)) + self.pauseButton.setText(QtGui.QApplication.translate("DigitalWindow", "Pause", None, QtGui.QApplication.UnicodeUTF8)) + self.closeButton.setText(QtGui.QApplication.translate("DigitalWindow", "Close", None, QtGui.QApplication.UnicodeUTF8)) self.menuFile.setTitle(QtGui.QApplication.translate("DigitalWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) self.actionExit.setText(QtGui.QApplication.translate("DigitalWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/gnuradio-examples/python/digital/qt_digital_window.ui b/gnuradio-examples/python/digital/qt_digital_window.ui index 669942cb..413801ec 100644 --- a/gnuradio-examples/python/digital/qt_digital_window.ui +++ b/gnuradio-examples/python/digital/qt_digital_window.ui @@ -1,358 +1,596 @@ - - + DigitalWindow - - + + 0 0 - 1236 - 739 + 1050 + 752 - + MainWindow - - - - - 1120 - 640 - 101 - 31 - - - - Close - - - - - - 10 - 10 - 1221 - 501 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - 10 - 10 - 1201 - 481 - - - - - - - - - 290 - 520 - 291 - 161 - - - - Channel Model Parameters - - - - - 10 - 90 - 101 - 17 - - - - Timing Offset - - - - - - 160 - 90 - 113 - 23 - - - - - - - 160 - 30 - 113 - 23 - - - - - - - 10 - 30 - 111 - 20 - - - - SNR (dB) - - - - - - 160 - 60 - 113 - 23 - - - - - - - 10 - 60 - 141 - 17 - - - - Frequency Offset (Hz) - - - - - - - 590 - 520 - 251 - 161 - - - - Receiver Parameters - - - - - 120 - 30 - 113 - 23 - - - - - - - 10 - 30 - 111 - 20 - - - - Gain mu - - - - - - 120 - 60 - 113 - 23 - - - - - - - 10 - 60 - 111 - 20 - - - - Alpha - - - - - - - 20 - 520 - 261 - 161 - - - - System Parameters - - - - - 140 - 30 - 113 - 23 - - - - - - - 10 - 30 - 121 - 20 - - - - Sample Rate (sps) - - - - - - - 1120 - 520 - 101 - 31 - - - - Pause - - - - - - 850 - 520 - 251 - 161 - - - - Received Packet Info - - - - - 120 - 30 - 113 - 23 - - - - - - - 10 - 30 - 111 - 20 - - - - Packets Rcvd. - - - - - - 120 - 60 - 113 - 23 - - - - - - - 10 - 60 - 111 - 20 - - - - Packets Correct - - - - - - 10 - 90 - 111 - 20 - - - - PER - - - - - - 120 - 90 - 113 - 23 - - - - + + + + + + + + + 0 + 0 + + + + + 240 + 60 + + + + + 240 + 16777215 + + + + System Parameters + + + + + 10 + 20 + 221 + 31 + + + + + QLayout::SetFixedSize + + + 20 + + + + + + 0 + 0 + + + + + 100 + 26 + + + + + 100 + 26 + + + + + + + + + 0 + 0 + + + + + 0 + 20 + + + + + 16777215 + 20 + + + + Sample Rate (sps) + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 60 + + + + + + + + + + + 0 + 0 + + + + + 245 + 130 + + + + + 245 + 16777215 + + + + Channel Model Parameters + + + + + 10 + 20 + 231 + 98 + + + + + QLayout::SetFixedSize + + + QFormLayout::AllNonFixedFieldsGrow + + + + + SNR (dB) + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + + + + + Frequency Offset (Hz) + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + + + + + Timing Offset + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + + + + + + + + + + + + 0 + 0 + + + + + 1000 + 550 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + verticalLayoutWidget + verticalLayoutWidget + + + + + + + + + + + 0 + 0 + + + + + 180 + 90 + + + + + 180 + 16777215 + + + + Receiver Parameters + + + + + 10 + 20 + 161 + 61 + + + + + QLayout::SetFixedSize + + + + + Gain mu + + + + + + + Alpha + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 30 + + + + + + + + + + + 0 + 0 + + + + + 220 + 125 + + + + + 265 + 125 + + + + Received Packet Info + + + + + 10 + 20 + 201 + 92 + + + + + QLayout::SetFixedSize + + + + + Packets Rcvd. + + + + + + + Packets Correct + + + + + + + PER + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + + + + + + + + + Qt::Horizontal + + + + 20 + 20 + + + + + + + + + + + 80 + 0 + + + + + 80 + 16777215 + + + + Pause + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 60 + + + + + + + + + 80 + 0 + + + + + 80 + 16777215 + + + + Close + + + + + + + sinkFrame + channelModeBox + verticalLayoutWidget + verticalLayoutWidget + rxBox + + rxBox_2 + horizontalSpacer + - - + + 0 0 - 1236 - 25 + 1050 + 24 - - + + &File - + - + - - - + + + E&xit - closeButton snrEdit freqEdit timeEdit @@ -365,11 +603,11 @@ DigitalWindow close() - + 322 623 - + 66 561 @@ -381,11 +619,11 @@ DigitalWindow close() - + -1 -1 - + 617 327 diff --git a/gnuradio-examples/python/digital/qt_rx_window.py b/gnuradio-examples/python/digital/qt_rx_window.py index 0879e1c6..60e1a6e3 100644 --- a/gnuradio-examples/python/digital/qt_rx_window.py +++ b/gnuradio-examples/python/digital/qt_rx_window.py @@ -2,8 +2,8 @@ # Form implementation generated from reading ui file 'qt_rx_window.ui' # -# Created: Wed Jun 17 18:59:00 2009 -# by: PyQt4 UI code generator 4.4.4 +# Created: Fri Jul 3 01:03:19 2009 +# by: PyQt4 UI code generator 4.4.3 # # WARNING! All changes made in this file will be lost! @@ -12,24 +12,40 @@ from PyQt4 import QtCore, QtGui class Ui_DigitalWindow(object): def setupUi(self, DigitalWindow): DigitalWindow.setObjectName("DigitalWindow") - DigitalWindow.resize(1085, 766) + DigitalWindow.resize(1000, 816) self.centralwidget = QtGui.QWidget(DigitalWindow) self.centralwidget.setObjectName("centralwidget") - self.closeButton = QtGui.QPushButton(self.centralwidget) - self.closeButton.setGeometry(QtCore.QRect(960, 670, 101, 31)) - self.closeButton.setObjectName("closeButton") + self.gridLayout = QtGui.QGridLayout(self.centralwidget) + self.gridLayout.setObjectName("gridLayout") self.sinkFrame = QtGui.QFrame(self.centralwidget) - self.sinkFrame.setGeometry(QtCore.QRect(10, 10, 1061, 501)) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(1) + sizePolicy.setHeightForWidth(self.sinkFrame.sizePolicy().hasHeightForWidth()) + self.sinkFrame.setSizePolicy(sizePolicy) + self.sinkFrame.setMinimumSize(QtCore.QSize(800, 500)) self.sinkFrame.setFrameShape(QtGui.QFrame.StyledPanel) self.sinkFrame.setFrameShadow(QtGui.QFrame.Raised) self.sinkFrame.setObjectName("sinkFrame") - self.horizontalLayoutWidget = QtGui.QWidget(self.sinkFrame) - self.horizontalLayoutWidget.setGeometry(QtCore.QRect(10, 10, 1041, 481)) - self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget") - self.sinkLayout = QtGui.QHBoxLayout(self.horizontalLayoutWidget) + self.horizontalLayout_2 = QtGui.QHBoxLayout(self.sinkFrame) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.sinkLayout = QtGui.QHBoxLayout() self.sinkLayout.setObjectName("sinkLayout") + self.horizontalLayout_2.addLayout(self.sinkLayout) + self.gridLayout.addWidget(self.sinkFrame, 0, 0, 1, 1) + spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + self.gridLayout.addItem(spacerItem, 1, 0, 1, 1) + self.horizontalLayout = QtGui.QHBoxLayout() + self.horizontalLayout.setSizeConstraint(QtGui.QLayout.SetFixedSize) + self.horizontalLayout.setObjectName("horizontalLayout") self.rxBox = QtGui.QGroupBox(self.centralwidget) - self.rxBox.setGeometry(QtCore.QRect(10, 520, 251, 181)) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.rxBox.sizePolicy().hasHeightForWidth()) + self.rxBox.setSizePolicy(sizePolicy) + self.rxBox.setMinimumSize(QtCore.QSize(250, 190)) + self.rxBox.setMaximumSize(QtCore.QSize(250, 190)) self.rxBox.setObjectName("rxBox") self.gainMuEdit = QtGui.QLineEdit(self.rxBox) self.gainMuEdit.setGeometry(QtCore.QRect(120, 120, 113, 23)) @@ -61,30 +77,66 @@ class Ui_DigitalWindow(object): self.decimEdit = QtGui.QLineEdit(self.rxBox) self.decimEdit.setGeometry(QtCore.QRect(120, 90, 113, 23)) self.decimEdit.setObjectName("decimEdit") - self.rxBox_2 = QtGui.QGroupBox(self.centralwidget) - self.rxBox_2.setGeometry(QtCore.QRect(300, 520, 251, 121)) - self.rxBox_2.setObjectName("rxBox_2") - self.pktsRcvdEdit = QtGui.QLineEdit(self.rxBox_2) + self.horizontalLayout.addWidget(self.rxBox) + self.verticalLayout_3 = QtGui.QVBoxLayout() + self.verticalLayout_3.setObjectName("verticalLayout_3") + self.rxPacketBox = QtGui.QGroupBox(self.centralwidget) + self.rxPacketBox.setEnabled(True) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.rxPacketBox.sizePolicy().hasHeightForWidth()) + self.rxPacketBox.setSizePolicy(sizePolicy) + self.rxPacketBox.setMinimumSize(QtCore.QSize(250, 130)) + self.rxPacketBox.setMaximumSize(QtCore.QSize(250, 130)) + font = QtGui.QFont() + font.setWeight(50) + font.setBold(False) + self.rxPacketBox.setFont(font) + self.rxPacketBox.setObjectName("rxPacketBox") + self.pktsRcvdEdit = QtGui.QLineEdit(self.rxPacketBox) self.pktsRcvdEdit.setGeometry(QtCore.QRect(120, 30, 113, 23)) self.pktsRcvdEdit.setObjectName("pktsRcvdEdit") - self.pktsRcvdLabel = QtGui.QLabel(self.rxBox_2) + self.pktsRcvdLabel = QtGui.QLabel(self.rxPacketBox) self.pktsRcvdLabel.setGeometry(QtCore.QRect(10, 30, 111, 20)) self.pktsRcvdLabel.setObjectName("pktsRcvdLabel") - self.pktsCorrectEdit = QtGui.QLineEdit(self.rxBox_2) + self.pktsCorrectEdit = QtGui.QLineEdit(self.rxPacketBox) self.pktsCorrectEdit.setGeometry(QtCore.QRect(120, 60, 113, 23)) self.pktsCorrectEdit.setObjectName("pktsCorrectEdit") - self.pktsCorrectLabel = QtGui.QLabel(self.rxBox_2) + self.pktsCorrectLabel = QtGui.QLabel(self.rxPacketBox) self.pktsCorrectLabel.setGeometry(QtCore.QRect(10, 60, 111, 20)) self.pktsCorrectLabel.setObjectName("pktsCorrectLabel") - self.perLabel = QtGui.QLabel(self.rxBox_2) + self.perLabel = QtGui.QLabel(self.rxPacketBox) self.perLabel.setGeometry(QtCore.QRect(10, 90, 111, 20)) self.perLabel.setObjectName("perLabel") - self.perEdit = QtGui.QLineEdit(self.rxBox_2) + self.perEdit = QtGui.QLineEdit(self.rxPacketBox) self.perEdit.setGeometry(QtCore.QRect(120, 90, 113, 23)) self.perEdit.setObjectName("perEdit") + self.verticalLayout_3.addWidget(self.rxPacketBox) + spacerItem1 = QtGui.QSpacerItem(20, 60, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + self.verticalLayout_3.addItem(spacerItem1) + self.horizontalLayout.addLayout(self.verticalLayout_3) + spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.horizontalLayout.addItem(spacerItem2) + self.verticalLayout_5 = QtGui.QVBoxLayout() + self.verticalLayout_5.setObjectName("verticalLayout_5") + spacerItem3 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.verticalLayout_5.addItem(spacerItem3) + self.closeButton = QtGui.QPushButton(self.centralwidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.closeButton.sizePolicy().hasHeightForWidth()) + self.closeButton.setSizePolicy(sizePolicy) + self.closeButton.setMinimumSize(QtCore.QSize(80, 30)) + self.closeButton.setMaximumSize(QtCore.QSize(80, 30)) + self.closeButton.setObjectName("closeButton") + self.verticalLayout_5.addWidget(self.closeButton) + self.horizontalLayout.addLayout(self.verticalLayout_5) + self.gridLayout.addLayout(self.horizontalLayout, 2, 0, 1, 1) DigitalWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(DigitalWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 1085, 24)) + self.menubar.setGeometry(QtCore.QRect(0, 0, 1000, 24)) self.menubar.setObjectName("menubar") self.menuFile = QtGui.QMenu(self.menubar) self.menuFile.setObjectName("menuFile") @@ -98,23 +150,23 @@ class Ui_DigitalWindow(object): self.menubar.addAction(self.menuFile.menuAction()) self.retranslateUi(DigitalWindow) - QtCore.QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), DigitalWindow.close) QtCore.QObject.connect(self.actionExit, QtCore.SIGNAL("triggered()"), DigitalWindow.close) + QtCore.QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), DigitalWindow.close) QtCore.QMetaObject.connectSlotsByName(DigitalWindow) def retranslateUi(self, DigitalWindow): DigitalWindow.setWindowTitle(QtGui.QApplication.translate("DigitalWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8)) - self.closeButton.setText(QtGui.QApplication.translate("DigitalWindow", "Close", None, QtGui.QApplication.UnicodeUTF8)) self.rxBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Receiver Parameters", None, QtGui.QApplication.UnicodeUTF8)) self.gainMuLabel.setText(QtGui.QApplication.translate("DigitalWindow", "mu\'s gain", None, QtGui.QApplication.UnicodeUTF8)) self.alphaLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Alpha", None, QtGui.QApplication.UnicodeUTF8)) self.gainLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Gain (dB)", None, QtGui.QApplication.UnicodeUTF8)) self.freqLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Frequency (Hz)", None, QtGui.QApplication.UnicodeUTF8)) self.decimLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Decimation", None, QtGui.QApplication.UnicodeUTF8)) - self.rxBox_2.setTitle(QtGui.QApplication.translate("DigitalWindow", "Received Packet Info", None, QtGui.QApplication.UnicodeUTF8)) + self.rxPacketBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Received Packet Info", None, QtGui.QApplication.UnicodeUTF8)) self.pktsRcvdLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Packets Rcvd.", None, QtGui.QApplication.UnicodeUTF8)) self.pktsCorrectLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Packets Correct", None, QtGui.QApplication.UnicodeUTF8)) self.perLabel.setText(QtGui.QApplication.translate("DigitalWindow", "PER", None, QtGui.QApplication.UnicodeUTF8)) + self.closeButton.setText(QtGui.QApplication.translate("DigitalWindow", "Close", None, QtGui.QApplication.UnicodeUTF8)) self.menuFile.setTitle(QtGui.QApplication.translate("DigitalWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) self.actionExit.setText(QtGui.QApplication.translate("DigitalWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/gnuradio-examples/python/digital/qt_rx_window.ui b/gnuradio-examples/python/digital/qt_rx_window.ui index 9b0b0be8..4631b778 100644 --- a/gnuradio-examples/python/digital/qt_rx_window.ui +++ b/gnuradio-examples/python/digital/qt_rx_window.ui @@ -5,271 +5,406 @@ 0 0 - 1085 - 766 + 1000 + 816 MainWindow - - - - 960 - 670 - 101 - 31 - - - - Close - - - - - - 10 - 10 - 1061 - 501 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - 10 - 10 - 1041 - 481 - - - - - - - - - 10 - 520 - 251 - 181 - - - - Receiver Parameters - - - - - 120 - 120 - 113 - 23 - - - - - - - 10 - 120 - 111 - 20 - - - - mu's gain - - - - - - 120 - 150 - 113 - 23 - - - - - - - 10 - 150 - 111 - 20 - - - - Alpha - - - - - - 10 - 60 - 101 - 17 - - - - Gain (dB) - - - - - - 120 - 30 - 113 - 23 - - - - - - - 10 - 30 - 141 - 17 - - - - Frequency (Hz) - - - - - - 120 - 60 - 113 - 23 - - - - - - - 10 - 90 - 101 - 17 - - - - Decimation - - - - - - 120 - 90 - 113 - 23 - - - - - - - - 300 - 520 - 251 - 121 - - - - Received Packet Info - - - - - 120 - 30 - 113 - 23 - - - - - - - 10 - 30 - 111 - 20 - - - - Packets Rcvd. - - - - - - 120 - 60 - 113 - 23 - - - - - - - 10 - 60 - 111 - 20 - - - - Packets Correct - - - - - - 10 - 90 - 111 - 20 - - - - PER - - - - - - 120 - 90 - 113 - 23 - - - - + + + + + + 0 + 1 + + + + + 800 + 500 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 40 + + + + + + + + QLayout::SetFixedSize + + + + + + 0 + 0 + + + + + 250 + 190 + + + + + 250 + 190 + + + + Receiver Parameters + + + + + 120 + 120 + 113 + 23 + + + + + + + 10 + 120 + 111 + 20 + + + + mu's gain + + + + + + 120 + 150 + 113 + 23 + + + + + + + 10 + 150 + 111 + 20 + + + + Alpha + + + + + + 10 + 60 + 101 + 17 + + + + Gain (dB) + + + + + + 120 + 30 + 113 + 23 + + + + + + + 10 + 30 + 141 + 17 + + + + Frequency (Hz) + + + + + + 120 + 60 + 113 + 23 + + + + + + + 10 + 90 + 101 + 17 + + + + Decimation + + + + + + 120 + 90 + 113 + 23 + + + + + + + + + + + true + + + + 0 + 0 + + + + + 250 + 130 + + + + + 250 + 130 + + + + + 50 + false + + + + Received Packet Info + + + + + 120 + 30 + 113 + 23 + + + + + + + 10 + 30 + 111 + 20 + + + + Packets Rcvd. + + + + + + 120 + 60 + 113 + 23 + + + + + + + 10 + 60 + 111 + 20 + + + + Packets Correct + + + + + + 10 + 90 + 111 + 20 + + + + PER + + + + + + 120 + 90 + 113 + 23 + + + + pktsRcvdEdit + pktsRcvdLabel + pktsCorrectEdit + pktsCorrectLabel + perLabel + perEdit + rxBox + verticalLayoutWidget + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 60 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + + 80 + 30 + + + + + 80 + 30 + + + + Close + + + + + + + + + closeButton + sinkFrame + rxBox + rxPacketBox + verticalLayoutWidget + verticalSpacer + horizontalLayoutWidget_2 0 0 - 1085 + 1000 24 @@ -288,40 +423,37 @@ - - closeButton - - closeButton - clicked() + actionExit + triggered() DigitalWindow close() - 322 - 623 + -1 + -1 - 66 - 561 + 617 + 327 - actionExit - triggered() + closeButton + clicked() DigitalWindow close() - -1 - -1 + 960 + 694 - 617 - 327 + 66 + 561 diff --git a/gnuradio-examples/python/usrp2/qt_wfm_interface.py b/gnuradio-examples/python/usrp2/qt_wfm_interface.py new file mode 100644 index 00000000..4c4367ed --- /dev/null +++ b/gnuradio-examples/python/usrp2/qt_wfm_interface.py @@ -0,0 +1,99 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'qt_wfm_interface.ui' +# +# Created: Thu Jun 18 23:41:03 2009 +# by: PyQt4 UI code generator 4.4.3 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +class Ui_InterfaceWindow(object): + def setupUi(self, InterfaceWindow): + InterfaceWindow.setObjectName("InterfaceWindow") + InterfaceWindow.resize(909, 711) + self.centralwidget = QtGui.QWidget(InterfaceWindow) + self.centralwidget.setObjectName("centralwidget") + self.closeButton = QtGui.QPushButton(self.centralwidget) + self.closeButton.setGeometry(QtCore.QRect(790, 580, 101, 31)) + self.closeButton.setObjectName("closeButton") + self.sinkFrame = QtGui.QFrame(self.centralwidget) + self.sinkFrame.setGeometry(QtCore.QRect(10, 10, 891, 501)) + self.sinkFrame.setFrameShape(QtGui.QFrame.StyledPanel) + self.sinkFrame.setFrameShadow(QtGui.QFrame.Raised) + self.sinkFrame.setObjectName("sinkFrame") + self.horizontalLayoutWidget = QtGui.QWidget(self.sinkFrame) + self.horizontalLayoutWidget.setGeometry(QtCore.QRect(10, 10, 871, 481)) + self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget") + self.sinkLayout = QtGui.QHBoxLayout(self.horizontalLayoutWidget) + self.sinkLayout.setObjectName("sinkLayout") + self.channelModeBox = QtGui.QGroupBox(self.centralwidget) + self.channelModeBox.setGeometry(QtCore.QRect(10, 520, 261, 131)) + self.channelModeBox.setObjectName("channelModeBox") + self.bandwidthabel = QtGui.QLabel(self.channelModeBox) + self.bandwidthabel.setGeometry(QtCore.QRect(10, 90, 101, 17)) + self.bandwidthabel.setObjectName("bandwidthabel") + self.bandwidthEdit = QtGui.QLineEdit(self.channelModeBox) + self.bandwidthEdit.setGeometry(QtCore.QRect(130, 90, 113, 23)) + self.bandwidthEdit.setObjectName("bandwidthEdit") + self.gainEdit = QtGui.QLineEdit(self.channelModeBox) + self.gainEdit.setGeometry(QtCore.QRect(130, 60, 113, 23)) + self.gainEdit.setObjectName("gainEdit") + self.gainLabel = QtGui.QLabel(self.channelModeBox) + self.gainLabel.setGeometry(QtCore.QRect(10, 60, 111, 20)) + self.gainLabel.setObjectName("gainLabel") + self.freqEdit = QtGui.QLineEdit(self.channelModeBox) + self.freqEdit.setGeometry(QtCore.QRect(130, 30, 113, 23)) + self.freqEdit.setObjectName("freqEdit") + self.freqLabel = QtGui.QLabel(self.channelModeBox) + self.freqLabel.setGeometry(QtCore.QRect(10, 30, 111, 17)) + self.freqLabel.setObjectName("freqLabel") + self.pauseButton = QtGui.QPushButton(self.centralwidget) + self.pauseButton.setGeometry(QtCore.QRect(790, 520, 101, 31)) + self.pauseButton.setObjectName("pauseButton") + self.fmBox = QtGui.QGroupBox(self.centralwidget) + self.fmBox.setGeometry(QtCore.QRect(290, 520, 251, 131)) + self.fmBox.setObjectName("fmBox") + self.volumeEdit = QtGui.QLineEdit(self.fmBox) + self.volumeEdit.setGeometry(QtCore.QRect(130, 20, 113, 23)) + self.volumeEdit.setObjectName("volumeEdit") + self.volumeLabel = QtGui.QLabel(self.fmBox) + self.volumeLabel.setGeometry(QtCore.QRect(10, 20, 111, 17)) + self.volumeLabel.setObjectName("volumeLabel") + InterfaceWindow.setCentralWidget(self.centralwidget) + self.menubar = QtGui.QMenuBar(InterfaceWindow) + self.menubar.setGeometry(QtCore.QRect(0, 0, 909, 24)) + self.menubar.setObjectName("menubar") + self.menuFile = QtGui.QMenu(self.menubar) + self.menuFile.setObjectName("menuFile") + InterfaceWindow.setMenuBar(self.menubar) + self.statusbar = QtGui.QStatusBar(InterfaceWindow) + self.statusbar.setObjectName("statusbar") + InterfaceWindow.setStatusBar(self.statusbar) + self.actionExit = QtGui.QAction(InterfaceWindow) + self.actionExit.setObjectName("actionExit") + self.menuFile.addAction(self.actionExit) + self.menubar.addAction(self.menuFile.menuAction()) + + self.retranslateUi(InterfaceWindow) + QtCore.QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), InterfaceWindow.close) + QtCore.QObject.connect(self.actionExit, QtCore.SIGNAL("triggered()"), InterfaceWindow.close) + QtCore.QMetaObject.connectSlotsByName(InterfaceWindow) + InterfaceWindow.setTabOrder(self.closeButton, self.gainEdit) + InterfaceWindow.setTabOrder(self.gainEdit, self.freqEdit) + InterfaceWindow.setTabOrder(self.freqEdit, self.bandwidthEdit) + + def retranslateUi(self, InterfaceWindow): + InterfaceWindow.setWindowTitle(QtGui.QApplication.translate("InterfaceWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8)) + self.closeButton.setText(QtGui.QApplication.translate("InterfaceWindow", "Close", None, QtGui.QApplication.UnicodeUTF8)) + self.channelModeBox.setTitle(QtGui.QApplication.translate("InterfaceWindow", "USRP Parameters", None, QtGui.QApplication.UnicodeUTF8)) + self.bandwidthabel.setText(QtGui.QApplication.translate("InterfaceWindow", "Bandwidth (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.gainLabel.setText(QtGui.QApplication.translate("InterfaceWindow", "Gain (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.freqLabel.setText(QtGui.QApplication.translate("InterfaceWindow", "Frequency", None, QtGui.QApplication.UnicodeUTF8)) + self.pauseButton.setText(QtGui.QApplication.translate("InterfaceWindow", "Pause", None, QtGui.QApplication.UnicodeUTF8)) + self.fmBox.setTitle(QtGui.QApplication.translate("InterfaceWindow", "FM Tuner Parameters", None, QtGui.QApplication.UnicodeUTF8)) + self.volumeLabel.setText(QtGui.QApplication.translate("InterfaceWindow", "Volume", None, QtGui.QApplication.UnicodeUTF8)) + self.menuFile.setTitle(QtGui.QApplication.translate("InterfaceWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) + self.actionExit.setText(QtGui.QApplication.translate("InterfaceWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8)) + diff --git a/gnuradio-examples/python/usrp2/qt_wfm_interface.ui b/gnuradio-examples/python/usrp2/qt_wfm_interface.ui new file mode 100644 index 00000000..16902d9f --- /dev/null +++ b/gnuradio-examples/python/usrp2/qt_wfm_interface.ui @@ -0,0 +1,253 @@ + + InterfaceWindow + + + + 0 + 0 + 909 + 711 + + + + MainWindow + + + + + + 790 + 580 + 101 + 31 + + + + Close + + + + + + 10 + 10 + 891 + 501 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 10 + 10 + 871 + 481 + + + + + + + + + 10 + 520 + 261 + 131 + + + + USRP Parameters + + + + + 10 + 90 + 101 + 17 + + + + Bandwidth (Hz) + + + + + + 130 + 90 + 113 + 23 + + + + + + + 130 + 60 + 113 + 23 + + + + + + + 10 + 60 + 111 + 20 + + + + Gain (dB) + + + + + + 130 + 30 + 113 + 23 + + + + + + + 10 + 30 + 111 + 17 + + + + Frequency + + + + + + + 790 + 520 + 101 + 31 + + + + Pause + + + + + + 290 + 520 + 251 + 131 + + + + FM Tuner Parameters + + + + + 130 + 20 + 113 + 23 + + + + + + + 10 + 20 + 111 + 17 + + + + Volume + + + + + + + + 0 + 0 + 909 + 24 + + + + + &File + + + + + + + + + E&xit + + + + + closeButton + gainEdit + freqEdit + bandwidthEdit + + + + + closeButton + clicked() + InterfaceWindow + close() + + + 322 + 623 + + + 66 + 561 + + + + + actionExit + triggered() + InterfaceWindow + close() + + + -1 + -1 + + + 617 + 327 + + + + + diff --git a/gnuradio-examples/python/usrp2/usrp2_wfm_qt.py b/gnuradio-examples/python/usrp2/usrp2_wfm_qt.py new file mode 100755 index 00000000..0be21ceb --- /dev/null +++ b/gnuradio-examples/python/usrp2/usrp2_wfm_qt.py @@ -0,0 +1,352 @@ +#!/usr/bin/env python +# +# Copyright 2005,2006,2007,2008,2009 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr, gru, eng_notation, optfir +from gnuradio import audio +from gnuradio import usrp2 +from gnuradio import blks2 +from gnuradio.eng_option import eng_option +from optparse import OptionParser +import sys +import math + + +try: + from gnuradio.qtgui import qtgui + from PyQt4 import QtGui, QtCore + import sip +except ImportError: + print "Please install gr-qtgui." + sys.exit(1) + +try: + from qt_wfm_interface import Ui_InterfaceWindow +except ImportError: + print "Error: could not find qt_wfm_interface.py:" + print "\tPlease run: \"pyuic4 qt_wfm_interface.ui -o qt_wfm_interface.py\"" + sys.exit(1) + +print "This program is not in a proper working state. Comment this out if you want to play." +sys.exit(1) + + +# //////////////////////////////////////////////////////////////////// +# Define the QT Interface and Control Dialog +# //////////////////////////////////////////////////////////////////// + + +class dialog_box(QtGui.QMainWindow): + def __init__(self, snk_usrp, snk_vol, fg, parent=None): + + QtGui.QWidget.__init__(self, parent) + self.gui = Ui_InterfaceWindow() + self.gui.setupUi(self) + + self.fg = fg + + # Set USRP parameters + self.set_bw(self.fg.usrp_bw()) + self.set_freq(self.fg.freq()) + self.set_gain(self.fg.gain()) + self.set_volume(self.fg.volume()) + + # Add the qtsnk widgets to the hlayout box + self.gui.sinkLayout.addWidget(snk_usrp) + self.gui.sinkLayout.addWidget(snk_vol) + + + # Connect up some signals + self.connect(self.gui.pauseButton, QtCore.SIGNAL("clicked()"), + self.pauseFg) + + self.connect(self.gui.bandwidthEdit, QtCore.SIGNAL("editingFinished()"), + self.bwEditText) + self.connect(self.gui.freqEdit, QtCore.SIGNAL("editingFinished()"), + self.freqEditText) + self.connect(self.gui.gainEdit, QtCore.SIGNAL("editingFinished()"), + self.gainEditText) + + self.connect(self.gui.volumeEdit, QtCore.SIGNAL("editingFinished()"), + self.volumeEditText) + + + def pauseFg(self): + if(self.gui.pauseButton.text() == "Pause"): + self.fg.stop() + self.fg.wait() + self.gui.pauseButton.setText("Unpause") + else: + self.fg.start() + self.gui.pauseButton.setText("Pause") + + + # Accessor functions for Gui to manipulate USRP + def set_bw(self, bw): + self.gui.bandwidthEdit.setText(QtCore.QString("%1").arg(bw)) + + def set_freq(self, freq): + self.gui.freqEdit.setText(QtCore.QString("%1").arg(freq)) + + def set_gain(self, gain): + self.gui.gainEdit.setText(QtCore.QString("%1").arg(gain)) + + def set_volume(self, vol): + self.gui.volumeEdit.setText(QtCore.QString("%1").arg(vol)) + + def bwEditText(self): + try: + bw = self.gui.bandwidthEdit.text().toDouble()[0] + self.fg.set_usrp_bw(bw) + except RuntimeError: + pass + + def freqEditText(self): + try: + freq = self.gui.freqEdit.text().toDouble()[0] + self.fg.set_freq(freq) + except RuntimeError: + pass + + def gainEditText(self): + try: + gain = self.gui.gainEdit.text().toDouble()[0] + self.fg.set_gain(gain) + except RuntimeError: + pass + + def volumeEditText(self): + try: + vol = self.gui.volumeEdit.text().toDouble()[0] + self.fg.set_volume(vol) + except RuntimeError: + pass + + + + +# //////////////////////////////////////////////////////////////////// +# Define the GNU Radio Top Block +# //////////////////////////////////////////////////////////////////// + + +class wfm_rx_block (gr.top_block): + def __init__(self): + gr.top_block.__init__(self) + + parser = OptionParser(option_class=eng_option) + parser.add_option("-e", "--interface", type="string", default="eth0", + help="select Ethernet interface, default is eth0") + parser.add_option("-m", "--mac-addr", type="string", default="", + help="select USRP by MAC address, default is auto-select") + #parser.add_option("-A", "--antenna", default=None, + # help="select Rx Antenna (only on RFX-series boards)") + parser.add_option("-f", "--freq", type="eng_float", default=100.1, + help="set frequency to FREQ", metavar="FREQ") + parser.add_option("-g", "--gain", type="eng_float", default=None, + help="set gain in dB (default is midpoint)") + parser.add_option("-V", "--volume", type="eng_float", default=None, + help="set volume (default is midpoint)") + parser.add_option("-O", "--audio-output", type="string", default="", + help="pcm device name. E.g., hw:0,0 or surround51 or /dev/dsp") + + (options, args) = parser.parse_args() + if len(args) != 0: + parser.print_help() + sys.exit(1) + + self._volume = options.volume + self._usrp_freq = options.freq + self._usrp_gain = options.gain + self._audio_rate = int(32e3) + + # build graph + + self.u = usrp2.source_32fc(options.interface, options.mac_addr) + + # calculate decimation values to get USRP BW at 320 kHz + self.calculate_usrp_bw(320e3) + + self.set_decim(self._usrp_decim) + + #FIXME: need named constants and text descriptions available to (gr-)usrp2 even + #when usrp(1) module is not built. A usrp_common module, perhaps? + dbid = self.u.daughterboard_id() + print "Using RX d'board 0x%04X" % (dbid,) + #if not (dbid == 0x0001 or #usrp_dbid.BASIC_RX + # dbid == 0x0003 or #usrp_dbid.TV_RX + # dbid == 0x000c or #usrp_dbid.TV_RX_REV_2 + # dbid == 0x0040): #usrp_dbid.TV_RX_REV_3 + # print "This daughterboard does not cover the required frequency range" + # print "for this application. Please use a BasicRX or TVRX daughterboard." + # raw_input("Press ENTER to continue anyway, or Ctrl-C to exit.") + + chan_filt_coeffs = optfir.low_pass (1, # gain + self._usrp_rate, # sampling rate + 80e3, # passband cutoff + 115e3, # stopband cutoff + 0.1, # passband ripple + 60) # stopband attenuation + #print len(chan_filt_coeffs) + chan_filt = gr.fir_filter_ccf (self._chanfilt_decim, chan_filt_coeffs) + + self.guts = blks2.wfm_rcv (self._demod_rate, self._audio_decim) + + self.volume_control = gr.multiply_const_ff(1) + + # sound card as final sink + #audio_sink = audio.sink (int (audio_rate), + # options.audio_output, + # False) # ok_to_block + audio_sink = audio.sink (self._audio_rate, + options.audio_output) + + + if self._usrp_gain is None: + # if no gain was specified, use the mid-point in dB + g = self.u.gain_range() + print "Gain range: ", g + self._usrp_gain = float(g[0]+g[1])/2 + + if self._volume is None: + g = self.volume_range() + self._volume = float(g[0]+g[1])/2 + + if abs(self._usrp_freq) < 1e6: + self._usrp_freq *= 1e6 + + # set initial values + self.set_gain(self._usrp_gain) + self.set_volume(self._volume) + if not(self.set_freq(self._usrp_freq)): + print ("Failed to set initial frequency") + + + # Define a GUI sink to display the received signal + self.qapp = QtGui.QApplication(sys.argv) + fftsize = 2048 + + self.usrp_rx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, + -self._usrp_rate/2.0, self._usrp_rate/2.0, + "Received Signal", True, True, False, True, False, + use_openGL=False) + self.usrp_rx2 = qtgui.sink_f(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, + -self._usrp_rate/2.0, self._usrp_rate/2.0, + "Received Signal", True, True, False, True, False) + + # now wire it all together + self.connect (self.u, chan_filt, self.guts, self.volume_control, audio_sink) + self.connect (self.u, self.usrp_rx) + self.connect (self.volume_control, self.usrp_rx2) + + usrp_rx_widget = sip.wrapinstance(self.usrp_rx.pyqwidget(), QtGui.QWidget) + usrp_rx2_widget = sip.wrapinstance(self.usrp_rx2.pyqwidget(), QtGui.QWidget) + + self.main_box = dialog_box(usrp_rx_widget, usrp_rx2_widget, self) + self.main_box.show() + + + def calculate_usrp_bw(self, bw): + """ + Calculate the different decimation rates that make the USRP BW equal to the + input bandwidth parameter 'bw' and the audio bandwidth equal to the system- + wide bandwidth 'self._audio_rate' + """ + + adc_rate = self.u.adc_rate() + d_usrp = int(adc_rate/bw) + bw_real = adc_rate / float(d_usrp) + + d_chan = 1 + demod_rate = bw_real / d_chan + + d_audio = int(bw_real / self._audio_rate) + audio_rate = demod_rate / d_audio + + self._usrp_decim = d_usrp + self._chanfilt_decim = d_chan + self._audio_decim = d_audio + self._demod_rate = demod_rate + self._usrp_rate = bw_real + + print "USRP Decimation: ", self._usrp_decim + print "USRP Bandwidth: ", bw_real + print "Audio Decimation: ", self._audio_decim + print "Audio Bandwidth: ", audio_rate + + def set_volume (self, vol): + g = self.volume_range() + self._volume = max(g[0], min(g[1], vol)) + self.volume_control.set_k(10**(self._volume/10)) + + def set_freq(self, target_freq): + """ + Set the center frequency we're interested in. + + @param target_freq: frequency in Hz + @rypte: bool + + Tuning is a two step process. First we ask the front-end to + tune as close to the desired frequency as it can. Then we use + the result of that operation and our target_frequency to + determine the value for the digital down converter. + """ + r = self.u.set_center_freq(target_freq) + if r: + self._usrp_freq = target_freq + return True + return False + + def set_usrp_bw(self, bw): + self.calculate_usrp_bw(bw) + + def set_gain(self, gain): + self._usrp_gain = gain + self.u.set_gain(gain) + + def set_decim(self, decim): + self._usrp_decim = int(decim) + self.u.set_decim(self._usrp_decim) + + def volume(self): + return self._volume + + def freq(self): + return self._usrp_freq + + def usrp_bw(self): + return self._usrp_rate + + def gain(self): + return self._usrp_gain + + def decim(self): + return self._usrp_decim + + def volume_range(self): + return (-20.0, 0.0, 0.5) + + +if __name__ == '__main__': + tb = wfm_rx_block() + tb.start() + tb.qapp.exec_() + diff --git a/gr-qtgui/src/lib/ConstellationDisplayPlot.h b/gr-qtgui/src/lib/ConstellationDisplayPlot.h index 20de2164..612cd2b3 100644 --- a/gr-qtgui/src/lib/ConstellationDisplayPlot.h +++ b/gr-qtgui/src/lib/ConstellationDisplayPlot.h @@ -1,6 +1,7 @@ #ifndef CONSTELLATION_DISPLAY_PLOT_HPP #define CONSTELLATION_DISPLAY_PLOT_HPP +#include #include #include #include diff --git a/gr-qtgui/src/lib/FrequencyDisplayPlot.cc b/gr-qtgui/src/lib/FrequencyDisplayPlot.cc index 63d68b9b..154c8d23 100644 --- a/gr-qtgui/src/lib/FrequencyDisplayPlot.cc +++ b/gr-qtgui/src/lib/FrequencyDisplayPlot.cc @@ -117,8 +117,10 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent) setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency); setAxisTitle(QwtPlot::xBottom, "Frequency (Hz)"); + _minYAxis = -120; + _maxYAxis = 10; setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine); - set_yaxis(-210, 5); + setAxisScale(QwtPlot::yLeft, _minYAxis, _maxYAxis); setAxisTitle(QwtPlot::yLeft, "Power (dB)"); // Automatically deleted when parent is deleted @@ -225,7 +227,15 @@ FrequencyDisplayPlot::~FrequencyDisplayPlot() void FrequencyDisplayPlot::set_yaxis(double min, double max) { - setAxisScale(QwtPlot::yLeft, min, max); + // Get the new max/min values for the plot + _minYAxis = min; + _maxYAxis = max; + + // Set the axis max/min to the new values + setAxisScale(QwtPlot::yLeft, _minYAxis, _maxYAxis); + + // Reset the base zoom level to the new axis scale set here + _zoomer->setZoomBase(); } void @@ -249,17 +259,14 @@ FrequencyDisplayPlot::SetFrequencyRange(const double constStartFreq, _startFrequency = startFreq; _stopFrequency = stopFreq; _resetXAxisPoints(); - + setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency); setAxisScaleDraw(QwtPlot::xBottom, new FreqDisplayScaleDraw(2)); setAxisTitle(QwtPlot::xBottom, QString("Frequency (%1)").arg(strunits.c_str())); ((FreqDisplayZoomer*)_zoomer)->SetFrequencyPrecision(2); // Load up the new base zoom settings - QwtDoubleRect newSize = _zoomer->zoomBase(); - newSize.setLeft(_startFrequency); - newSize.setWidth(_stopFrequency-_startFrequency); - _zoomer->setZoomBase(newSize); + _zoomer->setZoomBase(); // Zooms back to the base and clears any other zoom levels _zoomer->zoom(0); @@ -362,7 +369,7 @@ void FrequencyDisplayPlot::ClearMaxData() { for(int64_t number = 0; number < _numPoints; number++){ - _maxFFTPoints[number] = -280.0; + _maxFFTPoints[number] = _maxYAxis; } } @@ -370,7 +377,7 @@ void FrequencyDisplayPlot::ClearMinData() { for(int64_t number = 0; number < _numPoints; number++){ - _minFFTPoints[number] = 200.0; + _minFFTPoints[number] = _minYAxis; } } diff --git a/gr-qtgui/src/lib/FrequencyDisplayPlot.h b/gr-qtgui/src/lib/FrequencyDisplayPlot.h index 31f2055b..5e828296 100644 --- a/gr-qtgui/src/lib/FrequencyDisplayPlot.h +++ b/gr-qtgui/src/lib/FrequencyDisplayPlot.h @@ -1,6 +1,7 @@ #ifndef FREQUENCY_DISPLAY_PLOT_HPP #define FREQUENCY_DISPLAY_PLOT_HPP +#include #include #include #include @@ -52,7 +53,9 @@ private: double _startFrequency; double _stopFrequency; - + double _maxYAxis; + double _minYAxis; + QwtPlotCurve* _fft_plot_curve; QwtPlotCurve* _min_fft_plot_curve; QwtPlotCurve* _max_fft_plot_curve; diff --git a/gr-qtgui/src/lib/SpectrumGUIClass.cc b/gr-qtgui/src/lib/SpectrumGUIClass.cc index f35062ea..f196d7c5 100644 --- a/gr-qtgui/src/lib/SpectrumGUIClass.cc +++ b/gr-qtgui/src/lib/SpectrumGUIClass.cc @@ -10,7 +10,8 @@ const long SpectrumGUIClass::MAX_FFT_SIZE; const long SpectrumGUIClass::MIN_FFT_SIZE; SpectrumGUIClass::SpectrumGUIClass(const uint64_t maxDataSize, - const uint64_t fftSize, + const uint64_t fftSize, + const double newCenterFrequency, const double newStartFrequency, const double newStopFrequency) { @@ -25,7 +26,7 @@ SpectrumGUIClass::SpectrumGUIClass(const uint64_t maxDataSize, _pendingGUIUpdateEventsCount = 0; _droppedEntriesCount = 0; - _centerFrequency = 0; + _centerFrequency = newCenterFrequency; _startFrequency = newStartFrequency; _stopFrequency = newStopFrequency; @@ -113,6 +114,9 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, // Draw Blank Display UpdateWindow(false, NULL, 0, NULL, 0, NULL, 0, 1.0, get_highres_clock(), true); + // Set up the initial frequency axis settings + SetFrequencyRange(_centerFrequency, _startFrequency, _stopFrequency); + // GUI Thread only qApp->processEvents(); } diff --git a/gr-qtgui/src/lib/SpectrumGUIClass.h b/gr-qtgui/src/lib/SpectrumGUIClass.h index b87b50ca..9a55271d 100644 --- a/gr-qtgui/src/lib/SpectrumGUIClass.h +++ b/gr-qtgui/src/lib/SpectrumGUIClass.h @@ -23,7 +23,9 @@ class SpectrumGUIClass { public: SpectrumGUIClass(const uint64_t maxDataSize, const uint64_t fftSize, - const double newStartFrequency, const double newStopFrequency); + const double newCenterFrequency, + const double newStartFrequency, + const double newStopFrequency); ~SpectrumGUIClass(); void Reset(); diff --git a/gr-qtgui/src/lib/TimeDomainDisplayPlot.h b/gr-qtgui/src/lib/TimeDomainDisplayPlot.h index 9f0ecfa2..9c6364af 100644 --- a/gr-qtgui/src/lib/TimeDomainDisplayPlot.h +++ b/gr-qtgui/src/lib/TimeDomainDisplayPlot.h @@ -1,6 +1,7 @@ #ifndef TIME_DOMAIN_DISPLAY_PLOT_HPP #define TIME_DOMAIN_DISPLAY_PLOT_HPP +#include #include #include #include diff --git a/gr-qtgui/src/lib/Waterfall3DDisplayPlot.h b/gr-qtgui/src/lib/Waterfall3DDisplayPlot.h index 8af5f6b5..f46f260e 100644 --- a/gr-qtgui/src/lib/Waterfall3DDisplayPlot.h +++ b/gr-qtgui/src/lib/Waterfall3DDisplayPlot.h @@ -1,6 +1,7 @@ #ifndef WATERFALL_3D_DISPLAY_PLOT_HPP #define WATERFALL_3D_DISPLAY_PLOT_HPP +#include #include #include diff --git a/gr-qtgui/src/lib/WaterfallDisplayPlot.h b/gr-qtgui/src/lib/WaterfallDisplayPlot.h index d5371a03..fbbb69a5 100644 --- a/gr-qtgui/src/lib/WaterfallDisplayPlot.h +++ b/gr-qtgui/src/lib/WaterfallDisplayPlot.h @@ -1,6 +1,7 @@ #ifndef WATERFALL_DISPLAY_PLOT_HPP #define WATERFALL_DISPLAY_PLOT_HPP +#include #include #include #include diff --git a/gr-qtgui/src/lib/qtgui.i b/gr-qtgui/src/lib/qtgui.i index 0c2e7a54..d2f734fd 100644 --- a/gr-qtgui/src/lib/qtgui.i +++ b/gr-qtgui/src/lib/qtgui.i @@ -30,7 +30,7 @@ GR_SWIG_BLOCK_MAGIC(qtgui,sink_c) qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype, - float fmin=-0.5, float fmax=0.5, + double fc=0, double bw=1.0, const std::string &name="Display", bool plotfreq=true, bool plotwaterfall=true, bool plotwaterfall3d=true, bool plottime=true, @@ -42,7 +42,7 @@ class qtgui_sink_c : public gr_block { private: friend qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype, - float fmin, float fmax, + double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, bool plotwaterfall3d, bool plottime, @@ -50,7 +50,7 @@ private: bool use_openGL, QWidget *parent); qtgui_sink_c (int fftsize, int wintype, - float fmin, float fmax, + double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, bool plotwaterfall3d, bool plottime, @@ -63,8 +63,7 @@ public: PyObject* pyqwidget(); void set_frequency_range(const double centerfreq, - const double startfreq, - const double stopfreq); + const double bandwidth); void set_time_domain_axis(double min, double max); void set_constellation_axis(double xmin, double xmax, double ymin, double ymax); @@ -79,29 +78,32 @@ public: GR_SWIG_BLOCK_MAGIC(qtgui,sink_f) qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype, - float fmin=-0.5, float fmax=0.5, + double fc=0, double bw=0.0, const std::string &name="Display", bool plotfreq=true, bool plotwaterfall=true, bool plotwaterfall3d=true, bool plottime=true, bool plotconst=true, + bool use_openGL=true, QWidget *parent=NULL); class qtgui_sink_f : public gr_block { private: friend qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype, - float fmin, float fmax, + double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, bool plotwaterfall3d, bool plottime, bool plotconst, + bool use_openGL, QWidget *parent); qtgui_sink_f (int fftsize, int wintype, - float fmin, float fmax, + double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, bool plotwaterfall3d, bool plottime, bool plotconst, + bool use_openGL, QWidget *parent); public: @@ -109,8 +111,7 @@ public: PyObject* pyqwidget(); void set_frequency_range(const double centerfreq, - const double startfreq, - const double stopfreq); + const double bandwidth); void set_time_domain_axis(double min, double max); void set_constellation_axis(double xmin, double xmax, double ymin, double ymax); diff --git a/gr-qtgui/src/lib/qtgui_sink_c.cc b/gr-qtgui/src/lib/qtgui_sink_c.cc index 08cfdab7..b1fd60d3 100644 --- a/gr-qtgui/src/lib/qtgui_sink_c.cc +++ b/gr-qtgui/src/lib/qtgui_sink_c.cc @@ -32,7 +32,7 @@ qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype, - float fmin, float fmax, + double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, bool plotwaterfall3d, bool plottime, @@ -41,7 +41,7 @@ qtgui_make_sink_c (int fftsize, int wintype, QWidget *parent) { return qtgui_sink_c_sptr (new qtgui_sink_c (fftsize, wintype, - fmin, fmax, name, + fc, bw, name, plotfreq, plotwaterfall, plotwaterfall3d, plottime, plotconst, @@ -50,7 +50,7 @@ qtgui_make_sink_c (int fftsize, int wintype, } qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype, - float fmin, float fmax, + double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, bool plotwaterfall3d, bool plottime, @@ -62,7 +62,7 @@ qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype, gr_make_io_signature (0, 0, 0)), d_fftsize(fftsize), d_wintype((gr_firdes::win_type)(wintype)), - d_fmin(fmin), d_fmax(fmax), d_name(name), + d_center_freq(fc), d_bandwidth(bw), d_name(name), d_plotfreq(plotfreq), d_plotwaterfall(plotwaterfall), d_plotwaterfall3d(plotwaterfall3d), d_plottime(plottime), d_plotconst(plotconst), @@ -119,9 +119,15 @@ qtgui_sink_c::initialize(const bool opengl) d_qApplication = new QApplication(argc, argv); } + if(d_center_freq < 0) { + throw std::runtime_error("qtgui_sink_c: Received bad center frequency.\n"); + } + uint64_t maxBufferSize = 32768; d_main_gui = new SpectrumGUIClass(maxBufferSize, d_fftsize, - d_fmin, d_fmax); + d_center_freq, + -d_bandwidth/2.0, + d_bandwidth/2.0); d_main_gui->SetDisplayTitle(d_name); d_main_gui->SetFFTSize(d_fftsize); @@ -160,10 +166,13 @@ qtgui_sink_c::pyqwidget() void qtgui_sink_c::set_frequency_range(const double centerfreq, - const double startfreq, - const double stopfreq) + const double bandwidth) { - d_main_gui->SetFrequencyRange(centerfreq, startfreq, stopfreq); + d_center_freq = centerfreq; + d_bandwidth = bandwidth; + d_main_gui->SetFrequencyRange(d_center_freq, + -d_bandwidth/2.0, + d_bandwidth/2.0); } void @@ -282,7 +291,7 @@ qtgui_sink_c::general_work (int noutput_items, const timespec currentTime = get_highres_clock(); const timespec lastUpdateGUITime = d_main_gui->GetLastGUIUpdateTime(); - if(diff_timespec(currentTime, lastUpdateGUITime) > 0.25) { + if(diff_timespec(currentTime, lastUpdateGUITime) > 0.05) { if(d_index) { int filler = std::min(d_fftsize - d_index, noutput_items); diff --git a/gr-qtgui/src/lib/qtgui_sink_c.h b/gr-qtgui/src/lib/qtgui_sink_c.h index 0b3ba99e..1c9d5920 100644 --- a/gr-qtgui/src/lib/qtgui_sink_c.h +++ b/gr-qtgui/src/lib/qtgui_sink_c.h @@ -35,7 +35,7 @@ class qtgui_sink_c; typedef boost::shared_ptr qtgui_sink_c_sptr; qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype, - float fmin=-0.5, float fmax=0.5, + double fc=0, double bandwidth=1.0, const std::string &name="Spectrum Display", bool plotfreq=true, bool plotwaterfall=true, bool plotwaterfall3d=true, bool plottime=true, @@ -47,7 +47,7 @@ class qtgui_sink_c : public gr_block { private: friend qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype, - float fmin, float fmax, + double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, bool plotwaterfall3d, bool plottime, @@ -55,7 +55,7 @@ private: bool use_openGL, QWidget *parent); qtgui_sink_c (int fftsize, int wintype, - float fmin, float fmax, + double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, bool plotwaterfall3d, bool plottime, @@ -65,13 +65,13 @@ private: // use opengl to force OpenGL on or off // this might be necessary for sessions over SSH - void initialize(const bool opengl); + void initialize(const bool opengl=true); int d_fftsize; gr_firdes::win_type d_wintype; std::vector d_window; - float d_fmin; - float d_fmax; + double d_center_freq; + double d_bandwidth; std::string d_name; pthread_mutex_t d_pmutex; @@ -102,8 +102,7 @@ public: PyObject* pyqwidget(); void set_frequency_range(const double centerfreq, - const double startfreq, - const double stopfreq); + const double bandwidth); void set_time_domain_axis(double min, double max); void set_constellation_axis(double xmin, double xmax, diff --git a/gr-qtgui/src/lib/qtgui_sink_f.cc b/gr-qtgui/src/lib/qtgui_sink_f.cc index 1f76bb35..4c526f09 100644 --- a/gr-qtgui/src/lib/qtgui_sink_f.cc +++ b/gr-qtgui/src/lib/qtgui_sink_f.cc @@ -32,34 +32,37 @@ qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype, - float fmin, float fmax, + double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, bool plotwaterfall3d, bool plottime, bool plotconst, + bool use_openGL, QWidget *parent) { return qtgui_sink_f_sptr (new qtgui_sink_f (fftsize, wintype, - fmin, fmax, name, + fc, bw, name, plotfreq, plotwaterfall, plotwaterfall3d, plottime, plotconst, + use_openGL, parent)); } qtgui_sink_f::qtgui_sink_f (int fftsize, int wintype, - float fmin, float fmax, + double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, bool plotwaterfall3d, bool plottime, bool plotconst, + bool use_openGL, QWidget *parent) : gr_block ("sink_f", gr_make_io_signature (1, 1, sizeof(float)), gr_make_io_signature (0, 0, 0)), d_fftsize(fftsize), d_wintype((gr_firdes::win_type)(wintype)), - d_fmin(fmin), d_fmax(fmax), d_name(name), + d_center_freq(fc), d_bandwidth(bw), d_name(name), d_plotfreq(plotfreq), d_plotwaterfall(plotwaterfall), d_plotwaterfall3d(plotwaterfall3d), d_plottime(plottime), d_plotconst(plotconst), @@ -82,7 +85,7 @@ qtgui_sink_f::qtgui_sink_f (int fftsize, int wintype, buildwindow(); - initialize(); + initialize(use_openGL); } qtgui_sink_f::~qtgui_sink_f() @@ -104,7 +107,7 @@ void qtgui_sink_f::unlock() } void -qtgui_sink_f::initialize() +qtgui_sink_f::initialize(const bool opengl) { if(qApp != NULL) { d_qApplication = qApp; @@ -118,7 +121,9 @@ qtgui_sink_f::initialize() uint64_t maxBufferSize = 32768; d_main_gui = new SpectrumGUIClass(maxBufferSize, d_fftsize, - d_fmin, d_fmax); + d_center_freq, + -d_bandwidth/2.0, + d_bandwidth/2.0); d_main_gui->SetDisplayTitle(d_name); d_main_gui->SetFFTSize(d_fftsize); d_main_gui->SetWindowType((int)d_wintype); @@ -126,7 +131,8 @@ qtgui_sink_f::initialize() d_main_gui->OpenSpectrumWindow(d_parent, d_plotfreq, d_plotwaterfall, d_plotwaterfall3d, d_plottime, - d_plotconst); + d_plotconst, + opengl); d_object = new qtgui_obj(d_qApplication); qApp->postEvent(d_object, new qtgui_event(&d_pmutex)); @@ -154,10 +160,13 @@ qtgui_sink_f::pyqwidget() void qtgui_sink_f::set_frequency_range(const double centerfreq, - const double startfreq, - const double stopfreq) + const double bandwidth) { - d_main_gui->SetFrequencyRange(centerfreq, startfreq, stopfreq); + d_center_freq = centerfreq; + d_bandwidth = bandwidth; + d_main_gui->SetFrequencyRange(d_center_freq, + -d_bandwidth/2.0, + d_bandwidth/2.0); } void diff --git a/gr-qtgui/src/lib/qtgui_sink_f.h b/gr-qtgui/src/lib/qtgui_sink_f.h index 31baa1de..4c24b498 100644 --- a/gr-qtgui/src/lib/qtgui_sink_f.h +++ b/gr-qtgui/src/lib/qtgui_sink_f.h @@ -35,38 +35,41 @@ class qtgui_sink_f; typedef boost::shared_ptr qtgui_sink_f_sptr; qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype, - float fmin=-0.5, float fmax=0.5, + double fc=0, double bw=1.0, const std::string &name="Spectrum Display", bool plotfreq=true, bool plotwaterfall=true, bool plotwaterfall3d=true, bool plottime=true, bool plotconst=true, + bool use_openGL=true, QWidget *parent=NULL); class qtgui_sink_f : public gr_block { private: friend qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype, - float fmin, float fmax, + double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, bool plotwaterfall3d, bool plottime, bool plotconst, + bool use_openGL, QWidget *parent); qtgui_sink_f (int fftsize, int wintype, - float fmin, float fmax, + double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, bool plotwaterfall3d, bool plottime, bool plotconst, + bool use_openGL, QWidget *parent); - void initialize(); + void initialize(const bool opengl=true); int d_fftsize; gr_firdes::win_type d_wintype; std::vector d_window; - float d_fmin; - float d_fmax; + double d_center_freq; + double d_bandwidth; std::string d_name; pthread_mutex_t d_pmutex; @@ -97,8 +100,7 @@ public: PyObject* pyqwidget(); void set_frequency_range(const double centerfreq, - const double startfreq, - const double stopfreq); + const double bandwidth); void set_time_domain_axis(double min, double max); void set_constellation_axis(double xmin, double xmax, diff --git a/gr-qtgui/src/lib/spectrumUpdateEvents.h b/gr-qtgui/src/lib/spectrumUpdateEvents.h index a758d884..75fa2732 100644 --- a/gr-qtgui/src/lib/spectrumUpdateEvents.h +++ b/gr-qtgui/src/lib/spectrumUpdateEvents.h @@ -1,6 +1,7 @@ #ifndef SPECTRUM_UPDATE_EVENTS_H #define SPECTRUM_UPDATE_EVENTS_H +#include #include #include #include diff --git a/gr-qtgui/src/lib/spectrumdisplayform.cc b/gr-qtgui/src/lib/spectrumdisplayform.cc index f8296119..427e70a2 100644 --- a/gr-qtgui/src/lib/spectrumdisplayform.cc +++ b/gr-qtgui/src/lib/spectrumdisplayform.cc @@ -473,19 +473,29 @@ SpectrumDisplayForm::PowerLineEdit_textChanged( const QString &valueString ) } void -SpectrumDisplayForm::SetFrequencyRange(const double newStartFrequency, - const double newStopFrequency, - const double newCenterFrequency) +SpectrumDisplayForm::SetFrequencyRange(const double newCenterFrequency, + const double newStartFrequency, + const double newStopFrequency) { - double fdiff = abs(newStartFrequency - newStopFrequency); + double fdiff; + if(UseRFFrequenciesCheckBox->isChecked()) { + fdiff = newCenterFrequency; + } + else { + fdiff = std::max(fabs(newStartFrequency), fabs(newStopFrequency)); + } if(fdiff > 0) { std::string strunits[4] = {"Hz", "kHz", "MHz", "GHz"}; double units10 = floor(log10(fdiff)); - double units3 = floor(units10 / 3.0); - double units = pow(10, units10); + double units3 = std::max(floor(units10 / 3.0), 0.0); + double units = pow(10, (units10-fmod(units10, 3.0))); int iunit = static_cast(units3); + _startFrequency = newStartFrequency; + _stopFrequency = newStopFrequency; + _centerFrequency = newCenterFrequency; + _frequencyDisplayPlot->SetFrequencyRange(newStartFrequency, newStopFrequency, newCenterFrequency, @@ -635,12 +645,7 @@ SpectrumDisplayForm::WindowTypeChanged( int newItem ) void SpectrumDisplayForm::UseRFFrequenciesCB( bool useRFFlag ) { - if(useRFFlag){ - SetFrequencyRange(_startFrequency, _stopFrequency, _centerFrequency); - } - else{ - SetFrequencyRange(_startFrequency, _stopFrequency, 0.0 ); - } + SetFrequencyRange(_centerFrequency, _startFrequency, _stopFrequency); } diff --git a/gr-qtgui/src/lib/spectrumdisplayform.h b/gr-qtgui/src/lib/spectrumdisplayform.h index a7c5201f..bf802320 100644 --- a/gr-qtgui/src/lib/spectrumdisplayform.h +++ b/gr-qtgui/src/lib/spectrumdisplayform.h @@ -42,9 +42,9 @@ public slots: void MinHoldResetBtn_clicked(); void MaxHoldResetBtn_clicked(); void PowerLineEdit_textChanged( const QString& valueString ); - void SetFrequencyRange( const double newStartFrequency, - const double newStopFrequency, - const double newCenterFrequency ); + void SetFrequencyRange( const double newCenterFrequency, + const double newStartFrequency, + const double newStopFrequency ); void closeEvent( QCloseEvent * e ); void WindowTypeChanged( int newItem ); void UseRFFrequenciesCB( bool useRFFlag ); diff --git a/gr-qtgui/src/python/pyqt_example.py b/gr-qtgui/src/python/pyqt_example.py index ac636295..4fa8cdd9 100755 --- a/gr-qtgui/src/python/pyqt_example.py +++ b/gr-qtgui/src/python/pyqt_example.py @@ -114,7 +114,7 @@ class my_top_block(gr.top_block): channel = gr.channel_model(0.001) thr = gr.throttle(gr.sizeof_gr_complex, 100*fftsize) self.snk1 = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, - -Rs/2, Rs/2, + 0, Rs, "Complex Signal Example", True, True, False, True, False) diff --git a/gr-qtgui/src/python/pyqt_example_f.py b/gr-qtgui/src/python/pyqt_example_f.py index bf10c5c0..46fe07e0 100755 --- a/gr-qtgui/src/python/pyqt_example_f.py +++ b/gr-qtgui/src/python/pyqt_example_f.py @@ -113,7 +113,7 @@ class my_top_block(gr.top_block): src = gr.add_ff() thr = gr.throttle(gr.sizeof_float, 100*fftsize) self.snk1 = qtgui.sink_f(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, - -Rs/2, Rs/2, + 0, Rs, "Float Signal Example", True, True, False, True, False) diff --git a/gr-qtgui/src/python/qt_digital.py b/gr-qtgui/src/python/qt_digital.py index a9a0bd74..ceb492c8 100755 --- a/gr-qtgui/src/python/qt_digital.py +++ b/gr-qtgui/src/python/qt_digital.py @@ -183,10 +183,10 @@ class my_top_block(gr.top_block): self.channel = gr.channel_model(noise, self.fo, self.to) self.thr = gr.throttle(gr.sizeof_char, 10*fftsize) - self.snk_tx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, -1/2, 1/2, + self.snk_tx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, 0, 1, "Tx", True, True, False, True, True) - self.snk_rx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, -1/2, 1/2, + self.snk_rx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, 0, 1, "Rx", True, True, False, True, True) self.connect(self.src, self.thr, self.mod, self.channel, self.snk_tx) diff --git a/gr-qtgui/src/python/usrp_display.py b/gr-qtgui/src/python/usrp_display.py index d5d2bc67..ccb38634 100755 --- a/gr-qtgui/src/python/usrp_display.py +++ b/gr-qtgui/src/python/usrp_display.py @@ -6,114 +6,139 @@ from gnuradio import eng_notation from gnuradio.eng_option import eng_option from gnuradio.qtgui import qtgui from optparse import OptionParser -from PyQt4 import QtGui, QtCore -import sys, sip +import sys -class dialog_box(QtGui.QWidget): - def __init__(self, display, control): - QtGui.QWidget.__init__(self, None) - self.setWindowTitle('USRP FFT') +try: + from gnuradio.qtgui import qtgui + from PyQt4 import QtGui, QtCore + import sip +except ImportError: + print "Please install gr-qtgui." + sys.exit(1) - self.boxlayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self) - self.boxlayout.addWidget(display, 1) - self.boxlayout.addWidget(control) +try: + from usrp_display_qtgui import Ui_MainWindow +except ImportError: + print "Error: could not find usrp_display_qtgui.py:" + print "\t\"pyuic4 usrp_display_qtgui.ui -o usrp_display_qtgui.py\"" + sys.exit(1) - self.resize(800, 500) -class control_panel(QtGui.QWidget): - def __init__(self, usrp, subdev, qtsink, parent=None): - QtGui.QWidget.__init__(self, parent) - self.setWindowTitle('USRP Control Panel') - - self.usrp = usrp - self.subdev = subdev - self.qtsink = qtsink - self.adc_rate = self.usrp.converter_rate() - - self.freq = 0 - self.decim = 0 - self.bw = 0 - self.gain = 0 - - self.setToolTip('Set the values of the USRP') - QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10)) - - self.layout = QtGui.QFormLayout(self) - # Received frequency - self.freqEdit = QtGui.QLineEdit(self) - self.layout.addRow("Frequency:", self.freqEdit) - self.connect(self.freqEdit, QtCore.SIGNAL("editingFinished()"), - self.freqEditText) +# //////////////////////////////////////////////////////////////////// +# Define the QT Interface and Control Dialog +# //////////////////////////////////////////////////////////////////// - # Receiver gain - self.gainEdit = QtGui.QLineEdit(self) - self.layout.addRow("Gain:", self.gainEdit) - self.connect(self.gainEdit, QtCore.SIGNAL("editingFinished()"), - self.gainEditText) +class main_window(QtGui.QMainWindow): + def __init__(self, snk, fg, parent=None): - # Decim / Bandwidth - self.decimEdit = QtGui.QLineEdit(self) - self.layout.addRow("Decim Rate:", self.decimEdit) - self.connect(self.decimEdit, QtCore.SIGNAL("editingFinished()"), - self.decimEditText) + QtGui.QWidget.__init__(self, parent) + self.gui = Ui_MainWindow() + self.gui.setupUi(self) - self.quit = QtGui.QPushButton('Close', self) - self.layout.addRow(self.quit) + self.fg = fg - self.connect(self.quit, QtCore.SIGNAL('clicked()'), - QtGui.qApp, QtCore.SLOT('quit()')) + # Add the qtsnk widgets to the layout box + self.gui.sinkLayout.addWidget(snk) + # Connect up some signals + self.connect(self.gui.pauseButton, QtCore.SIGNAL("clicked()"), + self.pauseFg) + self.connect(self.gui.frequencyEdit, QtCore.SIGNAL("editingFinished()"), + self.frequencyEditText) + self.connect(self.gui.gainEdit, QtCore.SIGNAL("editingFinished()"), + self.gainEditText) + self.connect(self.gui.bandwidthEdit, QtCore.SIGNAL("editingFinished()"), + self.bandwidthEditText) + self.connect(self.gui.amplifierEdit, QtCore.SIGNAL("editingFinished()"), + self.amplifierEditText) + + self.connect(self.gui.actionSaveData, QtCore.SIGNAL("activated()"), + self.saveData) + self.gui.actionSaveData.setShortcut(QtGui.QKeySequence.Save) + + def pauseFg(self): + if(self.gui.pauseButton.text() == "Pause"): + self.fg.stop() + self.fg.wait() + self.gui.pauseButton.setText("Unpause") + else: + self.fg.start() + self.gui.pauseButton.setText("Pause") + + + # Functions to set the values in the GUI def set_frequency(self, freq): self.freq = freq sfreq = eng_notation.num_to_str(self.freq) - self.freqEdit.setText(QtCore.QString("%1").arg(sfreq)) + self.gui.frequencyEdit.setText(QtCore.QString("%1").arg(sfreq)) def set_gain(self, gain): self.gain = gain - self.gainEdit.setText(QtCore.QString("%1").arg(self.gain)) + self.gui.gainEdit.setText(QtCore.QString("%1").arg(self.gain)) + + def set_bandwidth(self, bw): + self.bw = bw + sbw = eng_notation.num_to_str(self.bw) + self.gui.bandwidthEdit.setText(QtCore.QString("%1").arg(sbw)) + + def set_amplifier(self, bw): + self.amp = amp + self.gui.amplifierEdit.setText(QtCore.QString("%1").arg(self.amp)) - def set_decim(self, decim): - self.decim = decim - self.bw = self.adc_rate / float(self.decim) / 1000.0 - self.decimEdit.setText(QtCore.QString("%1").arg(self.decim)) - def freqEditText(self): + # Functions called when signals are triggered in the GUI + def frequencyEditText(self): try: - freq = eng_notation.str_to_num(self.freqEdit.text().toAscii()) - self.usrp.tune(0, self.subdev, freq) + freq = eng_notation.str_to_num(self.gui.frequencyEdit.text().toAscii()) + self.fg.set_frequency(freq) self.freq = freq - self.qtsink.set_frequency_range(self.freq, self.freq-self.bw/2.0, self.freq+self.bw/2.0) except RuntimeError: pass - #self.set_frequency(self.freq) - def gainEditText(self): try: - gain = float(self.gainEdit.text()) - self.subdev.set_gain(gain) + gain = float(self.gui.gainEdit.text()) + self.fg.set_gain(gain) self.gain = gain except ValueError: pass + + def bandwidthEditText(self): + try: + bw = eng_notation.str_to_num(self.gui.bandwidthEdit.text().toAscii()) + self.fg.set_bandwidth(bw) + self.bw = bw + except ValueError: + pass - #self.set_gain(gain) - - def decimEditText(self): + def amplifierEditText(self): try: - decim = int(self.decimEdit.text()) - self.usrp.set_decim_rate(decim) - - self.decim = decim - self.bw = self.adc_rate / self.decim - self.qtsink.set_frequency_range(-self.bw/2.0, self.bw/2.0, self.freq) - + amp = float(self.gui.amplifierEdit.text()) + self.fg.set_amplifier_gain(amp) + self.amp = amp except ValueError: pass - #self.set_decim(decim) + def saveData(self): + fileName = QtGui.QFileDialog.getSaveFileName(self, "Save data to file", "."); + if(len(fileName)): + self.fg.save_to_file(str(fileName)) + +def pick_subdevice(u): + """ + The user didn't specify a subdevice on the command line. + If there's a daughterboard on A, select A. + If there's a daughterboard on B, select B. + Otherwise, select A. + """ + if u.db(0, 0).dbid() >= 0: # dbid is < 0 if there's no d'board or a problem + return (0, 0) + if u.db(0, 0).dbid() >= 0: + return (1, 0) + return (0, 0) class my_top_block(gr.top_block): def __init__(self): @@ -127,14 +152,12 @@ class my_top_block(gr.top_block): help="select USRP Rx side A or B (default=first one with a daughterboard)") parser.add_option("-A", "--antenna", default=None, help="select Rx Antenna (only on RFX-series boards)") - parser.add_option("-d", "--decim", type="int", default=16, - help="set fgpa decimation rate to DECIM [default=%default]") + parser.add_option("-W", "--bw", type="float", default=1e6, + help="set bandwidth of receiver [default=%default]") parser.add_option("-f", "--freq", type="eng_float", default=None, help="set frequency to FREQ", metavar="FREQ") parser.add_option("-g", "--gain", type="eng_float", default=None, help="set gain in dB [default is midpoint]") - parser.add_option("-W", "--waterfall", action="store_true", default=False, - help="Enable waterfall display") parser.add_option("-8", "--width-8", action="store_true", default=False, help="Enable 8-bit samples across USB") parser.add_option( "--no-hb", action="store_true", default=False, @@ -158,49 +181,96 @@ class my_top_block(gr.top_block): # Call this before creating the Qt sink self.qapp = QtGui.QApplication(sys.argv) - self.u = usrp.source_c(which=options.which, decim_rate=options.decim) - rx_subdev_spec = (0,0) - self.u.set_mux(usrp.determine_rx_mux_value(self.u, rx_subdev_spec)) - self.subdev = usrp.selected_subdev(self.u, rx_subdev_spec) + self._fftsize = 2048 + + self.u = usrp.source_c(which=options.which) + self._adc_rate = self.u.converter_rate() + self.set_bandwidth(options.bw) + if options.rx_subdev_spec is None: + options.rx_subdev_spec = pick_subdevice(self.u) + self._rx_subdev_spec = options.rx_subdev_spec + self.u.set_mux(usrp.determine_rx_mux_value(self.u, self._rx_subdev_spec)) + self.subdev = usrp.selected_subdev(self.u, self._rx_subdev_spec) + + self._gain_range = self.subdev.gain_range() if options.gain is None: # if no gain was specified, use the mid-point in dB - g = self.subdev.gain_range() + g = self._gain_range options.gain = float(g[0]+g[1])/2 - self.subdev.set_gain(options.gain) + self.set_gain(options.gain) if options.freq is None: # if no frequency was specified, use the mid-point of the subdev f = self.subdev.freq_range() options.freq = float(f[0]+f[1])/2 - self.u.tune(0, self.subdev, options.freq) + self.set_frequency(options.freq) - fftsize = 2048 - input_rate = self.u.converter_rate() / self.u.decim_rate() - self.snk = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, - -input_rate/2, input_rate/2, + self.snk = qtgui.sink_c(self._fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, + self._freq, self._bandwidth, "USRP Display", True, True, False, True, False) - amp = gr.multiply_const_cc(0.001) - self.connect(self.u, amp, self.snk) + # Set up internal amplifier + self.amp = gr.multiply_const_cc(0.0) + self.set_amplifier_gain(0.001) - self.ctrl_win = control_panel(self.u, self.subdev, self.snk) + # Connect the flow graph + self.connect(self.u, self.amp, self.snk) - self.ctrl_win.set_frequency(options.freq) - self.ctrl_win.set_gain(options.gain) - self.ctrl_win.set_decim(options.decim) # Get the reference pointer to the SpectrumDisplayForm QWidget - pyQt = self.snk.pyqwidget() - # Wrap the pointer as a PyQt SIP object - # This can now be manipulated as a PyQt4.QtGui.QWidget - pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) + # This can now be manipulated as a PyQt4.QtGui.QWidget + self.pysink = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget) + + self.main_win = main_window(self.pysink, self) + + self.main_win.set_frequency(self._freq) + self.main_win.set_gain(self._gain) + self.main_win.set_bandwidth(self._bandwidth) + + self.main_win.show() + + def save_to_file(self, name): + # Pause the flow graph + self.stop() + self.wait() + + # Add file sink to save data + self.file_sink = gr.file_sink(gr.sizeof_gr_complex, name) + self.connect(self.amp, self.file_sink) + + # Restart flow graph + self.start() + + def set_gain(self, gain): + self._gain = gain + self.subdev.set_gain(self._gain) + + def set_frequency(self, freq): + self._freq = freq + self.u.tune(0, self.subdev, self._freq) + + try: + self.snk.set_frequency_range(self._freq, self._bandwidth) + except: + pass + + def set_bandwidth(self, bw): + self._bandwidth = bw + self._decim = int(self._adc_rate / self._bandwidth) + self.u.set_decim_rate(self._decim) + + try: + self.snk.set_frequency_range(self._freq, self._bandwidth) + except: + pass - self.main_box = dialog_box(pyWin, self.ctrl_win) + def set_amplifier_gain(self, amp): + self._amp_value = amp + self.amp.set_k(self._amp_value) - self.main_box.show() if __name__ == "__main__": tb = my_top_block(); diff --git a/gr-qtgui/src/python/usrp_display_qtgui.py b/gr-qtgui/src/python/usrp_display_qtgui.py new file mode 100644 index 00000000..326a823b --- /dev/null +++ b/gr-qtgui/src/python/usrp_display_qtgui.py @@ -0,0 +1,164 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'usrp_display_qtgui.ui' +# +# Created: Sun Jul 5 13:05:46 2009 +# by: PyQt4 UI code generator 4.4.3 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + MainWindow.setObjectName("MainWindow") + MainWindow.resize(820, 774) + self.centralwidget = QtGui.QWidget(MainWindow) + self.centralwidget.setObjectName("centralwidget") + self.gridLayout_2 = QtGui.QGridLayout(self.centralwidget) + self.gridLayout_2.setObjectName("gridLayout_2") + self.horizontalLayout_2 = QtGui.QHBoxLayout() + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.groupBox = QtGui.QGroupBox(self.centralwidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.groupBox.sizePolicy().hasHeightForWidth()) + self.groupBox.setSizePolicy(sizePolicy) + self.groupBox.setMinimumSize(QtCore.QSize(240, 150)) + self.groupBox.setMaximumSize(QtCore.QSize(240, 16777215)) + self.groupBox.setObjectName("groupBox") + self.formLayoutWidget = QtGui.QWidget(self.groupBox) + self.formLayoutWidget.setGeometry(QtCore.QRect(10, 20, 221, 124)) + self.formLayoutWidget.setObjectName("formLayoutWidget") + self.formLayout = QtGui.QFormLayout(self.formLayoutWidget) + self.formLayout.setObjectName("formLayout") + self.frequencyLabel = QtGui.QLabel(self.formLayoutWidget) + self.frequencyLabel.setObjectName("frequencyLabel") + self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.frequencyLabel) + self.gainLabel = QtGui.QLabel(self.formLayoutWidget) + self.gainLabel.setObjectName("gainLabel") + self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.gainLabel) + self.bandwidthLabel = QtGui.QLabel(self.formLayoutWidget) + self.bandwidthLabel.setObjectName("bandwidthLabel") + self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.bandwidthLabel) + self.frequencyEdit = QtGui.QLineEdit(self.formLayoutWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.frequencyEdit.sizePolicy().hasHeightForWidth()) + self.frequencyEdit.setSizePolicy(sizePolicy) + self.frequencyEdit.setMinimumSize(QtCore.QSize(120, 26)) + self.frequencyEdit.setObjectName("frequencyEdit") + self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.frequencyEdit) + self.gainEdit = QtGui.QLineEdit(self.formLayoutWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.gainEdit.sizePolicy().hasHeightForWidth()) + self.gainEdit.setSizePolicy(sizePolicy) + self.gainEdit.setMinimumSize(QtCore.QSize(120, 26)) + self.gainEdit.setObjectName("gainEdit") + self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.gainEdit) + self.bandwidthEdit = QtGui.QLineEdit(self.formLayoutWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.bandwidthEdit.sizePolicy().hasHeightForWidth()) + self.bandwidthEdit.setSizePolicy(sizePolicy) + self.bandwidthEdit.setMinimumSize(QtCore.QSize(120, 26)) + self.bandwidthEdit.setObjectName("bandwidthEdit") + self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.bandwidthEdit) + self.amplifierLabel = QtGui.QLabel(self.formLayoutWidget) + self.amplifierLabel.setObjectName("amplifierLabel") + self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.amplifierLabel) + self.amplifierEdit = QtGui.QLineEdit(self.formLayoutWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.amplifierEdit.sizePolicy().hasHeightForWidth()) + self.amplifierEdit.setSizePolicy(sizePolicy) + self.amplifierEdit.setMinimumSize(QtCore.QSize(120, 26)) + self.amplifierEdit.setObjectName("amplifierEdit") + self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.amplifierEdit) + self.horizontalLayout_2.addWidget(self.groupBox) + spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.horizontalLayout_2.addItem(spacerItem) + self.verticalLayout = QtGui.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + spacerItem1 = QtGui.QSpacerItem(20, 80, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + self.verticalLayout.addItem(spacerItem1) + self.pauseButton = QtGui.QPushButton(self.centralwidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.pauseButton.sizePolicy().hasHeightForWidth()) + self.pauseButton.setSizePolicy(sizePolicy) + self.pauseButton.setObjectName("pauseButton") + self.verticalLayout.addWidget(self.pauseButton) + self.closeButton = QtGui.QPushButton(self.centralwidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.closeButton.sizePolicy().hasHeightForWidth()) + self.closeButton.setSizePolicy(sizePolicy) + self.closeButton.setMinimumSize(QtCore.QSize(75, 0)) + self.closeButton.setObjectName("closeButton") + self.verticalLayout.addWidget(self.closeButton) + self.horizontalLayout_2.addLayout(self.verticalLayout) + self.gridLayout_2.addLayout(self.horizontalLayout_2, 1, 0, 1, 1) + self.verticalLayout_2 = QtGui.QVBoxLayout() + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.frame = QtGui.QFrame(self.centralwidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(1) + sizePolicy.setHeightForWidth(self.frame.sizePolicy().hasHeightForWidth()) + self.frame.setSizePolicy(sizePolicy) + self.frame.setMinimumSize(QtCore.QSize(800, 550)) + self.frame.setFrameShape(QtGui.QFrame.StyledPanel) + self.frame.setFrameShadow(QtGui.QFrame.Raised) + self.frame.setObjectName("frame") + self.gridLayout = QtGui.QGridLayout(self.frame) + self.gridLayout.setObjectName("gridLayout") + self.sinkLayout = QtGui.QHBoxLayout() + self.sinkLayout.setObjectName("sinkLayout") + self.gridLayout.addLayout(self.sinkLayout, 0, 0, 1, 1) + self.verticalLayout_2.addWidget(self.frame) + self.gridLayout_2.addLayout(self.verticalLayout_2, 0, 0, 1, 1) + MainWindow.setCentralWidget(self.centralwidget) + self.menubar = QtGui.QMenuBar(MainWindow) + self.menubar.setGeometry(QtCore.QRect(0, 0, 820, 24)) + self.menubar.setObjectName("menubar") + self.menuFile = QtGui.QMenu(self.menubar) + self.menuFile.setObjectName("menuFile") + MainWindow.setMenuBar(self.menubar) + self.statusbar = QtGui.QStatusBar(MainWindow) + self.statusbar.setObjectName("statusbar") + MainWindow.setStatusBar(self.statusbar) + self.actionExit = QtGui.QAction(MainWindow) + self.actionExit.setObjectName("actionExit") + self.actionSaveData = QtGui.QAction(MainWindow) + self.actionSaveData.setObjectName("actionSaveData") + self.menuFile.addAction(self.actionSaveData) + self.menuFile.addAction(self.actionExit) + self.menubar.addAction(self.menuFile.menuAction()) + + self.retranslateUi(MainWindow) + QtCore.QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), MainWindow.close) + QtCore.QObject.connect(self.actionExit, QtCore.SIGNAL("triggered()"), MainWindow.close) + QtCore.QMetaObject.connectSlotsByName(MainWindow) + + def retranslateUi(self, MainWindow): + MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "USRP Display", None, QtGui.QApplication.UnicodeUTF8)) + self.groupBox.setTitle(QtGui.QApplication.translate("MainWindow", "Receiver Parameters", None, QtGui.QApplication.UnicodeUTF8)) + self.frequencyLabel.setText(QtGui.QApplication.translate("MainWindow", "Frequency (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.gainLabel.setText(QtGui.QApplication.translate("MainWindow", "RF Gain", None, QtGui.QApplication.UnicodeUTF8)) + self.bandwidthLabel.setText(QtGui.QApplication.translate("MainWindow", "Bandwidth", None, QtGui.QApplication.UnicodeUTF8)) + self.amplifierLabel.setText(QtGui.QApplication.translate("MainWindow", "Amplifier", None, QtGui.QApplication.UnicodeUTF8)) + self.pauseButton.setText(QtGui.QApplication.translate("MainWindow", "Pause", None, QtGui.QApplication.UnicodeUTF8)) + self.closeButton.setText(QtGui.QApplication.translate("MainWindow", "Close", None, QtGui.QApplication.UnicodeUTF8)) + self.menuFile.setTitle(QtGui.QApplication.translate("MainWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) + self.actionExit.setText(QtGui.QApplication.translate("MainWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8)) + self.actionSaveData.setText(QtGui.QApplication.translate("MainWindow", "&Save Data", None, QtGui.QApplication.UnicodeUTF8)) + diff --git a/gr-qtgui/src/python/usrp_display_qtgui.ui b/gr-qtgui/src/python/usrp_display_qtgui.ui new file mode 100644 index 00000000..d490e053 --- /dev/null +++ b/gr-qtgui/src/python/usrp_display_qtgui.ui @@ -0,0 +1,313 @@ + + MainWindow + + + + 0 + 0 + 820 + 774 + + + + USRP Display + + + + + + + + + + 0 + 0 + + + + + 240 + 150 + + + + + 240 + 16777215 + + + + Receiver Parameters + + + + + 10 + 20 + 221 + 124 + + + + + + + Frequency (Hz) + + + + + + + RF Gain + + + + + + + Bandwidth + + + + + + + + 0 + 0 + + + + + 120 + 26 + + + + + + + + + 0 + 0 + + + + + 120 + 26 + + + + + + + + + 0 + 0 + + + + + 120 + 26 + + + + + + + + Amplifier + + + + + + + + 0 + 0 + + + + + 120 + 26 + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 80 + + + + + + + + + 0 + 0 + + + + Pause + + + + + + + + 0 + 0 + + + + + 75 + 0 + + + + Close + + + + + + + + + + + + + + 0 + 1 + + + + + 800 + 550 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + + + + + + + + 0 + 0 + 820 + 24 + + + + + &File + + + + + + + + + + E&xit + + + + + &Save Data + + + + + + + closeButton + clicked() + MainWindow + close() + + + 808 + 739 + + + 66 + 561 + + + + + actionExit + triggered() + MainWindow + close() + + + -1 + -1 + + + 617 + 327 + + + + + -- 2.30.2