diff options
Diffstat (limited to 'gr-qtgui/apps')
-rw-r--r-- | gr-qtgui/apps/.gitignore | 3 | ||||
-rw-r--r-- | gr-qtgui/apps/Makefile.am | 45 | ||||
-rw-r--r-- | gr-qtgui/apps/grc_qt_example.grc | 441 | ||||
-rwxr-xr-x | gr-qtgui/apps/pyqt_example_c.py | 149 | ||||
-rwxr-xr-x | gr-qtgui/apps/pyqt_example_f.py | 148 | ||||
-rwxr-xr-x | gr-qtgui/apps/qt_digital.py | 276 | ||||
-rw-r--r-- | gr-qtgui/apps/qt_digital_window.py | 161 | ||||
-rw-r--r-- | gr-qtgui/apps/qt_digital_window.ui | 342 | ||||
-rwxr-xr-x | gr-qtgui/apps/usrp2_display.py | 313 | ||||
-rwxr-xr-x | gr-qtgui/apps/usrp_display.py | 299 | ||||
-rw-r--r-- | gr-qtgui/apps/usrp_display_qtgui.py | 191 | ||||
-rw-r--r-- | gr-qtgui/apps/usrp_display_qtgui.ui | 375 |
12 files changed, 2743 insertions, 0 deletions
diff --git a/gr-qtgui/apps/.gitignore b/gr-qtgui/apps/.gitignore new file mode 100644 index 000000000..943275d5c --- /dev/null +++ b/gr-qtgui/apps/.gitignore @@ -0,0 +1,3 @@ +Makefile +Makefile.in +grc_qt_example.py diff --git a/gr-qtgui/apps/Makefile.am b/gr-qtgui/apps/Makefile.am new file mode 100644 index 000000000..c8d967334 --- /dev/null +++ b/gr-qtgui/apps/Makefile.am @@ -0,0 +1,45 @@ +# +# Copyright 2011 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. +# + +include $(top_srcdir)/Makefile.common + +if PYTHON + +nodist_bin_SCRIPTS = \ + qt_digital_window.ui \ + usrp_display_qtgui.ui + +noinst_PYTHON = \ + pyqt_example_f.py \ + pyqt_example_c.py \ + qt_digital.py \ + qt_digital_window.py \ + usrp2_display.py \ + usrp_display.py \ + qt_digital_window.py \ + usrp_display_qtgui.py + +EXTRA_DIST += \ + qt_digital_window.ui \ + usrp_display_qtgui.ui +endif + +EXTRA_DIST += diff --git a/gr-qtgui/apps/grc_qt_example.grc b/gr-qtgui/apps/grc_qt_example.grc new file mode 100644 index 000000000..170cd546a --- /dev/null +++ b/gr-qtgui/apps/grc_qt_example.grc @@ -0,0 +1,441 @@ +<?xml version='1.0' encoding='ASCII'?> +<flow_graph> + <timestamp>Sun Apr 10 16:49:13 2011</timestamp> + <block> + <key>options</key> + <param> + <key>id</key> + <value>grc_qt_example</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>title</key> + <value></value> + </param> + <param> + <key>author</key> + <value></value> + </param> + <param> + <key>description</key> + <value></value> + </param> + <param> + <key>window_size</key> + <value>1280, 1024</value> + </param> + <param> + <key>generate_options</key> + <value>qt_gui</value> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>run_options</key> + <value>prompt</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> + <key>realtime_scheduling</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>samp_rate</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>32000</value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 170)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_throttle</key> + <param> + <key>id</key> + <value>gr_throttle_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>samples_per_second</key> + <value>samp_rate</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(511, 96)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_qtgui_range</key> + <param> + <key>id</key> + <value>freq</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>Signal Frequency</value> + </param> + <param> + <key>value</key> + <value>1000</value> + </param> + <param> + <key>start</key> + <value>0</value> + </param> + <param> + <key>stop</key> + <value>samp_rate/2.0</value> + </param> + <param> + <key>step</key> + <value>samp_rate/100.0</value> + </param> + <param> + <key>widget</key> + <value>counter_slider</value> + </param> + <param> + <key>orient</key> + <value>Qt.Horizontal</value> + </param> + <param> + <key>min_len</key> + <value>200</value> + </param> + <param> + <key>gui_hint</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(169, 187)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_sig_source_x</key> + <param> + <key>id</key> + <value>gr_sig_source_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>samp_rate</key> + <value>samp_rate</value> + </param> + <param> + <key>waveform</key> + <value>gr.GR_COS_WAVE</value> + </param> + <param> + <key>freq</key> + <value>freq</value> + </param> + <param> + <key>amp</key> + <value>amp</value> + </param> + <param> + <key>offset</key> + <value>0</value> + </param> + <param> + <key>_coordinate</key> + <value>(295, 64)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_qtgui_range</key> + <param> + <key>id</key> + <value>amp</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>Signal Amplitude</value> + </param> + <param> + <key>value</key> + <value>1</value> + </param> + <param> + <key>start</key> + <value>0</value> + </param> + <param> + <key>stop</key> + <value>1.0</value> + </param> + <param> + <key>step</key> + <value>0.01</value> + </param> + <param> + <key>widget</key> + <value>counter_slider</value> + </param> + <param> + <key>orient</key> + <value>Qt.Horizontal</value> + </param> + <param> + <key>min_len</key> + <value>200</value> + </param> + <param> + <key>gui_hint</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(311, 187)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_qtgui_range</key> + <param> + <key>id</key> + <value>noise</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>Noise Amplitude</value> + </param> + <param> + <key>value</key> + <value>0.01</value> + </param> + <param> + <key>start</key> + <value>0</value> + </param> + <param> + <key>stop</key> + <value>1.0</value> + </param> + <param> + <key>step</key> + <value>0.01</value> + </param> + <param> + <key>widget</key> + <value>counter_slider</value> + </param> + <param> + <key>orient</key> + <value>Qt.Horizontal</value> + </param> + <param> + <key>min_len</key> + <value>200</value> + </param> + <param> + <key>gui_hint</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(723, 191)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_channel_model</key> + <param> + <key>id</key> + <value>gr_channel_model_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>noise_voltage</key> + <value>noise</value> + </param> + <param> + <key>freq_offset</key> + <value>0.0</value> + </param> + <param> + <key>epsilon</key> + <value>1.0</value> + </param> + <param> + <key>taps</key> + <value>1.0 + 0.0j</value> + </param> + <param> + <key>seed</key> + <value>42</value> + </param> + <param> + <key>_coordinate</key> + <value>(727, 64)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>qtgui_sink_x</key> + <param> + <key>id</key> + <value>qtgui_sink_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>name</key> + <value>QT GUI Plot</value> + </param> + <param> + <key>fftsize</key> + <value>1024</value> + </param> + <param> + <key>wintype</key> + <value>firdes.WIN_BLACKMAN_hARRIS</value> + </param> + <param> + <key>fc</key> + <value>0</value> + </param> + <param> + <key>bw</key> + <value>samp_rate</value> + </param> + <param> + <key>plotfreq</key> + <value>True</value> + </param> + <param> + <key>plotwaterfall</key> + <value>True</value> + </param> + <param> + <key>plottime</key> + <value>True</value> + </param> + <param> + <key>plotconst</key> + <value>False</value> + </param> + <param> + <key>gui_hint</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(958, 72)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <connection> + <source_block_id>gr_sig_source_x_0</source_block_id> + <sink_block_id>gr_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_throttle_0</source_block_id> + <sink_block_id>gr_channel_model_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_channel_model_0</source_block_id> + <sink_block_id>qtgui_sink_x_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> +</flow_graph> diff --git a/gr-qtgui/apps/pyqt_example_c.py b/gr-qtgui/apps/pyqt_example_c.py new file mode 100755 index 000000000..e1b58442f --- /dev/null +++ b/gr-qtgui/apps/pyqt_example_c.py @@ -0,0 +1,149 @@ +#!/usr/bin/env python + +from gnuradio import gr +from gnuradio import qtgui +from PyQt4 import QtGui, QtCore +import sys, sip + +class dialog_box(QtGui.QWidget): + def __init__(self, display, control): + QtGui.QWidget.__init__(self, None) + self.setWindowTitle('PyQt Test GUI') + + self.boxlayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self) + self.boxlayout.addWidget(display, 1) + self.boxlayout.addWidget(control) + + self.resize(800, 500) + +class control_box(QtGui.QWidget): + def __init__(self, parent=None): + QtGui.QWidget.__init__(self, parent) + self.setWindowTitle('Control Panel') + + self.setToolTip('Control the signals') + QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10)) + + self.layout = QtGui.QFormLayout(self) + + # Control the first signal + self.freq1Edit = QtGui.QLineEdit(self) + self.freq1Edit.setMinimumWidth(100) + self.layout.addRow("Signal 1 Frequency:", self.freq1Edit) + self.connect(self.freq1Edit, QtCore.SIGNAL("editingFinished()"), + self.freq1EditText) + + self.amp1Edit = QtGui.QLineEdit(self) + self.amp1Edit.setMinimumWidth(100) + self.layout.addRow("Signal 1 Amplitude:", self.amp1Edit) + self.connect(self.amp1Edit, QtCore.SIGNAL("editingFinished()"), + self.amp1EditText) + + + # Control the second signal + self.freq2Edit = QtGui.QLineEdit(self) + self.freq2Edit.setMinimumWidth(100) + self.layout.addRow("Signal 2 Frequency:", self.freq2Edit) + self.connect(self.freq2Edit, QtCore.SIGNAL("editingFinished()"), + self.freq2EditText) + + + self.amp2Edit = QtGui.QLineEdit(self) + self.amp2Edit.setMinimumWidth(100) + self.layout.addRow("Signal 2 Amplitude:", self.amp2Edit) + self.connect(self.amp2Edit, QtCore.SIGNAL("editingFinished()"), + self.amp2EditText) + + self.quit = QtGui.QPushButton('Close', self) + self.quit.setMinimumWidth(100) + self.layout.addWidget(self.quit) + + self.connect(self.quit, QtCore.SIGNAL('clicked()'), + QtGui.qApp, QtCore.SLOT('quit()')) + + def attach_signal1(self, signal): + self.signal1 = signal + self.freq1Edit.setText(QtCore.QString("%1").arg(self.signal1.frequency())) + self.amp1Edit.setText(QtCore.QString("%1").arg(self.signal1.amplitude())) + + def attach_signal2(self, signal): + self.signal2 = signal + self.freq2Edit.setText(QtCore.QString("%1").arg(self.signal2.frequency())) + self.amp2Edit.setText(QtCore.QString("%1").arg(self.signal2.amplitude())) + + def freq1EditText(self): + try: + newfreq = float(self.freq1Edit.text()) + self.signal1.set_frequency(newfreq) + except ValueError: + print "Bad frequency value entered" + + def amp1EditText(self): + try: + newamp = float(self.amp1Edit.text()) + self.signal1.set_amplitude(newamp) + except ValueError: + print "Bad amplitude value entered" + + + def freq2EditText(self): + try: + newfreq = float(self.freq2Edit.text()) + self.signal2.set_frequency(newfreq) + except ValueError: + print "Bad frequency value entered" + + def amp2EditText(self): + try: + newamp = float(self.amp2Edit.text()) + self.signal2.set_amplitude(newamp) + except ValueError: + print "Bad amplitude value entered" + + +class my_top_block(gr.top_block): + def __init__(self): + gr.top_block.__init__(self) + + Rs = 8000 + f1 = 1000 + f2 = 2000 + + fftsize = 2048 + + self.qapp = QtGui.QApplication(sys.argv) + + src1 = gr.sig_source_c(Rs, gr.GR_SIN_WAVE, f1, 0.1, 0) + src2 = gr.sig_source_c(Rs, gr.GR_SIN_WAVE, f2, 0.1, 0) + src = gr.add_cc() + 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, + 0, Rs, + "Complex Signal Example", + True, True, True, False) + + self.connect(src1, (src,0)) + self.connect(src2, (src,1)) + self.connect(src, channel, thr, self.snk1) + + self.ctrl_win = control_box() + self.ctrl_win.attach_signal1(src1) + self.ctrl_win.attach_signal2(src2) + + # Get the reference pointer to the SpectrumDisplayForm QWidget + pyQt = self.snk1.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) + + self.main_box = dialog_box(pyWin, self.ctrl_win) + + self.main_box.show() + +if __name__ == "__main__": + tb = my_top_block(); + tb.start() + sys.exit(tb.qapp.exec_()) + diff --git a/gr-qtgui/apps/pyqt_example_f.py b/gr-qtgui/apps/pyqt_example_f.py new file mode 100755 index 000000000..6b2131019 --- /dev/null +++ b/gr-qtgui/apps/pyqt_example_f.py @@ -0,0 +1,148 @@ +#!/usr/bin/env python + +from gnuradio import gr, blks2 +from gnuradio import qtgui +from PyQt4 import QtGui, QtCore +import sys, sip + +class dialog_box(QtGui.QWidget): + def __init__(self, display, control): + QtGui.QWidget.__init__(self, None) + self.setWindowTitle('PyQt Test GUI') + + self.boxlayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self) + self.boxlayout.addWidget(display, 1) + self.boxlayout.addWidget(control) + + self.resize(800, 500) + +class control_box(QtGui.QWidget): + def __init__(self, parent=None): + QtGui.QWidget.__init__(self, parent) + self.setWindowTitle('Control Panel') + + self.setToolTip('Control the signals') + QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10)) + + self.layout = QtGui.QFormLayout(self) + + # Control the first signal + self.freq1Edit = QtGui.QLineEdit(self) + self.freq1Edit.setMinimumWidth(100) + self.layout.addRow("Signal 1 Frequency:", self.freq1Edit) + self.connect(self.freq1Edit, QtCore.SIGNAL("editingFinished()"), + self.freq1EditText) + + self.amp1Edit = QtGui.QLineEdit(self) + self.amp1Edit.setMinimumWidth(100) + self.layout.addRow("Signal 1 Amplitude:", self.amp1Edit) + self.connect(self.amp1Edit, QtCore.SIGNAL("editingFinished()"), + self.amp1EditText) + + + # Control the second signal + self.freq2Edit = QtGui.QLineEdit(self) + self.freq2Edit.setMinimumWidth(100) + self.layout.addRow("Signal 2 Frequency:", self.freq2Edit) + self.connect(self.freq2Edit, QtCore.SIGNAL("editingFinished()"), + self.freq2EditText) + + + self.amp2Edit = QtGui.QLineEdit(self) + self.amp2Edit.setMinimumWidth(100) + self.layout.addRow("Signal 2 Amplitude:", self.amp2Edit) + self.connect(self.amp2Edit, QtCore.SIGNAL("editingFinished()"), + self.amp2EditText) + + self.quit = QtGui.QPushButton('Close', self) + self.quit.setMinimumWidth(100) + self.layout.addWidget(self.quit) + + self.connect(self.quit, QtCore.SIGNAL('clicked()'), + QtGui.qApp, QtCore.SLOT('quit()')) + + def attach_signal1(self, signal): + self.signal1 = signal + self.freq1Edit.setText(QtCore.QString("%1").arg(self.signal1.frequency())) + self.amp1Edit.setText(QtCore.QString("%1").arg(self.signal1.amplitude())) + + def attach_signal2(self, signal): + self.signal2 = signal + self.freq2Edit.setText(QtCore.QString("%1").arg(self.signal2.frequency())) + self.amp2Edit.setText(QtCore.QString("%1").arg(self.signal2.amplitude())) + + def freq1EditText(self): + try: + newfreq = float(self.freq1Edit.text()) + self.signal1.set_frequency(newfreq) + except ValueError: + print "Bad frequency value entered" + + def amp1EditText(self): + try: + newamp = float(self.amp1Edit.text()) + self.signal1.set_amplitude(newamp) + except ValueError: + print "Bad amplitude value entered" + + + def freq2EditText(self): + try: + newfreq = float(self.freq2Edit.text()) + self.signal2.set_frequency(newfreq) + except ValueError: + print "Bad frequency value entered" + + def amp2EditText(self): + try: + newamp = float(self.amp2Edit.text()) + self.signal2.set_amplitude(newamp) + except ValueError: + print "Bad amplitude value entered" + + +class my_top_block(gr.top_block): + def __init__(self): + gr.top_block.__init__(self) + + Rs = 8000 + f1 = 1000 + f2 = 2000 + + fftsize = 2048 + + self.qapp = QtGui.QApplication(sys.argv) + + src1 = gr.sig_source_f(Rs, gr.GR_SIN_WAVE, f1, 0.1, 0) + src2 = gr.sig_source_f(Rs, gr.GR_SIN_WAVE, f2, 0.1, 0) + src = gr.add_ff() + thr = gr.throttle(gr.sizeof_float, 100*fftsize) + self.snk1 = qtgui.sink_f(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, + 0, Rs, + "Float Signal Example", + True, True, True, False) + + self.connect(src1, (src,0)) + self.connect(src2, (src,1)) + self.connect(src, thr, self.snk1) + + self.ctrl_win = control_box() + self.ctrl_win.attach_signal1(src1) + self.ctrl_win.attach_signal2(src2) + + # Get the reference pointer to the SpectrumDisplayForm QWidget + pyQt = self.snk1.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) + + self.main_box = dialog_box(pyWin, self.ctrl_win) + + self.main_box.show() + +if __name__ == "__main__": + tb = my_top_block(); + tb.start() + sys.exit(tb.qapp.exec_()) + diff --git a/gr-qtgui/apps/qt_digital.py b/gr-qtgui/apps/qt_digital.py new file mode 100755 index 000000000..c6920a05d --- /dev/null +++ b/gr-qtgui/apps/qt_digital.py @@ -0,0 +1,276 @@ +#!/usr/bin/env python + +from gnuradio import gr, blks2 +from gnuradio import qtgui +from gnuradio import eng_notation +from PyQt4 import QtGui, QtCore +import sys, sip +import scipy + +try: + from qt_digital_window import Ui_DigitalWindow +except ImportError: + print "Error: could not find qt_digital_window.py:" + print "\t\"Please run: pyuic4 qt_digital_window.ui -o qt_digital_window.py\"" + sys.exit(1) + +class dialog_box(QtGui.QMainWindow): + def __init__(self, snkTx, snkRx, fg, parent=None): + QtGui.QWidget.__init__(self, parent) + self.gui = Ui_DigitalWindow() + self.gui.setupUi(self) + + self.fg = fg + + self.set_sample_rate(self.fg.sample_rate()) + + self.set_snr(self.fg.snr()) + self.set_frequency(self.fg.frequency_offset()) + self.set_time_offset(self.fg.timing_offset()) + + self.set_gain_mu(self.fg.rx_gain_mu()) + self.set_alpha(self.fg.rx_alpha()) + + # Add the qtsnk widgets to the hlayout box + self.gui.sinkLayout.addWidget(snkTx) + self.gui.sinkLayout.addWidget(snkRx) + + + # Connect up some signals + self.connect(self.gui.pauseButton, QtCore.SIGNAL("clicked()"), + self.pauseFg) + + self.connect(self.gui.sampleRateEdit, QtCore.SIGNAL("editingFinished()"), + self.sampleRateEditText) + + self.connect(self.gui.snrEdit, QtCore.SIGNAL("editingFinished()"), + self.snrEditText) + self.connect(self.gui.freqEdit, QtCore.SIGNAL("editingFinished()"), + self.freqEditText) + self.connect(self.gui.timeEdit, QtCore.SIGNAL("editingFinished()"), + self.timeEditText) + + self.connect(self.gui.gainMuEdit, QtCore.SIGNAL("editingFinished()"), + self.gainMuEditText) + self.connect(self.gui.alphaEdit, QtCore.SIGNAL("editingFinished()"), + self.alphaEditText) + + + 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 system parameters + def set_sample_rate(self, sr): + ssr = eng_notation.num_to_str(sr) + self.gui.sampleRateEdit.setText(QtCore.QString("%1").arg(ssr)) + + def sampleRateEditText(self): + try: + rate = self.gui.sampleRateEdit.text().toAscii() + srate = eng_notation.str_to_num(rate) + self.fg.set_sample_rate(srate) + except RuntimeError: + pass + + + # Accessor functions for Gui to manipulate channel model + def set_snr(self, snr): + self.gui.snrEdit.setText(QtCore.QString("%1").arg(snr)) + + def set_frequency(self, fo): + self.gui.freqEdit.setText(QtCore.QString("%1").arg(fo)) + + def set_time_offset(self, to): + self.gui.timeEdit.setText(QtCore.QString("%1").arg(to)) + + def snrEditText(self): + try: + snr = self.gui.snrEdit.text().toDouble()[0] + self.fg.set_snr(snr) + except RuntimeError: + pass + + def freqEditText(self): + try: + freq = self.gui.freqEdit.text().toDouble()[0] + self.fg.set_frequency_offset(freq) + except RuntimeError: + pass + + def timeEditText(self): + try: + to = self.gui.timeEdit.text().toDouble()[0] + self.fg.set_timing_offset(to) + except RuntimeError: + pass + + + # Accessor functions for Gui to manipulate receiver parameters + def set_gain_mu(self, gain): + self.gui.gainMuEdit.setText(QtCore.QString("%1").arg(gain)) + + def set_alpha(self, alpha): + self.gui.alphaEdit.setText(QtCore.QString("%1").arg(alpha)) + + def alphaEditText(self): + try: + alpha = self.gui.alphaEdit.text().toDouble()[0] + self.fg.set_rx_alpha(alpha) + except RuntimeError: + pass + + def gainMuEditText(self): + try: + gain = self.gui.gainMuEdit.text().toDouble()[0] + self.fg.set_rx_gain_mu(gain) + except RuntimeError: + pass + + +class my_top_block(gr.top_block): + def __init__(self): + gr.top_block.__init__(self) + + self.qapp = QtGui.QApplication(sys.argv) + + self._sample_rate = 2000e3 + + self.sps = 2 + self.excess_bw = 0.35 + self.gray_code = True + + fftsize = 2048 + + self.data = scipy.random.randint(0, 255, 1000) + self.src = gr.vector_source_b(self.data.tolist(), True) + self.mod = blks2.dqpsk_mod(self.sps, self.excess_bw, self.gray_code, False, False) + + self.rrctaps = gr.firdes.root_raised_cosine(1, self.sps, 1, self.excess_bw, 21) + self.rx_rrc = gr.fir_filter_ccf(1, self.rrctaps) + + + # Set up the carrier & clock recovery parameters + self.arity = 4 + self.mu = 0.5 + self.gain_mu = 0.05 + self.omega = self.sps + self.gain_omega = .25 * self.gain_mu * self.gain_mu + self.omega_rel_lim = 0.05 + + self.alpha = 0.15 + self.beta = 0.25 * self.alpha * self.alpha + self.fmin = -1000/self.sample_rate() + self.fmax = 1000/self.sample_rate() + + self.receiver = gr.mpsk_receiver_cc(self.arity, 0, + self.alpha, self.beta, + self.fmin, self.fmax, + self.mu, self.gain_mu, + self.omega, self.gain_omega, + self.omega_rel_lim) + + + self.snr_dB = 15 + noise = self.get_noise_voltage(self.snr_dB) + self.fo = 100/self.sample_rate() + self.to = 1.0 + self.channel = gr.channel_model(noise, self.fo, self.to) + + self.thr = gr.throttle(gr.sizeof_char, self._sample_rate) + self.snk_tx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, + 0, self._sample_rate*self.sps, + "Tx", True, True, True, True) + + self.snk_rx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, + 0, self._sample_rate, + "Rx", True, True, True, True) + + self.connect(self.src, self.thr, self.mod, self.channel, self.snk_tx) + self.connect(self.channel, self.rx_rrc, self.receiver, self.snk_rx) + + pyTxQt = self.snk_tx.pyqwidget() + pyTx = sip.wrapinstance(pyTxQt, QtGui.QWidget) + + pyRxQt = self.snk_rx.pyqwidget() + pyRx = sip.wrapinstance(pyRxQt, QtGui.QWidget) + + self.main_box = dialog_box(pyTx, pyRx, self); + self.main_box.show() + + + def get_noise_voltage(self, SNR): + S = 0 # dBm, assuming signal power normalized + N = S - SNR # dBm + npwr = pow(10.0, N/10.0) # ratio + nv = scipy.sqrt(npwr * self.sps) # convert the noise voltage + return nv + + + # System Parameters + def sample_rate(self): + return self._sample_rate + + def set_sample_rate(self, sr): + self._sample_rate = sr + + + # Channel Model Parameters + def snr(self): + return self.snr_dB + + def set_snr(self, snr): + self.snr_dB = snr + noise = self.get_noise_voltage(self.snr_dB) + self.channel.set_noise_voltage(noise) + + def frequency_offset(self): + return self.fo * self.sample_rate() + + def set_frequency_offset(self, fo): + self.fo = fo / self.sample_rate() + self.channel.set_frequency_offset(self.fo) + + def timing_offset(self): + return self.to + + def set_timing_offset(self, to): + self.to = to + self.channel.set_timing_offset(self.to) + + + # Receiver Parameters + def rx_gain_mu(self): + return self.gain_mu + + def rx_gain_omega(self): + return self.gain_omega + + def set_rx_gain_mu(self, gain): + self.gain_mu = gain + self.gain_omega = .25 * self.gain_mu * self.gain_mu + self.receiver.set_gain_mu(self.gain_mu) + self.receiver.set_gain_omega(self.gain_omega) + + def rx_alpha(self): + return self.alpha + + def rx_beta(self): + return self.beta + + def set_rx_alpha(self, alpha): + self.alpha = alpha + self.beta = .25 * self.alpha * self.alpha + self.receiver.set_alpha(self.alpha) + self.receiver.set_beta(self.beta) + + +if __name__ == "__main__": + tb = my_top_block(); + tb.start() + tb.qapp.exec_() diff --git a/gr-qtgui/apps/qt_digital_window.py b/gr-qtgui/apps/qt_digital_window.py new file mode 100644 index 000000000..50dd53a92 --- /dev/null +++ b/gr-qtgui/apps/qt_digital_window.py @@ -0,0 +1,161 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'qt_digital_window.ui' +# +# Created: Sat May 1 20:14:02 2010 +# by: PyQt4 UI code generator 4.6.1 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +class Ui_DigitalWindow(object): + def setupUi(self, DigitalWindow): + DigitalWindow.setObjectName("DigitalWindow") + DigitalWindow.resize(1236, 741) + self.centralwidget = QtGui.QWidget(DigitalWindow) + self.centralwidget.setObjectName("centralwidget") + self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget) + self.verticalLayout.setObjectName("verticalLayout") + self.sinkFrame = QtGui.QFrame(self.centralwidget) + self.sinkFrame.setMinimumSize(QtCore.QSize(0, 550)) + self.sinkFrame.setFrameShape(QtGui.QFrame.StyledPanel) + self.sinkFrame.setFrameShadow(QtGui.QFrame.Raised) + self.sinkFrame.setObjectName("sinkFrame") + 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.verticalLayout.addWidget(self.sinkFrame) + self.horizontalLayout = QtGui.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.sysBox = QtGui.QGroupBox(self.centralwidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.sysBox.sizePolicy().hasHeightForWidth()) + self.sysBox.setSizePolicy(sizePolicy) + self.sysBox.setMinimumSize(QtCore.QSize(0, 0)) + self.sysBox.setMaximumSize(QtCore.QSize(16777215, 120)) + self.sysBox.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.sysBox.setObjectName("sysBox") + self.gridLayout_2 = QtGui.QGridLayout(self.sysBox) + self.gridLayout_2.setObjectName("gridLayout_2") + self.sampleRateEdit = QtGui.QLineEdit(self.sysBox) + self.sampleRateEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.sampleRateEdit.setObjectName("sampleRateEdit") + self.gridLayout_2.addWidget(self.sampleRateEdit, 0, 3, 1, 1) + self.sampleRateLabel = QtGui.QLabel(self.sysBox) + self.sampleRateLabel.setObjectName("sampleRateLabel") + self.gridLayout_2.addWidget(self.sampleRateLabel, 0, 2, 1, 1) + self.horizontalLayout.addWidget(self.sysBox) + self.rxBox = QtGui.QGroupBox(self.centralwidget) + self.rxBox.setMaximumSize(QtCore.QSize(16777215, 120)) + self.rxBox.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.rxBox.setObjectName("rxBox") + self.gridLayout_3 = QtGui.QGridLayout(self.rxBox) + self.gridLayout_3.setObjectName("gridLayout_3") + self.alphaLabel = QtGui.QLabel(self.rxBox) + self.alphaLabel.setObjectName("alphaLabel") + self.gridLayout_3.addWidget(self.alphaLabel, 1, 0, 1, 1) + self.alphaEdit = QtGui.QLineEdit(self.rxBox) + self.alphaEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.alphaEdit.setObjectName("alphaEdit") + self.gridLayout_3.addWidget(self.alphaEdit, 1, 1, 1, 1) + self.gainMuLabel = QtGui.QLabel(self.rxBox) + self.gainMuLabel.setObjectName("gainMuLabel") + self.gridLayout_3.addWidget(self.gainMuLabel, 0, 0, 1, 1) + self.gainMuEdit = QtGui.QLineEdit(self.rxBox) + self.gainMuEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.gainMuEdit.setObjectName("gainMuEdit") + self.gridLayout_3.addWidget(self.gainMuEdit, 0, 1, 1, 1) + self.horizontalLayout.addWidget(self.rxBox) + self.channelModeBox = QtGui.QGroupBox(self.centralwidget) + self.channelModeBox.setMaximumSize(QtCore.QSize(16777215, 120)) + self.channelModeBox.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.channelModeBox.setObjectName("channelModeBox") + self.gridLayout = QtGui.QGridLayout(self.channelModeBox) + self.gridLayout.setSizeConstraint(QtGui.QLayout.SetMinimumSize) + self.gridLayout.setObjectName("gridLayout") + self.snrLabel = QtGui.QLabel(self.channelModeBox) + self.snrLabel.setObjectName("snrLabel") + self.gridLayout.addWidget(self.snrLabel, 0, 1, 1, 1) + self.snrEdit = QtGui.QLineEdit(self.channelModeBox) + self.snrEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.snrEdit.setObjectName("snrEdit") + self.gridLayout.addWidget(self.snrEdit, 0, 2, 1, 1) + self.freqLabel = QtGui.QLabel(self.channelModeBox) + self.freqLabel.setObjectName("freqLabel") + self.gridLayout.addWidget(self.freqLabel, 1, 1, 1, 1) + self.freqEdit = QtGui.QLineEdit(self.channelModeBox) + self.freqEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.freqEdit.setObjectName("freqEdit") + self.gridLayout.addWidget(self.freqEdit, 1, 2, 1, 1) + self.timeLabel = QtGui.QLabel(self.channelModeBox) + self.timeLabel.setObjectName("timeLabel") + self.gridLayout.addWidget(self.timeLabel, 2, 1, 1, 1) + self.timeEdit = QtGui.QLineEdit(self.channelModeBox) + self.timeEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.timeEdit.setObjectName("timeEdit") + self.gridLayout.addWidget(self.timeEdit, 2, 2, 1, 1) + self.horizontalLayout.addWidget(self.channelModeBox) + spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.horizontalLayout.addItem(spacerItem) + self.verticalLayout_2 = QtGui.QVBoxLayout() + self.verticalLayout_2.setObjectName("verticalLayout_2") + spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.verticalLayout_2.addItem(spacerItem1) + self.pauseButton = QtGui.QPushButton(self.centralwidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.pauseButton.sizePolicy().hasHeightForWidth()) + self.pauseButton.setSizePolicy(sizePolicy) + self.pauseButton.setMaximumSize(QtCore.QSize(80, 16777215)) + self.pauseButton.setObjectName("pauseButton") + self.verticalLayout_2.addWidget(self.pauseButton) + self.closeButton = QtGui.QPushButton(self.centralwidget) + self.closeButton.setMaximumSize(QtCore.QSize(80, 16777215)) + self.closeButton.setObjectName("closeButton") + self.verticalLayout_2.addWidget(self.closeButton) + self.horizontalLayout.addLayout(self.verticalLayout_2) + self.verticalLayout.addLayout(self.horizontalLayout) + DigitalWindow.setCentralWidget(self.centralwidget) + self.menubar = QtGui.QMenuBar(DigitalWindow) + self.menubar.setGeometry(QtCore.QRect(0, 0, 1236, 23)) + self.menubar.setObjectName("menubar") + self.menuFile = QtGui.QMenu(self.menubar) + self.menuFile.setObjectName("menuFile") + DigitalWindow.setMenuBar(self.menubar) + self.statusbar = QtGui.QStatusBar(DigitalWindow) + self.statusbar.setObjectName("statusbar") + DigitalWindow.setStatusBar(self.statusbar) + self.actionExit = QtGui.QAction(DigitalWindow) + self.actionExit.setObjectName("actionExit") + self.menuFile.addAction(self.actionExit) + 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.QMetaObject.connectSlotsByName(DigitalWindow) + 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.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.rxBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Receiver Parameters", None, QtGui.QApplication.UnicodeUTF8)) + self.alphaLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Alpha", None, QtGui.QApplication.UnicodeUTF8)) + self.gainMuLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Gain mu", None, QtGui.QApplication.UnicodeUTF8)) + self.channelModeBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Channel Model Parameters", 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.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/gr-qtgui/apps/qt_digital_window.ui b/gr-qtgui/apps/qt_digital_window.ui new file mode 100644 index 000000000..967252181 --- /dev/null +++ b/gr-qtgui/apps/qt_digital_window.ui @@ -0,0 +1,342 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>DigitalWindow</class> + <widget class="QMainWindow" name="DigitalWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>1236</width> + <height>741</height> + </rect> + </property> + <property name="windowTitle"> + <string>MainWindow</string> + </property> + <widget class="QWidget" name="centralwidget"> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QFrame" name="sinkFrame"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>550</height> + </size> + </property> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <layout class="QHBoxLayout" name="sinkLayout"/> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QGroupBox" name="sysBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>120</height> + </size> + </property> + <property name="title"> + <string>System Parameters</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="3"> + <widget class="QLineEdit" name="sampleRateEdit"> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="sampleRateLabel"> + <property name="text"> + <string>Sample Rate (sps)</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="rxBox"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>120</height> + </size> + </property> + <property name="title"> + <string>Receiver Parameters</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="1" column="0"> + <widget class="QLabel" name="alphaLabel"> + <property name="text"> + <string>Alpha</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="alphaEdit"> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="gainMuLabel"> + <property name="text"> + <string>Gain mu</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="gainMuEdit"> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="channelModeBox"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>120</height> + </size> + </property> + <property name="title"> + <string>Channel Model Parameters</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + <layout class="QGridLayout" name="gridLayout"> + <property name="sizeConstraint"> + <enum>QLayout::SetMinimumSize</enum> + </property> + <item row="0" column="1"> + <widget class="QLabel" name="snrLabel"> + <property name="text"> + <string>SNR (dB)</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLineEdit" name="snrEdit"> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="freqLabel"> + <property name="text"> + <string>Frequency Offset (Hz)</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLineEdit" name="freqEdit"> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLabel" name="timeLabel"> + <property name="text"> + <string>Timing Offset</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLineEdit" name="timeEdit"> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="pauseButton"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Pause</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="closeButton"> + <property name="maximumSize"> + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Close</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menubar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>1236</width> + <height>23</height> + </rect> + </property> + <widget class="QMenu" name="menuFile"> + <property name="title"> + <string>&File</string> + </property> + <addaction name="actionExit"/> + </widget> + <addaction name="menuFile"/> + </widget> + <widget class="QStatusBar" name="statusbar"/> + <action name="actionExit"> + <property name="text"> + <string>E&xit</string> + </property> + </action> + </widget> + <tabstops> + <tabstop>snrEdit</tabstop> + <tabstop>freqEdit</tabstop> + <tabstop>timeEdit</tabstop> + </tabstops> + <resources/> + <connections> + <connection> + <sender>closeButton</sender> + <signal>clicked()</signal> + <receiver>DigitalWindow</receiver> + <slot>close()</slot> + <hints> + <hint type="sourcelabel"> + <x>322</x> + <y>623</y> + </hint> + <hint type="destinationlabel"> + <x>66</x> + <y>561</y> + </hint> + </hints> + </connection> + <connection> + <sender>actionExit</sender> + <signal>triggered()</signal> + <receiver>DigitalWindow</receiver> + <slot>close()</slot> + <hints> + <hint type="sourcelabel"> + <x>-1</x> + <y>-1</y> + </hint> + <hint type="destinationlabel"> + <x>617</x> + <y>327</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/gr-qtgui/apps/usrp2_display.py b/gr-qtgui/apps/usrp2_display.py new file mode 100755 index 000000000..ab1a6f742 --- /dev/null +++ b/gr-qtgui/apps/usrp2_display.py @@ -0,0 +1,313 @@ +#!/usr/bin/env python +# +# Copyright 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 +from gnuradio import usrp2 +from gnuradio import eng_notation +from gnuradio.eng_option import eng_option +from gnuradio.qtgui import qtgui +from optparse import OptionParser +import sys + +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 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) + + +# //////////////////////////////////////////////////////////////////// +# Define the QT Interface and Control Dialog +# //////////////////////////////////////////////////////////////////// + + +class main_window(QtGui.QMainWindow): + def __init__(self, snk, fg, parent=None): + + QtGui.QWidget.__init__(self, parent) + self.gui = Ui_MainWindow() + self.gui.setupUi(self) + + self.fg = fg + + # Add the qtsnk widgets to the layout box + self.gui.sinkLayout.addWidget(snk) + + self.gui.dcGainEdit.setText(QtCore.QString("%1").arg(0.001)) + + # 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) + + self.connect(self.gui.dcGainEdit, QtCore.SIGNAL("editingFinished()"), + self.dcGainEditText) + self.connect(self.gui.dcCancelCheckBox, QtCore.SIGNAL("clicked(bool)"), + self.dcCancelClicked) + + 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.gui.frequencyEdit.setText(QtCore.QString("%1").arg(sfreq)) + + def set_gain(self, gain): + self.gain = 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, amp): + self.amp = amp + self.gui.amplifierEdit.setText(QtCore.QString("%1").arg(self.amp)) + + + # Functions called when signals are triggered in the GUI + def frequencyEditText(self): + try: + freq = eng_notation.str_to_num(self.gui.frequencyEdit.text().toAscii()) + self.fg.set_frequency(freq) + self.freq = freq + except RuntimeError: + pass + + def gainEditText(self): + try: + 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 + + def amplifierEditText(self): + try: + amp = float(self.gui.amplifierEdit.text()) + self.fg.set_amplifier_gain(amp) + self.amp = amp + except ValueError: + pass + + def saveData(self): + fileName = QtGui.QFileDialog.getSaveFileName(self, "Save data to file", "."); + if(len(fileName)): + self.fg.save_to_file(str(fileName)) + + def dcGainEditText(self): + gain = float(self.gui.dcGainEdit.text()) + self.fg.set_dc_gain(gain) + + def dcCancelClicked(self, state): + self.dcGainEditText() + self.fg.cancel_dc(state) + + + +class my_top_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("-W", "--bw", type="eng_float", default=1e6, + help="set bandwidth of receiver [default=%default]") + parser.add_option("-f", "--freq", type="eng_float", default=2412e6, + 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("--fft-size", type="int", default=2048, + help="Set number of FFT bins [default=%default]") + (options, args) = parser.parse_args() + + if len(args) != 0: + parser.print_help() + sys.exit(1) + self.options = options + self.show_debug_info = True + + self.qapp = QtGui.QApplication(sys.argv) + + self.u = usrp2.source_32fc(options.interface, options.mac_addr) + self._adc_rate = self.u.adc_rate() + self.set_bandwidth(options.bw) + + if options.gain is None: + # if no gain was specified, use the mid-point in dB + g = self.u.gain_range() + options.gain = float(g[0]+g[1])/2 + self.set_gain(options.gain) + + if options.freq is None: + # if no frequency was specified, use the mid-point of the subdev + f = self.u.freq_range() + options.freq = float(f[0]+f[1])/2 + self.set_frequency(options.freq) + + self._fftsize = options.fft_size + + self.snk = qtgui.sink_c(options.fft_size, gr.firdes.WIN_BLACKMAN_hARRIS, + self._freq, self._bandwidth, + "USRP2 Display", + True, True, True, False) + + # Set up internal amplifier + self.amp = gr.multiply_const_cc(0.0) + self.set_amplifier_gain(100) + + # Create a single-pole IIR filter to remove DC + # but don't connect it yet + self.dc_gain = 0.001 + self.dc = gr.single_pole_iir_filter_cc(self.dc_gain) + self.dc_sub = gr.sub_cc() + + self.connect(self.u, self.amp, self.snk) + + if self.show_debug_info: + print "Decimation rate: ", self._decim + print "Bandwidth: ", self._bandwidth + print "D'board: ", self.u.daughterboard_id() + + # Get the reference pointer to the SpectrumDisplayForm QWidget + # Wrap the pointer as a PyQt SIP object + # 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.set_amplifier(self._amp_value) + + self.main_win.show() + + + def save_to_file(self, name): + self.lock() + + # Add file sink to save data + self.file_sink = gr.file_sink(gr.sizeof_gr_complex, name) + self.connect(self.amp, self.file_sink) + + self.unlock() + + def set_gain(self, gain): + self._gain = gain + self.u.set_gain(self._gain) + + def set_frequency(self, freq): + self._freq = freq + r = self.u.set_center_freq(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(self._decim) + + try: + self.snk.set_frequency_range(self._freq, self._bandwidth) + except: + pass + + def set_amplifier_gain(self, amp): + self._amp_value = amp + self.amp.set_k(self._amp_value) + + def set_dc_gain(self, gain): + self.dc.set_taps(gain) + + def cancel_dc(self, state): + self.lock() + + if(state): + self.disconnect(self.u, self.amp) + self.connect(self.u, (self.dc_sub,0)) + self.connect(self.u, self.dc, (self.dc_sub,1)) + self.connect(self.dc_sub, self.amp) + else: + self.disconnect(self.dc_sub, self.amp) + self.disconnect(self.dc, (self.dc_sub,1)) + self.disconnect(self.u, self.dc) + self.disconnect(self.u, (self.dc_sub,0)) + self.connect(self.u, self.amp) + + self.unlock() + +def main (): + tb = my_top_block() + tb.start() + tb.snk.exec_(); + +if __name__ == '__main__': + try: + main () + except KeyboardInterrupt: + pass + diff --git a/gr-qtgui/apps/usrp_display.py b/gr-qtgui/apps/usrp_display.py new file mode 100755 index 000000000..131bc4a7e --- /dev/null +++ b/gr-qtgui/apps/usrp_display.py @@ -0,0 +1,299 @@ +#!/usr/bin/env python +# +# Copyright 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 +from gnuradio import usrp +from gnuradio import eng_notation +from gnuradio.eng_option import eng_option +from gnuradio.qtgui import qtgui +from optparse import OptionParser +import sys + +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 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) + + + +# //////////////////////////////////////////////////////////////////// +# Define the QT Interface and Control Dialog +# //////////////////////////////////////////////////////////////////// + + +class main_window(QtGui.QMainWindow): + def __init__(self, snk, fg, parent=None): + + QtGui.QWidget.__init__(self, parent) + self.gui = Ui_MainWindow() + self.gui.setupUi(self) + + self.fg = fg + + # 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.gui.frequencyEdit.setText(QtCore.QString("%1").arg(sfreq)) + + def set_gain(self, gain): + self.gain = 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, amp): + self.amp = amp + self.gui.amplifierEdit.setText(QtCore.QString("%1").arg(self.amp)) + + + # Functions called when signals are triggered in the GUI + def frequencyEditText(self): + try: + freq = eng_notation.str_to_num(self.gui.frequencyEdit.text().toAscii()) + self.fg.set_frequency(freq) + self.freq = freq + except RuntimeError: + pass + + def gainEditText(self): + try: + 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 + + def amplifierEditText(self): + try: + amp = float(self.gui.amplifierEdit.text()) + self.fg.set_amplifier_gain(amp) + self.amp = amp + except ValueError: + pass + + 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): + gr.top_block.__init__(self) + + parser = OptionParser(option_class=eng_option) + parser.add_option("-w", "--which", type="int", default=0, + help="select which USRP (0, 1, ...) default is %default", + metavar="NUM") + parser.add_option("-R", "--rx-subdev-spec", type="subdev", default=None, + 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("-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("-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, + help="don't use halfband filter in usrp") + parser.add_option("-S", "--oscilloscope", action="store_true", default=False, + help="Enable oscilloscope display") + parser.add_option("", "--avg-alpha", type="eng_float", default=1e-1, + help="Set fftsink averaging factor, [default=%default]") + parser.add_option("", "--ref-scale", type="eng_float", default=13490.0, + help="Set dBFS=0dB input value, [default=%default]") + parser.add_option("", "--fft-size", type="int", default=2048, + help="Set FFT frame size, [default=%default]"); + + (options, args) = parser.parse_args() + if len(args) != 0: + parser.print_help() + sys.exit(1) + self.options = options + self.show_debug_info = True + + # Call this before creating the Qt sink + self.qapp = QtGui.QApplication(sys.argv) + + self._fftsize = options.fft_size + + 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._gain_range + options.gain = float(g[0]+g[1])/2 + 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.set_frequency(options.freq) + + self.snk = qtgui.sink_c(self._fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, + self._freq, self._bandwidth, + "USRP Display", + True, True, True, False) + + # Set up internal amplifier + self.amp = gr.multiply_const_cc(0.0) + self.set_amplifier_gain(0.001) + + # Connect the flow graph + self.connect(self.u, self.amp, self.snk) + + + # Get the reference pointer to the SpectrumDisplayForm QWidget + # Wrap the pointer as a PyQt SIP object + # 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.set_amplifier(self._amp_value) + + 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 + + def set_amplifier_gain(self, amp): + self._amp_value = amp + self.amp.set_k(self._amp_value) + + +if __name__ == "__main__": + tb = my_top_block(); + tb.start() + tb.qapp.exec_() diff --git a/gr-qtgui/apps/usrp_display_qtgui.py b/gr-qtgui/apps/usrp_display_qtgui.py new file mode 100644 index 000000000..4c9de3a53 --- /dev/null +++ b/gr-qtgui/apps/usrp_display_qtgui.py @@ -0,0 +1,191 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'usrp_display_qtgui.ui' +# +# Created: Thu Jul 16 22:06:24 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) + self.frame_2 = QtGui.QFrame(self.centralwidget) + self.frame_2.setMinimumSize(QtCore.QSize(200, 0)) + self.frame_2.setFrameShape(QtGui.QFrame.StyledPanel) + self.frame_2.setFrameShadow(QtGui.QFrame.Raised) + self.frame_2.setObjectName("frame_2") + self.verticalLayoutWidget = QtGui.QWidget(self.frame_2) + self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, -1, 191, 151)) + self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") + self.verticalLayout_3 = QtGui.QVBoxLayout(self.verticalLayoutWidget) + self.verticalLayout_3.setObjectName("verticalLayout_3") + self.dcCancelCheckBox = QtGui.QCheckBox(self.verticalLayoutWidget) + self.dcCancelCheckBox.setObjectName("dcCancelCheckBox") + self.verticalLayout_3.addWidget(self.dcCancelCheckBox) + self.horizontalLayout = QtGui.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.dcGainLabel = QtGui.QLabel(self.verticalLayoutWidget) + self.dcGainLabel.setObjectName("dcGainLabel") + self.horizontalLayout.addWidget(self.dcGainLabel) + self.dcGainEdit = QtGui.QLineEdit(self.verticalLayoutWidget) + self.dcGainEdit.setObjectName("dcGainEdit") + self.horizontalLayout.addWidget(self.dcGainEdit) + self.verticalLayout_3.addLayout(self.horizontalLayout) + spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.verticalLayout_3.addItem(spacerItem) + self.horizontalLayout_2.addWidget(self.frame_2) + spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.horizontalLayout_2.addItem(spacerItem1) + self.verticalLayout = QtGui.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + spacerItem2 = QtGui.QSpacerItem(20, 80, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + self.verticalLayout.addItem(spacerItem2) + 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.dcCancelCheckBox.setText(QtGui.QApplication.translate("MainWindow", "Cancel DC", None, QtGui.QApplication.UnicodeUTF8)) + self.dcGainLabel.setText(QtGui.QApplication.translate("MainWindow", "DC Canceller Gain", 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/apps/usrp_display_qtgui.ui b/gr-qtgui/apps/usrp_display_qtgui.ui new file mode 100644 index 000000000..e88ca9dce --- /dev/null +++ b/gr-qtgui/apps/usrp_display_qtgui.ui @@ -0,0 +1,375 @@ +<ui version="4.0" > + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>820</width> + <height>774</height> + </rect> + </property> + <property name="windowTitle" > + <string>USRP Display</string> + </property> + <widget class="QWidget" name="centralwidget" > + <layout class="QGridLayout" name="gridLayout_2" > + <item row="1" column="0" > + <layout class="QHBoxLayout" name="horizontalLayout_2" > + <item> + <widget class="QGroupBox" name="groupBox" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize" > + <size> + <width>240</width> + <height>150</height> + </size> + </property> + <property name="maximumSize" > + <size> + <width>240</width> + <height>16777215</height> + </size> + </property> + <property name="title" > + <string>Receiver Parameters</string> + </property> + <widget class="QWidget" name="formLayoutWidget" > + <property name="geometry" > + <rect> + <x>10</x> + <y>20</y> + <width>221</width> + <height>124</height> + </rect> + </property> + <layout class="QFormLayout" name="formLayout" > + <item row="0" column="0" > + <widget class="QLabel" name="frequencyLabel" > + <property name="text" > + <string>Frequency (Hz)</string> + </property> + </widget> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="gainLabel" > + <property name="text" > + <string>RF Gain</string> + </property> + </widget> + </item> + <item row="2" column="0" > + <widget class="QLabel" name="bandwidthLabel" > + <property name="text" > + <string>Bandwidth</string> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QLineEdit" name="frequencyEdit" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize" > + <size> + <width>120</width> + <height>26</height> + </size> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QLineEdit" name="gainEdit" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize" > + <size> + <width>120</width> + <height>26</height> + </size> + </property> + </widget> + </item> + <item row="2" column="1" > + <widget class="QLineEdit" name="bandwidthEdit" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize" > + <size> + <width>120</width> + <height>26</height> + </size> + </property> + </widget> + </item> + <item row="3" column="0" > + <widget class="QLabel" name="amplifierLabel" > + <property name="text" > + <string>Amplifier</string> + </property> + </widget> + </item> + <item row="3" column="1" > + <widget class="QLineEdit" name="amplifierEdit" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize" > + <size> + <width>120</width> + <height>26</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + </item> + <item> + <widget class="QFrame" name="frame_2" > + <property name="minimumSize" > + <size> + <width>200</width> + <height>0</height> + </size> + </property> + <property name="frameShape" > + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow" > + <enum>QFrame::Raised</enum> + </property> + <widget class="QWidget" name="verticalLayoutWidget" > + <property name="geometry" > + <rect> + <x>10</x> + <y>-1</y> + <width>191</width> + <height>151</height> + </rect> + </property> + <layout class="QVBoxLayout" name="verticalLayout_3" > + <item> + <widget class="QCheckBox" name="dcCancelCheckBox" > + <property name="text" > + <string>Cancel DC</string> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout" > + <item> + <widget class="QLabel" name="dcGainLabel" > + <property name="text" > + <string>DC Canceller Gain</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="dcGainEdit" /> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer_2" > + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0" > + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </widget> + </item> + <item> + <spacer name="horizontalSpacer" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout" > + <item> + <spacer name="verticalSpacer" > + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType" > + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0" > + <size> + <width>20</width> + <height>80</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="pauseButton" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Pause</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="closeButton" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize" > + <size> + <width>75</width> + <height>0</height> + </size> + </property> + <property name="text" > + <string>Close</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + <item row="0" column="0" > + <layout class="QVBoxLayout" name="verticalLayout_2" > + <item> + <widget class="QFrame" name="frame" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Preferred" hsizetype="Preferred" > + <horstretch>0</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + <property name="minimumSize" > + <size> + <width>800</width> + <height>550</height> + </size> + </property> + <property name="frameShape" > + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow" > + <enum>QFrame::Raised</enum> + </property> + <layout class="QGridLayout" name="gridLayout" > + <item row="0" column="0" > + <layout class="QHBoxLayout" name="sinkLayout" /> + </item> + </layout> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menubar" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>820</width> + <height>24</height> + </rect> + </property> + <widget class="QMenu" name="menuFile" > + <property name="title" > + <string>&File</string> + </property> + <addaction name="actionSaveData" /> + <addaction name="actionExit" /> + </widget> + <addaction name="menuFile" /> + </widget> + <widget class="QStatusBar" name="statusbar" /> + <action name="actionExit" > + <property name="text" > + <string>E&xit</string> + </property> + </action> + <action name="actionSaveData" > + <property name="text" > + <string>&Save Data</string> + </property> + </action> + </widget> + <resources/> + <connections> + <connection> + <sender>closeButton</sender> + <signal>clicked()</signal> + <receiver>MainWindow</receiver> + <slot>close()</slot> + <hints> + <hint type="sourcelabel" > + <x>808</x> + <y>739</y> + </hint> + <hint type="destinationlabel" > + <x>66</x> + <y>561</y> + </hint> + </hints> + </connection> + <connection> + <sender>actionExit</sender> + <signal>triggered()</signal> + <receiver>MainWindow</receiver> + <slot>close()</slot> + <hints> + <hint type="sourcelabel" > + <x>-1</x> + <y>-1</y> + </hint> + <hint type="destinationlabel" > + <x>617</x> + <y>327</y> + </hint> + </hints> + </connection> + </connections> +</ui> |