diff options
author | Tom Rondeau <trondeau@vt.edu> | 2011-04-10 19:39:58 -0400 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2011-04-10 19:39:58 -0400 |
commit | 4d6f2a34a6380270e6ac6c5ea37f1dbac7acb9f6 (patch) | |
tree | c339967250fe6f19dccfce6b911c3cb51ed4285c | |
parent | ec0edceb88e9603aedd4f6dd7a8a73702ce59547 (diff) | |
parent | 11e91cdd442f9232382986f9d974b230554fabe2 (diff) |
Merge branch 'qtgui'
-rw-r--r-- | config/grc_gr_qtgui.m4 | 12 | ||||
-rw-r--r-- | gr-qtgui/Makefile.am | 11 | ||||
-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 (renamed from gr-qtgui/src/python/pyqt_example.py) | 15 | ||||
-rwxr-xr-x | gr-qtgui/apps/pyqt_example_f.py (renamed from gr-qtgui/src/python/pyqt_example_f.py) | 15 | ||||
-rwxr-xr-x | gr-qtgui/apps/qt_digital.py (renamed from gr-qtgui/src/python/qt_digital.py) | 6 | ||||
-rw-r--r-- | gr-qtgui/apps/qt_digital_window.py (renamed from gr-qtgui/src/python/qt_digital_window.py) | 0 | ||||
-rw-r--r-- | gr-qtgui/apps/qt_digital_window.ui (renamed from gr-qtgui/src/python/qt_digital_window.ui) | 0 | ||||
-rwxr-xr-x | gr-qtgui/apps/usrp2_display.py (renamed from gr-qtgui/src/python/usrp2_display.py) | 2 | ||||
-rwxr-xr-x | gr-qtgui/apps/usrp_display.py (renamed from gr-qtgui/src/python/usrp_display.py) | 2 | ||||
-rw-r--r-- | gr-qtgui/apps/usrp_display_qtgui.py (renamed from gr-qtgui/src/python/usrp_display_qtgui.py) | 0 | ||||
-rw-r--r-- | gr-qtgui/apps/usrp_display_qtgui.ui (renamed from gr-qtgui/src/python/usrp_display_qtgui.ui) | 0 | ||||
-rw-r--r-- | gr-qtgui/gnuradio-qtgui.pc.in | 11 | ||||
-rw-r--r-- | gr-qtgui/grc/qtgui_sink_x.xml | 10 | ||||
-rw-r--r-- | gr-qtgui/lib/.gitignore (renamed from gr-qtgui/src/lib/.gitignore) | 1 | ||||
-rw-r--r-- | gr-qtgui/lib/ConstellationDisplayPlot.cc (renamed from gr-qtgui/src/lib/ConstellationDisplayPlot.cc) | 4 | ||||
-rw-r--r-- | gr-qtgui/lib/ConstellationDisplayPlot.h (renamed from gr-qtgui/src/lib/ConstellationDisplayPlot.h) | 0 | ||||
-rw-r--r-- | gr-qtgui/lib/FrequencyDisplayPlot.cc (renamed from gr-qtgui/src/lib/FrequencyDisplayPlot.cc) | 2 | ||||
-rw-r--r-- | gr-qtgui/lib/FrequencyDisplayPlot.h (renamed from gr-qtgui/src/lib/FrequencyDisplayPlot.h) | 0 | ||||
-rw-r--r-- | gr-qtgui/lib/Makefile.am (renamed from gr-qtgui/src/lib/Makefile.am) | 8 | ||||
-rw-r--r-- | gr-qtgui/lib/SpectrumGUIClass.cc (renamed from gr-qtgui/src/lib/SpectrumGUIClass.cc) | 108 | ||||
-rw-r--r-- | gr-qtgui/lib/SpectrumGUIClass.h (renamed from gr-qtgui/src/lib/SpectrumGUIClass.h) | 27 | ||||
-rw-r--r-- | gr-qtgui/lib/TimeDomainDisplayPlot.cc (renamed from gr-qtgui/src/lib/TimeDomainDisplayPlot.cc) | 4 | ||||
-rw-r--r-- | gr-qtgui/lib/TimeDomainDisplayPlot.h (renamed from gr-qtgui/src/lib/TimeDomainDisplayPlot.h) | 0 | ||||
-rw-r--r-- | gr-qtgui/lib/WaterfallDisplayPlot.cc (renamed from gr-qtgui/src/lib/WaterfallDisplayPlot.cc) | 4 | ||||
-rw-r--r-- | gr-qtgui/lib/WaterfallDisplayPlot.h (renamed from gr-qtgui/src/lib/WaterfallDisplayPlot.h) | 0 | ||||
-rw-r--r-- | gr-qtgui/lib/highResTimeFunctions.h (renamed from gr-qtgui/src/lib/highResTimeFunctions.h) | 0 | ||||
-rw-r--r-- | gr-qtgui/lib/plot_waterfall.cc (renamed from gr-qtgui/src/lib/plot_waterfall.cc) | 0 | ||||
-rw-r--r-- | gr-qtgui/lib/plot_waterfall.h (renamed from gr-qtgui/src/lib/plot_waterfall.h) | 0 | ||||
-rw-r--r-- | gr-qtgui/lib/qtgui_sink_c.cc (renamed from gr-qtgui/src/lib/qtgui_sink_c.cc) | 48 | ||||
-rw-r--r-- | gr-qtgui/lib/qtgui_sink_c.h (renamed from gr-qtgui/src/lib/qtgui_sink_c.h) | 23 | ||||
-rw-r--r-- | gr-qtgui/lib/qtgui_sink_f.cc (renamed from gr-qtgui/src/lib/qtgui_sink_f.cc) | 39 | ||||
-rw-r--r-- | gr-qtgui/lib/qtgui_sink_f.h (renamed from gr-qtgui/src/lib/qtgui_sink_f.h) | 21 | ||||
-rw-r--r-- | gr-qtgui/lib/spectrumUpdateEvents.cc (renamed from gr-qtgui/src/lib/spectrumUpdateEvents.cc) | 0 | ||||
-rw-r--r-- | gr-qtgui/lib/spectrumUpdateEvents.h (renamed from gr-qtgui/src/lib/spectrumUpdateEvents.h) | 0 | ||||
-rw-r--r-- | gr-qtgui/lib/spectrumdisplayform.cc (renamed from gr-qtgui/src/lib/spectrumdisplayform.cc) | 8 | ||||
-rw-r--r-- | gr-qtgui/lib/spectrumdisplayform.h (renamed from gr-qtgui/src/lib/spectrumdisplayform.h) | 5 | ||||
-rw-r--r-- | gr-qtgui/lib/spectrumdisplayform.ui (renamed from gr-qtgui/src/lib/spectrumdisplayform.ui) | 38 | ||||
-rw-r--r-- | gr-qtgui/lib/waterfallGlobalData.cc (renamed from gr-qtgui/src/lib/waterfallGlobalData.cc) | 0 | ||||
-rw-r--r-- | gr-qtgui/lib/waterfallGlobalData.h (renamed from gr-qtgui/src/lib/waterfallGlobalData.h) | 0 | ||||
-rw-r--r-- | gr-qtgui/python/.gitignore (renamed from gr-qtgui/src/python/.gitignore) | 0 | ||||
-rw-r--r-- | gr-qtgui/python/Makefile.am (renamed from gr-qtgui/src/python/Makefile.am) | 9 | ||||
-rw-r--r-- | gr-qtgui/python/__init__.py | 25 | ||||
-rwxr-xr-x | gr-qtgui/python/qa_qtgui.py (renamed from gr-qtgui/src/python/qa_qtgui.py) | 20 | ||||
-rw-r--r-- | gr-qtgui/python/run_tests.in (renamed from gr-qtgui/src/python/run_tests.in) | 0 | ||||
-rw-r--r-- | gr-qtgui/src/.gitignore | 2 | ||||
-rw-r--r-- | gr-qtgui/src/lib/qtgui.h | 71 | ||||
-rw-r--r-- | gr-qtgui/src/python/__init__.py | 0 | ||||
-rw-r--r-- | gr-qtgui/swig/.gitignore | 2 | ||||
-rw-r--r-- | gr-qtgui/swig/Makefile.am | 53 | ||||
-rw-r--r-- | gr-qtgui/swig/Makefile.swig.gen (renamed from gr-qtgui/src/lib/Makefile.swig.gen) | 98 | ||||
-rw-r--r-- | gr-qtgui/swig/__init__.py (renamed from gr-qtgui/src/Makefile.am) | 9 | ||||
-rw-r--r-- | gr-qtgui/swig/qtgui_swig.i (renamed from gr-qtgui/src/lib/qtgui.i) | 28 |
55 files changed, 790 insertions, 440 deletions
diff --git a/config/grc_gr_qtgui.m4 b/config/grc_gr_qtgui.m4 index aa9646b3c9..a4592fa413 100644 --- a/config/grc_gr_qtgui.m4 +++ b/config/grc_gr_qtgui.m4 @@ -81,16 +81,18 @@ AC_DEFUN([GRC_GR_QTGUI],[ AC_CONFIG_FILES([ \ gr-qtgui/Makefile \ + gr-qtgui/gnuradio-qtgui.pc \ + gr-qtgui/apps/Makefile \ gr-qtgui/grc/Makefile \ - gr-qtgui/src/Makefile \ - gr-qtgui/src/lib/Makefile \ - gr-qtgui/src/python/Makefile \ - gr-qtgui/src/python/run_tests \ + gr-qtgui/lib/Makefile \ + gr-qtgui/python/Makefile \ + gr-qtgui/python/run_tests \ + gr-qtgui/swig/Makefile \ ]) GRC_BUILD_CONDITIONAL(gr-qtgui,[ dnl run_tests is created from run_tests.in. Make it executable. AC_CONFIG_COMMANDS([run_tests_qtgui], - [chmod +x gr-qtgui/src/python/run_tests]) + [chmod +x gr-qtgui/python/run_tests]) ]) ]) diff --git a/gr-qtgui/Makefile.am b/gr-qtgui/Makefile.am index e794266cb2..cc194e4c0f 100644 --- a/gr-qtgui/Makefile.am +++ b/gr-qtgui/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2008-2010 Free Software Foundation, Inc. +# Copyright 2008-2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,10 +21,11 @@ include $(top_srcdir)/Makefile.common -SUBDIRS = src -DIST_SUBDIRS = src +SUBDIRS = lib if PYTHON -SUBDIRS += grc -DIST_SUBDIRS += grc +SUBDIRS += swig python apps grc endif + +pkgconfigdir = $(libdir)/pkgconfig +dist_pkgconfig_DATA = gnuradio-qtgui.pc diff --git a/gr-qtgui/apps/.gitignore b/gr-qtgui/apps/.gitignore new file mode 100644 index 0000000000..943275d5c9 --- /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 0000000000..c8d9673348 --- /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 0000000000..170cd546ad --- /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/src/python/pyqt_example.py b/gr-qtgui/apps/pyqt_example_c.py index 7c0cfc6983..e1b58442f4 100755 --- a/gr-qtgui/src/python/pyqt_example.py +++ b/gr-qtgui/apps/pyqt_example_c.py @@ -1,7 +1,7 @@ #!/usr/bin/env python from gnuradio import gr -from gnuradio.qtgui import qtgui +from gnuradio import qtgui from PyQt4 import QtGui, QtCore import sys, sip @@ -28,11 +28,13 @@ class control_box(QtGui.QWidget): # 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) @@ -40,17 +42,20 @@ class control_box(QtGui.QWidget): # 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()'), @@ -116,7 +121,7 @@ class my_top_block(gr.top_block): self.snk1 = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, 0, Rs, "Complex Signal Example", - True, True, False, True, False) + True, True, True, False) self.connect(src1, (src,0)) self.connect(src2, (src,1)) @@ -131,14 +136,14 @@ class my_top_block(gr.top_block): # Wrap the pointer as a PyQt SIP object # This can now be manipulated as a PyQt4.QtGui.QWidget - self.pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) + pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) - self.main_box = dialog_box(self.pyWin, self.ctrl_win) + self.main_box = dialog_box(pyWin, self.ctrl_win) self.main_box.show() if __name__ == "__main__": tb = my_top_block(); tb.start() - tb.qapp.exec_() + sys.exit(tb.qapp.exec_()) diff --git a/gr-qtgui/src/python/pyqt_example_f.py b/gr-qtgui/apps/pyqt_example_f.py index 4e36ccca5f..6b21310192 100755 --- a/gr-qtgui/src/python/pyqt_example_f.py +++ b/gr-qtgui/apps/pyqt_example_f.py @@ -1,7 +1,7 @@ #!/usr/bin/env python from gnuradio import gr, blks2 -from gnuradio.qtgui import qtgui +from gnuradio import qtgui from PyQt4 import QtGui, QtCore import sys, sip @@ -28,11 +28,13 @@ class control_box(QtGui.QWidget): # 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) @@ -40,17 +42,20 @@ class control_box(QtGui.QWidget): # 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()'), @@ -115,7 +120,7 @@ class my_top_block(gr.top_block): self.snk1 = qtgui.sink_f(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, 0, Rs, "Float Signal Example", - True, True, False, True, False) + True, True, True, False) self.connect(src1, (src,0)) self.connect(src2, (src,1)) @@ -130,14 +135,14 @@ class my_top_block(gr.top_block): # Wrap the pointer as a PyQt SIP object # This can now be manipulated as a PyQt4.QtGui.QWidget - self.pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) + pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) - self.main_box = dialog_box(self.pyWin, self.ctrl_win) + self.main_box = dialog_box(pyWin, self.ctrl_win) self.main_box.show() if __name__ == "__main__": tb = my_top_block(); tb.start() - tb.qapp.exec_() + sys.exit(tb.qapp.exec_()) diff --git a/gr-qtgui/src/python/qt_digital.py b/gr-qtgui/apps/qt_digital.py index 679f144eff..c6920a05d0 100755 --- a/gr-qtgui/src/python/qt_digital.py +++ b/gr-qtgui/apps/qt_digital.py @@ -1,7 +1,7 @@ #!/usr/bin/env python from gnuradio import gr, blks2 -from gnuradio.qtgui import qtgui +from gnuradio import qtgui from gnuradio import eng_notation from PyQt4 import QtGui, QtCore import sys, sip @@ -185,11 +185,11 @@ class my_top_block(gr.top_block): 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, False, True, True) + "Tx", True, True, True, True) self.snk_rx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, 0, self._sample_rate, - "Rx", True, True, False, True, True) + "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) diff --git a/gr-qtgui/src/python/qt_digital_window.py b/gr-qtgui/apps/qt_digital_window.py index 50dd53a923..50dd53a923 100644 --- a/gr-qtgui/src/python/qt_digital_window.py +++ b/gr-qtgui/apps/qt_digital_window.py diff --git a/gr-qtgui/src/python/qt_digital_window.ui b/gr-qtgui/apps/qt_digital_window.ui index 9672521815..9672521815 100644 --- a/gr-qtgui/src/python/qt_digital_window.ui +++ b/gr-qtgui/apps/qt_digital_window.ui diff --git a/gr-qtgui/src/python/usrp2_display.py b/gr-qtgui/apps/usrp2_display.py index 75d374c2bd..ab1a6f742c 100755 --- a/gr-qtgui/src/python/usrp2_display.py +++ b/gr-qtgui/apps/usrp2_display.py @@ -210,7 +210,7 @@ class my_top_block(gr.top_block): self.snk = qtgui.sink_c(options.fft_size, gr.firdes.WIN_BLACKMAN_hARRIS, self._freq, self._bandwidth, "USRP2 Display", - True, True, False, True, False) + True, True, True, False) # Set up internal amplifier self.amp = gr.multiply_const_cc(0.0) diff --git a/gr-qtgui/src/python/usrp_display.py b/gr-qtgui/apps/usrp_display.py index 432e74d9a0..131bc4a7e1 100755 --- a/gr-qtgui/src/python/usrp_display.py +++ b/gr-qtgui/apps/usrp_display.py @@ -229,7 +229,7 @@ class my_top_block(gr.top_block): self.snk = qtgui.sink_c(self._fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, self._freq, self._bandwidth, "USRP Display", - True, True, False, True, False) + True, True, True, False) # Set up internal amplifier self.amp = gr.multiply_const_cc(0.0) diff --git a/gr-qtgui/src/python/usrp_display_qtgui.py b/gr-qtgui/apps/usrp_display_qtgui.py index 4c9de3a53c..4c9de3a53c 100644 --- a/gr-qtgui/src/python/usrp_display_qtgui.py +++ b/gr-qtgui/apps/usrp_display_qtgui.py diff --git a/gr-qtgui/src/python/usrp_display_qtgui.ui b/gr-qtgui/apps/usrp_display_qtgui.ui index e88ca9dce0..e88ca9dce0 100644 --- a/gr-qtgui/src/python/usrp_display_qtgui.ui +++ b/gr-qtgui/apps/usrp_display_qtgui.ui diff --git a/gr-qtgui/gnuradio-qtgui.pc.in b/gr-qtgui/gnuradio-qtgui.pc.in new file mode 100644 index 0000000000..27b6a21bff --- /dev/null +++ b/gr-qtgui/gnuradio-qtgui.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: gnuradio-qtgui +Description: GNU Radio blocks for QT GUI +Requires: gnuradio-core +Version: @LIBVER@ +Libs: -L${libdir} -lgnuradio-qtgui +Cflags: -I${includedir} diff --git a/gr-qtgui/grc/qtgui_sink_x.xml b/gr-qtgui/grc/qtgui_sink_x.xml index 7a5f5ec135..8c470a1a5f 100644 --- a/gr-qtgui/grc/qtgui_sink_x.xml +++ b/gr-qtgui/grc/qtgui_sink_x.xml @@ -21,7 +21,6 @@ qtgui.$(type.fcn)( $name, \#name $plotfreq, \#plotfreq $plotwaterfall, \#plotwaterfall - $plotwaterfall3d, \#plotwaterfall3d $plottime, \#plottime $plotconst, \#plotconst ) @@ -90,15 +89,6 @@ $(gui_hint()($win))</make> <option><name>Off</name><key>False</key></option> </param> <param> - <name>Plot Waterfall 3D</name> - <key>plotwaterfall3d</key> - <value>True</value> - <type>bool</type> - <hide>part</hide> - <option><name>On</name><key>True</key></option> - <option><name>Off</name><key>False</key></option> - </param> - <param> <name>Plot Time</name> <key>plottime</key> <value>True</value> diff --git a/gr-qtgui/src/lib/.gitignore b/gr-qtgui/lib/.gitignore index 61b9ca8c19..fc4f8cdfe7 100644 --- a/gr-qtgui/src/lib/.gitignore +++ b/gr-qtgui/lib/.gitignore @@ -5,7 +5,6 @@ /qtgui.cc /qtgui.py /WaterfallDisplayPlot.moc.cc -/Waterfall3DDisplayPlot.moc.cc /TimeDomainDisplayPlot.moc.cc /spectrumdisplayform.moc.cc /spectrumdisplayform.ui.h diff --git a/gr-qtgui/src/lib/ConstellationDisplayPlot.cc b/gr-qtgui/lib/ConstellationDisplayPlot.cc index 9ad5bdd3c4..71933cece7 100644 --- a/gr-qtgui/src/lib/ConstellationDisplayPlot.cc +++ b/gr-qtgui/lib/ConstellationDisplayPlot.cc @@ -74,8 +74,6 @@ ConstellationDisplayPlot::ConstellationDisplayPlot(QWidget* parent) memset(_realDataPoints, 0x0, _numPoints*sizeof(double)); memset(_imagDataPoints, 0x0, _numPoints*sizeof(double)); - replot(); - _zoomer = new ConstellationDisplayZoomer(canvas()); #if QT_VERSION < 0x040000 _zoomer->setMousePattern(QwtEventPattern::MouseSelect2, @@ -178,8 +176,6 @@ void ConstellationDisplayPlot::PlotNewData(const double* realDataPoints, memcpy(_realDataPoints, realDataPoints, numDataPoints*sizeof(double)); memcpy(_imagDataPoints, imagDataPoints, numDataPoints*sizeof(double)); - replot(); - _lastReplot = get_highres_clock(); } } diff --git a/gr-qtgui/src/lib/ConstellationDisplayPlot.h b/gr-qtgui/lib/ConstellationDisplayPlot.h index a441a8bfe8..a441a8bfe8 100644 --- a/gr-qtgui/src/lib/ConstellationDisplayPlot.h +++ b/gr-qtgui/lib/ConstellationDisplayPlot.h diff --git a/gr-qtgui/src/lib/FrequencyDisplayPlot.cc b/gr-qtgui/lib/FrequencyDisplayPlot.cc index d150e2e4ce..45e2e6c168 100644 --- a/gr-qtgui/src/lib/FrequencyDisplayPlot.cc +++ b/gr-qtgui/lib/FrequencyDisplayPlot.cc @@ -367,8 +367,6 @@ FrequencyDisplayPlot::PlotNewData(const double* dataPoints, const int64_t numDat SetUpperIntensityLevel(_peakAmplitude); - replot(); - _lastReplot = get_highres_clock(); } } diff --git a/gr-qtgui/src/lib/FrequencyDisplayPlot.h b/gr-qtgui/lib/FrequencyDisplayPlot.h index 3c22c13975..3c22c13975 100644 --- a/gr-qtgui/src/lib/FrequencyDisplayPlot.h +++ b/gr-qtgui/lib/FrequencyDisplayPlot.h diff --git a/gr-qtgui/src/lib/Makefile.am b/gr-qtgui/lib/Makefile.am index 446a07fd0f..f9b5dd03e1 100644 --- a/gr-qtgui/src/lib/Makefile.am +++ b/gr-qtgui/lib/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2008,2009,2010 Free Software Foundation, Inc. +# Copyright 2008-2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,7 +20,6 @@ # include $(top_srcdir)/Makefile.common -include $(top_srcdir)/Makefile.swig EXTRA_DIST += spectrumdisplayform.ui @@ -70,11 +69,11 @@ grinclude_HEADERS = \ spectrumdisplayform.h \ SpectrumGUIClass.h \ spectrumUpdateEvents.h \ - qtgui.h \ qtgui_sink_c.h \ qtgui_sink_f.h -QT_MOC_FLAGS=-DQT_SHARED -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB +#QT_MOC_FLAGS=-DQT_SHARED -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB +QT_MOC_FLAGS=-DQT_SHARED -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB %.moc.cc : %.h $(QT_MOC_EXEC) $(QT_MOC_FLAGS) -p $(srcdir) $< -o $@ @@ -91,7 +90,6 @@ libgnuradio_qtgui_la_LIBADD = \ -lstdc++ \ $(QT_LIBS) - ############################## # SWIG interfaces and libraries diff --git a/gr-qtgui/src/lib/SpectrumGUIClass.cc b/gr-qtgui/lib/SpectrumGUIClass.cc index 052730fc26..1a519591d4 100644 --- a/gr-qtgui/src/lib/SpectrumGUIClass.cc +++ b/gr-qtgui/lib/SpectrumGUIClass.cc @@ -37,34 +37,31 @@ SpectrumGUIClass::SpectrumGUIClass(const uint64_t maxDataSize, _windowOpennedFlag = false; _fftBuffersCreatedFlag = false; - // Create Mutex Lock - //_windowStateLock = new MutexClass("_windowStateLock"); - _powerValue = 1; } SpectrumGUIClass::~SpectrumGUIClass() { - if(GetWindowOpenFlag()){ - delete _spectrumDisplayForm; - } + // We don't need to delete this since as a QWidget, it is supposed to be destroyed + // with it's parent. Deleting it causes a segmentation fault, and not deleting it + // does not leave any extra memory. + //if(GetWindowOpenFlag()){ + //delete _spectrumDisplayForm; + //} if(_fftBuffersCreatedFlag){ delete[] _fftPoints; delete[] _realTimeDomainPoints; delete[] _imagTimeDomainPoints; } - - //delete _windowStateLock; } void SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, const bool frequency, const bool waterfall, - const bool time, const bool constellation, - const bool use_openGL) + const bool time, const bool constellation) { - //_windowStateLock->Lock(); + d_mutex.lock(); if(!_windowOpennedFlag){ @@ -81,7 +78,7 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, } // Called from the Event Thread - _spectrumDisplayForm = new SpectrumDisplayForm(use_openGL, parent); + _spectrumDisplayForm = new SpectrumDisplayForm(parent); // Toggle Windows on/off _spectrumDisplayForm->ToggleTabFrequency(frequency); @@ -95,8 +92,8 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, qApp->processEvents(); } + d_mutex.unlock(); - //_windowStateLock->Unlock(); SetDisplayTitle(_title); Reset(); @@ -104,8 +101,6 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, qApp->postEvent(_spectrumDisplayForm, new QEvent(QEvent::Type(QEvent::User+3))); - qApp->processEvents(); - timespec_reset(&_lastGUIUpdateTime); // Draw Blank Display @@ -147,10 +142,9 @@ SpectrumGUIClass::SetDisplayTitle(const std::string newString) bool SpectrumGUIClass::GetWindowOpenFlag() { + gruel::scoped_lock lock(d_mutex); bool returnFlag = false; - //_windowStateLock->Lock(); returnFlag = _windowOpennedFlag; - //_windowStateLock->Unlock(); return returnFlag; } @@ -158,9 +152,8 @@ SpectrumGUIClass::GetWindowOpenFlag() void SpectrumGUIClass::SetWindowOpenFlag(const bool newFlag) { - //_windowStateLock->Lock(); + gruel::scoped_lock lock(d_mutex); _windowOpennedFlag = newFlag; - //_windowStateLock->Unlock(); } void @@ -168,7 +161,7 @@ SpectrumGUIClass::SetFrequencyRange(const double centerFreq, const double startFreq, const double stopFreq) { - //_windowStateLock->Lock(); + gruel::scoped_lock lock(d_mutex); _centerFrequency = centerFreq; _startFrequency = startFreq; _stopFrequency = stopFreq; @@ -176,36 +169,32 @@ SpectrumGUIClass::SetFrequencyRange(const double centerFreq, _spectrumDisplayForm->SetFrequencyRange(_centerFrequency, _startFrequency, _stopFrequency); - //_windowStateLock->Unlock(); } double -SpectrumGUIClass::GetStartFrequency() const +SpectrumGUIClass::GetStartFrequency() { + gruel::scoped_lock lock(d_mutex); double returnValue = 0.0; - //_windowStateLock->Lock(); returnValue = _startFrequency; - //_windowStateLock->Unlock(); return returnValue; } double -SpectrumGUIClass::GetStopFrequency() const +SpectrumGUIClass::GetStopFrequency() { + gruel::scoped_lock lock(d_mutex); double returnValue = 0.0; - //_windowStateLock->Lock(); returnValue = _stopFrequency; - //_windowStateLock->Unlock(); return returnValue; } double -SpectrumGUIClass::GetCenterFrequency() const +SpectrumGUIClass::GetCenterFrequency() { + gruel::scoped_lock lock(d_mutex); double returnValue = 0.0; - //_windowStateLock->Lock(); returnValue = _centerFrequency; - //_windowStateLock->Unlock(); return returnValue; } @@ -221,6 +210,7 @@ SpectrumGUIClass::UpdateWindow(const bool updateDisplayFlag, const timespec timestamp, const bool lastOfMultipleFFTUpdateFlag) { + //gruel::scoped_lock lock(d_mutex); int64_t bufferSize = inputBufferSize; bool repeatDataFlag = false; if(bufferSize > _dataPoints){ @@ -302,54 +292,49 @@ SpectrumGUIClass::UpdateWindow(const bool updateDisplayFlag, } float -SpectrumGUIClass::GetPowerValue() const +SpectrumGUIClass::GetPowerValue() { + gruel::scoped_lock lock(d_mutex); float returnValue = 0; - //_windowStateLock->Lock(); returnValue = _powerValue; - //_windowStateLock->Unlock(); return returnValue; } void SpectrumGUIClass::SetPowerValue(const float value) { - //_windowStateLock->Lock(); + gruel::scoped_lock lock(d_mutex); _powerValue = value; - //_windowStateLock->Unlock(); } int -SpectrumGUIClass::GetWindowType() const +SpectrumGUIClass::GetWindowType() { + gruel::scoped_lock lock(d_mutex); int returnValue = 0; - //_windowStateLock->Lock(); returnValue = _windowType; - //_windowStateLock->Unlock(); return returnValue; } void SpectrumGUIClass::SetWindowType(const int newType) { - //_windowStateLock->Lock(); + gruel::scoped_lock lock(d_mutex); _windowType = newType; - //_windowStateLock->Unlock(); } int -SpectrumGUIClass::GetFFTSize() const +SpectrumGUIClass::GetFFTSize() { int returnValue = 0; - //_windowStateLock->Lock(); returnValue = _fftSize; - //_windowStateLock->Unlock(); return returnValue; } int -SpectrumGUIClass::GetFFTSizeIndex() const +SpectrumGUIClass::GetFFTSizeIndex() { + gruel::scoped_lock lock(d_mutex); int fftsize = GetFFTSize(); switch(fftsize) { case(1024): return 0; break; @@ -365,75 +350,70 @@ SpectrumGUIClass::GetFFTSizeIndex() const void SpectrumGUIClass::SetFFTSize(const int newSize) { - //_windowStateLock->Lock(); + gruel::scoped_lock lock(d_mutex); _fftSize = newSize; - //_windowStateLock->Unlock(); } timespec -SpectrumGUIClass::GetLastGUIUpdateTime() const +SpectrumGUIClass::GetLastGUIUpdateTime() { + gruel::scoped_lock lock(d_mutex); timespec returnValue; - //_windowStateLock->Lock(); returnValue = _lastGUIUpdateTime; - //_windowStateLock->Unlock(); return returnValue; } void SpectrumGUIClass::SetLastGUIUpdateTime(const timespec newTime) { - //_windowStateLock->Lock(); + gruel::scoped_lock lock(d_mutex); _lastGUIUpdateTime = newTime; - //_windowStateLock->Unlock(); } unsigned int -SpectrumGUIClass::GetPendingGUIUpdateEvents() const +SpectrumGUIClass::GetPendingGUIUpdateEvents() { + gruel::scoped_lock lock(d_mutex); unsigned int returnValue = 0; - //_windowStateLock->Lock(); returnValue = _pendingGUIUpdateEventsCount; - //_windowStateLock->Unlock(); return returnValue; } void SpectrumGUIClass::IncrementPendingGUIUpdateEvents() { - //_windowStateLock->Lock(); + gruel::scoped_lock lock(d_mutex); _pendingGUIUpdateEventsCount++; - //_windowStateLock->Unlock(); } void SpectrumGUIClass::DecrementPendingGUIUpdateEvents() { - //_windowStateLock->Lock(); + gruel::scoped_lock lock(d_mutex); if(_pendingGUIUpdateEventsCount > 0){ _pendingGUIUpdateEventsCount--; } - //_windowStateLock->Unlock(); } void SpectrumGUIClass::ResetPendingGUIUpdateEvents() { - //_windowStateLock->Lock(); + gruel::scoped_lock lock(d_mutex); _pendingGUIUpdateEventsCount = 0; - //_windowStateLock->Unlock(); } QWidget* SpectrumGUIClass::qwidget() { + gruel::scoped_lock lock(d_mutex); return (QWidget*)_spectrumDisplayForm; } void SpectrumGUIClass::SetTimeDomainAxis(double min, double max) { + gruel::scoped_lock lock(d_mutex); _spectrumDisplayForm->SetTimeDomainAxis(min, max); } @@ -441,12 +421,14 @@ void SpectrumGUIClass::SetConstellationAxis(double xmin, double xmax, double ymin, double ymax) { + gruel::scoped_lock lock(d_mutex); _spectrumDisplayForm->SetConstellationAxis(xmin, xmax, ymin, ymax); - } void -SpectrumGUIClass::SetConstellationPenSize(int size){ +SpectrumGUIClass::SetConstellationPenSize(int size) +{ + gruel::scoped_lock lock(d_mutex); _spectrumDisplayForm->SetConstellationPenSize(size); } @@ -454,12 +436,14 @@ SpectrumGUIClass::SetConstellationPenSize(int size){ void SpectrumGUIClass::SetFrequencyAxis(double min, double max) { + gruel::scoped_lock lock(d_mutex); _spectrumDisplayForm->SetFrequencyAxis(min, max); } void SpectrumGUIClass::SetUpdateTime(double t) { + gruel::scoped_lock lock(d_mutex); _updateTime = t; _spectrumDisplayForm->SetUpdateTime(_updateTime); } diff --git a/gr-qtgui/src/lib/SpectrumGUIClass.h b/gr-qtgui/lib/SpectrumGUIClass.h index 57a749a6a2..48f45a0f50 100644 --- a/gr-qtgui/src/lib/SpectrumGUIClass.h +++ b/gr-qtgui/lib/SpectrumGUIClass.h @@ -1,15 +1,13 @@ #ifndef SPECTRUM_GUI_CLASS_HPP #define SPECTRUM_GUI_CLASS_HPP -//#include <mutexClass.hpp> +#include <gruel/thread.h> #include <qwidget.h> #include <qapplication.h> #include <qlabel.h> #include <qslider.h> #include <spectrumUpdateEvents.h> -//#include <Windowing.hpp> - class SpectrumDisplayForm; #include <spectrumdisplayform.h> @@ -31,17 +29,16 @@ public: void OpenSpectrumWindow(QWidget*, const bool frequency=true, const bool waterfall=true, - const bool time=true, const bool constellation=true, - const bool use_openGL=true); + const bool time=true, const bool constellation=true); void SetDisplayTitle(const std::string); bool GetWindowOpenFlag(); void SetWindowOpenFlag(const bool); void SetFrequencyRange(const double, const double, const double); - double GetStartFrequency()const; - double GetStopFrequency()const; - double GetCenterFrequency()const; + double GetStartFrequency(); + double GetStopFrequency(); + double GetCenterFrequency(); void UpdateWindow(const bool, const std::complex<float>*, const uint64_t, const float*, @@ -49,20 +46,20 @@ public: const uint64_t, const timespec, const bool); - float GetPowerValue()const; + float GetPowerValue(); void SetPowerValue(const float); - int GetWindowType()const; + int GetWindowType(); void SetWindowType(const int); - int GetFFTSize()const; - int GetFFTSizeIndex()const; + int GetFFTSize(); + int GetFFTSizeIndex(); void SetFFTSize(const int); - timespec GetLastGUIUpdateTime()const; + timespec GetLastGUIUpdateTime(); void SetLastGUIUpdateTime(const timespec); - unsigned int GetPendingGUIUpdateEvents()const; + unsigned int GetPendingGUIUpdateEvents(); void IncrementPendingGUIUpdateEvents(); void DecrementPendingGUIUpdateEvents(); void ResetPendingGUIUpdateEvents(); @@ -84,7 +81,7 @@ protected: private: - //MutexClass* _windowStateLock; + gruel::mutex d_mutex; int64_t _dataPoints; std::string _title; double _centerFrequency; diff --git a/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc b/gr-qtgui/lib/TimeDomainDisplayPlot.cc index 9c98cec5b0..da28d03044 100644 --- a/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc +++ b/gr-qtgui/lib/TimeDomainDisplayPlot.cc @@ -121,8 +121,6 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(QWidget* parent):QwtPlot(parent) _sampleRate = 1; _resetXAxisPoints(); - replot(); - #if QT_VERSION < 0x040000 _zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier); @@ -220,8 +218,6 @@ void TimeDomainDisplayPlot::PlotNewData(const double* realDataPoints, memcpy(_realDataPoints, realDataPoints, numDataPoints*sizeof(double)); memcpy(_imagDataPoints, imagDataPoints, numDataPoints*sizeof(double)); - replot(); - _lastReplot = get_highres_clock(); } } diff --git a/gr-qtgui/src/lib/TimeDomainDisplayPlot.h b/gr-qtgui/lib/TimeDomainDisplayPlot.h index 952b5c8cfe..952b5c8cfe 100644 --- a/gr-qtgui/src/lib/TimeDomainDisplayPlot.h +++ b/gr-qtgui/lib/TimeDomainDisplayPlot.h diff --git a/gr-qtgui/src/lib/WaterfallDisplayPlot.cc b/gr-qtgui/lib/WaterfallDisplayPlot.cc index a8e5361e75..08a71c023a 100644 --- a/gr-qtgui/src/lib/WaterfallDisplayPlot.cc +++ b/gr-qtgui/lib/WaterfallDisplayPlot.cc @@ -142,7 +142,7 @@ public: std::string time_str = pt::to_simple_string(pt::from_time_t(lineTime.tv_sec)); // lops off the YYYY-mmm-DD part of the string - int ind = time_str.find(" "); + size_t ind = time_str.find(" "); if(ind != std::string::npos) time_str = time_str.substr(ind); return QwtText(QString("").sprintf("%s.%03ld", time_str.c_str(), lineTime.tv_nsec/1000000)); @@ -194,7 +194,7 @@ protected: std::string time_str = pt::to_simple_string(pt::from_time_t(lineTime.tv_sec)); // lops off the YYYY-mmm-DD part of the string - int ind = time_str.find(" "); + size_t ind = time_str.find(" "); if(ind != std::string::npos) time_str = time_str.substr(ind); QString yLabel(QString("").sprintf("%s.%03ld", time_str.c_str(), lineTime.tv_nsec/1000000)); diff --git a/gr-qtgui/src/lib/WaterfallDisplayPlot.h b/gr-qtgui/lib/WaterfallDisplayPlot.h index 6b4e978bb3..6b4e978bb3 100644 --- a/gr-qtgui/src/lib/WaterfallDisplayPlot.h +++ b/gr-qtgui/lib/WaterfallDisplayPlot.h diff --git a/gr-qtgui/src/lib/highResTimeFunctions.h b/gr-qtgui/lib/highResTimeFunctions.h index 251bbad8b1..251bbad8b1 100644 --- a/gr-qtgui/src/lib/highResTimeFunctions.h +++ b/gr-qtgui/lib/highResTimeFunctions.h diff --git a/gr-qtgui/src/lib/plot_waterfall.cc b/gr-qtgui/lib/plot_waterfall.cc index 2b1447e031..2b1447e031 100644 --- a/gr-qtgui/src/lib/plot_waterfall.cc +++ b/gr-qtgui/lib/plot_waterfall.cc diff --git a/gr-qtgui/src/lib/plot_waterfall.h b/gr-qtgui/lib/plot_waterfall.h index a11461611c..a11461611c 100644 --- a/gr-qtgui/src/lib/plot_waterfall.h +++ b/gr-qtgui/lib/plot_waterfall.h diff --git a/gr-qtgui/src/lib/qtgui_sink_c.cc b/gr-qtgui/lib/qtgui_sink_c.cc index 05c7b28d53..7b40dd01d6 100644 --- a/gr-qtgui/src/lib/qtgui_sink_c.cc +++ b/gr-qtgui/lib/qtgui_sink_c.cc @@ -35,27 +35,21 @@ qtgui_make_sink_c (int fftsize, int wintype, double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, - bool plotwaterfall3d, bool plottime, - bool plotconst, - bool use_openGL, + bool plottime, bool plotconst, QWidget *parent) { return gnuradio::get_initial_sptr(new qtgui_sink_c (fftsize, wintype, - fc, bw, name, - plotfreq, plotwaterfall, - plotwaterfall3d, plottime, - plotconst, - use_openGL, - parent)); + fc, bw, name, + plotfreq, plotwaterfall, + plottime, plotconst, + parent)); } qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype, double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, - bool plotwaterfall3d, bool plottime, - bool plotconst, - bool use_openGL, + bool plottime, bool plotconst, QWidget *parent) : gr_block ("sink_c", gr_make_io_signature (1, -1, sizeof(gr_complex)), @@ -67,12 +61,7 @@ qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype, d_plottime(plottime), d_plotconst(plotconst), d_parent(parent) { - if(plotwaterfall3d == true) { - fprintf(stderr, "Warning: plotting Waterfall3D has been removed; enabling plotwaterfall3d has no effect.\n"); - } - d_main_gui = NULL; - lock(); // Perform fftshift operation; // this is usually desired when plotting @@ -85,7 +74,7 @@ qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype, buildwindow(); - initialize(use_openGL); + initialize(); } qtgui_sink_c::~qtgui_sink_c() @@ -104,25 +93,14 @@ qtgui_sink_c::forecast(int noutput_items, gr_vector_int &ninput_items_required) } } -void qtgui_sink_c::lock() -{ - d_mutex.lock(); -} - -void qtgui_sink_c::unlock() -{ - d_mutex.unlock(); -} - - void -qtgui_sink_c::initialize(const bool opengl) +qtgui_sink_c::initialize() { if(qApp != NULL) { d_qApplication = qApp; } else { - int argc; + int argc=0; char **argv = NULL; d_qApplication = new QApplication(argc, argv); } @@ -143,14 +121,10 @@ qtgui_sink_c::initialize(const bool opengl) d_main_gui->OpenSpectrumWindow(d_parent, d_plotfreq, d_plotwaterfall, - d_plottime, d_plotconst, - opengl); + d_plottime, d_plotconst); // initialize update time to 10 times a second set_update_time(0.1); - - d_object = new qtgui_obj(d_qApplication); - qApp->postEvent(d_object, new qtgui_event(d_mutex)); } @@ -288,8 +262,6 @@ qtgui_sink_c::general_work (int noutput_items, int j=0; const gr_complex *in = (const gr_complex*)input_items[0]; - gruel::scoped_lock lock(d_mutex); - // Update the FFT size from the application fftresize(); windowreset(); diff --git a/gr-qtgui/src/lib/qtgui_sink_c.h b/gr-qtgui/lib/qtgui_sink_c.h index bbf9983b08..1c95617043 100644 --- a/gr-qtgui/src/lib/qtgui_sink_c.h +++ b/gr-qtgui/lib/qtgui_sink_c.h @@ -28,7 +28,6 @@ #include <gr_firdes.h> #include <gri_fft.h> #include <qapplication.h> -#include <qtgui.h> #include "SpectrumGUIClass.h" class qtgui_sink_c; @@ -38,9 +37,7 @@ qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype, 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, - bool plotconst=true, - bool use_openGL=true, + bool plottime=true, bool plotconst=true, QWidget *parent=NULL); class qtgui_sink_c : public gr_block @@ -50,24 +47,18 @@ private: double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, - bool plotwaterfall3d, bool plottime, - bool plotconst, - bool use_openGL, + bool plottime, bool plotconst, QWidget *parent); qtgui_sink_c (int fftsize, int wintype, double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, - bool plotwaterfall3d, bool plottime, - bool plotconst, - bool use_openGL, + bool plottime, bool plotconst, QWidget *parent); void forecast(int noutput_items, gr_vector_int &ninput_items_required); - // use opengl to force OpenGL on or off - // this might be necessary for sessions over SSH - void initialize(const bool opengl=true); + void initialize(); int d_fftsize; gr_firdes::win_type d_wintype; @@ -76,7 +67,7 @@ private: double d_bandwidth; std::string d_name; - gruel::mutex d_mutex; + //gruel::mutex d_mutex; bool d_shift; gri_fft_complex *d_fft; @@ -99,8 +90,6 @@ private: public: ~qtgui_sink_c(); void exec_(); - void lock(); - void unlock(); QWidget* qwidget(); PyObject* pyqwidget(); @@ -116,7 +105,7 @@ public: void set_update_time(double t); QApplication *d_qApplication; - qtgui_obj *d_object; + //qtgui_obj *d_object; int general_work (int noutput_items, gr_vector_int &ninput_items, diff --git a/gr-qtgui/src/lib/qtgui_sink_f.cc b/gr-qtgui/lib/qtgui_sink_f.cc index 984c2803c8..3312b90068 100644 --- a/gr-qtgui/src/lib/qtgui_sink_f.cc +++ b/gr-qtgui/lib/qtgui_sink_f.cc @@ -35,17 +35,13 @@ qtgui_make_sink_f (int fftsize, int wintype, double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, - bool plotwaterfall3d, bool plottime, - bool plotconst, - bool use_openGL, + bool plottime, bool plotconst, QWidget *parent) { return gnuradio::get_initial_sptr(new qtgui_sink_f (fftsize, wintype, fc, bw, name, plotfreq, plotwaterfall, - plotwaterfall3d, plottime, - plotconst, - use_openGL, + plottime, plotconst, parent)); } @@ -53,9 +49,7 @@ qtgui_sink_f::qtgui_sink_f (int fftsize, int wintype, double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, - bool plotwaterfall3d, bool plottime, - bool plotconst, - bool use_openGL, + bool plottime, bool plotconst, QWidget *parent) : gr_block ("sink_f", gr_make_io_signature (1, 1, sizeof(float)), @@ -67,12 +61,7 @@ qtgui_sink_f::qtgui_sink_f (int fftsize, int wintype, d_plottime(plottime), d_plotconst(plotconst), d_parent(parent) { - if(plotwaterfall3d == true) { - fprintf(stderr, "Warning: plotting Waterfall3D has been removed; enabling plotwaterfall3d has no effect.\n"); - } - d_main_gui = NULL; - lock(); // Perform fftshift operation; // this is usually desired when plotting @@ -85,7 +74,7 @@ qtgui_sink_f::qtgui_sink_f (int fftsize, int wintype, buildwindow(); - initialize(use_openGL); + initialize(); } qtgui_sink_f::~qtgui_sink_f() @@ -104,18 +93,8 @@ qtgui_sink_f::forecast(int noutput_items, gr_vector_int &ninput_items_required) } } -void qtgui_sink_f::lock() -{ - d_mutex.lock(); -} - -void qtgui_sink_f::unlock() -{ - d_mutex.unlock(); -} - void -qtgui_sink_f::initialize(const bool opengl) +qtgui_sink_f::initialize() { if(qApp != NULL) { d_qApplication = qApp; @@ -138,14 +117,10 @@ qtgui_sink_f::initialize(const bool opengl) d_main_gui->OpenSpectrumWindow(d_parent, d_plotfreq, d_plotwaterfall, - d_plottime, d_plotconst, - opengl); + d_plottime, d_plotconst); // initialize update time to 10 times a second set_update_time(0.1); - - d_object = new qtgui_obj(d_qApplication); - qApp->postEvent(d_object, new qtgui_event(d_mutex)); } void @@ -283,8 +258,6 @@ qtgui_sink_f::general_work (int noutput_items, int j=0; const float *in = (const float*)input_items[0]; - gruel::scoped_lock lock(d_mutex); - // Update the FFT size from the application fftresize(); windowreset(); diff --git a/gr-qtgui/src/lib/qtgui_sink_f.h b/gr-qtgui/lib/qtgui_sink_f.h index d80a6a1988..518aa3846f 100644 --- a/gr-qtgui/src/lib/qtgui_sink_f.h +++ b/gr-qtgui/lib/qtgui_sink_f.h @@ -28,7 +28,7 @@ #include <gr_firdes.h> #include <gri_fft.h> #include <qapplication.h> -#include <qtgui.h> +//#include <qtgui.h> #include "SpectrumGUIClass.h" class qtgui_sink_f; @@ -38,9 +38,7 @@ qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype, 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, + bool plottime=true, bool plotconst=true, QWidget *parent=NULL); class qtgui_sink_f : public gr_block @@ -50,22 +48,18 @@ private: double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, - bool plotwaterfall3d, bool plottime, - bool plotconst, - bool use_openGL, + bool plottime, bool plotconst, QWidget *parent); qtgui_sink_f (int fftsize, int wintype, double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, - bool plotwaterfall3d, bool plottime, - bool plotconst, - bool use_openGL, + bool plottime, bool plotconst, QWidget *parent); void forecast(int noutput_items, gr_vector_int &ninput_items_required); - void initialize(const bool opengl=true); + void initialize(); int d_fftsize; gr_firdes::win_type d_wintype; @@ -74,8 +68,6 @@ private: double d_bandwidth; std::string d_name; - gruel::mutex d_mutex; - bool d_shift; gri_fft_complex *d_fft; @@ -97,8 +89,6 @@ private: public: ~qtgui_sink_f(); void exec_(); - void lock(); - void unlock(); QWidget* qwidget(); PyObject* pyqwidget(); @@ -114,7 +104,6 @@ public: void set_update_time(double t); QApplication *d_qApplication; - qtgui_obj *d_object; int general_work (int noutput_items, gr_vector_int &ninput_items, diff --git a/gr-qtgui/src/lib/spectrumUpdateEvents.cc b/gr-qtgui/lib/spectrumUpdateEvents.cc index 53a205fb78..53a205fb78 100644 --- a/gr-qtgui/src/lib/spectrumUpdateEvents.cc +++ b/gr-qtgui/lib/spectrumUpdateEvents.cc diff --git a/gr-qtgui/src/lib/spectrumUpdateEvents.h b/gr-qtgui/lib/spectrumUpdateEvents.h index ccc072c3e3..ccc072c3e3 100644 --- a/gr-qtgui/src/lib/spectrumUpdateEvents.h +++ b/gr-qtgui/lib/spectrumUpdateEvents.h diff --git a/gr-qtgui/src/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index e0509a2948..804dbdd627 100644 --- a/gr-qtgui/src/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -3,14 +3,11 @@ #include <QMessageBox> #include <spectrumdisplayform.h> -int SpectrumDisplayForm::_openGLWaterfall3DFlag = -1; - -SpectrumDisplayForm::SpectrumDisplayForm(bool useOpenGL, QWidget* parent) +SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) : QWidget(parent) { setupUi(this); - _useOpenGL = useOpenGL; _systemSpecifiedFlag = false; _intValidator = new QIntValidator(this); _intValidator->setBottom(0); @@ -59,6 +56,9 @@ SpectrumDisplayForm::SpectrumDisplayForm(bool useOpenGL, QWidget* parent) ToggleTabTime(false); ToggleTabConstellation(false); + _historyEntry = 0; + _historyEntryCount = 0; + // Create a timer to update plots at the specified rate displayTimer = new QTimer(this); connect(displayTimer, SIGNAL(timeout()), this, SLOT(UpdateGuiTimer())); diff --git a/gr-qtgui/src/lib/spectrumdisplayform.h b/gr-qtgui/lib/spectrumdisplayform.h index fbd08349bf..794a8c58e6 100644 --- a/gr-qtgui/src/lib/spectrumdisplayform.h +++ b/gr-qtgui/lib/spectrumdisplayform.h @@ -20,7 +20,7 @@ class SpectrumDisplayForm : public QWidget, public Ui::SpectrumDisplayForm Q_OBJECT public: - SpectrumDisplayForm(bool useOpenGL = true, QWidget* parent = 0); + SpectrumDisplayForm(QWidget* parent = 0); ~SpectrumDisplayForm(); void setSystem( SpectrumGUIClass * newSystem, const uint64_t numFFTDataPoints, @@ -76,7 +76,6 @@ protected: private: void _AverageHistory( const double * newBuffer ); - bool _useOpenGL; int _historyEntryCount; int _historyEntry; std::vector<double*>* _historyVector; @@ -95,7 +94,6 @@ private: double _noiseFloorAmplitude; double _peakFrequency; double _peakAmplitude; - static int _openGLWaterfall3DFlag; double _stopFrequency; //SpectrumUpdateEvent _lastSpectrumEvent; @@ -103,7 +101,6 @@ private: // whether or not to use a particular display int d_plot_fft; int d_plot_waterfall; - int d_plot_waterfall3d; int d_plot_time; int d_plot_constellation; diff --git a/gr-qtgui/src/lib/spectrumdisplayform.ui b/gr-qtgui/lib/spectrumdisplayform.ui index 5a23bc8a9f..049d4ffeb4 100644 --- a/gr-qtgui/src/lib/spectrumdisplayform.ui +++ b/gr-qtgui/lib/spectrumdisplayform.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>712</width> - <height>543</height> + <height>560</height> </rect> </property> <property name="windowTitle"> @@ -182,8 +182,8 @@ </property> <property name="minimumSize"> <size> - <width>400</width> - <height>350</height> + <width>617</width> + <height>400</height> </size> </property> <property name="sizeIncrement"> @@ -705,22 +705,6 @@ </hints> </connection> <connection> - <sender>Waterfall3DAutoScaleBtn</sender> - <signal>clicked()</signal> - <receiver>SpectrumDisplayForm</receiver> - <slot>Waterfall3DAutoScaleBtnCB()</slot> - <hints> - <hint type="sourcelabel"> - <x>22</x> - <y>349</y> - </hint> - <hint type="destinationlabel"> - <x>20</x> - <y>20</y> - </hint> - </hints> - </connection> - <connection> <sender>WaterfallIntensityComboBox</sender> <signal>activated(int)</signal> <receiver>SpectrumDisplayForm</receiver> @@ -737,22 +721,6 @@ </hints> </connection> <connection> - <sender>Waterfall3DIntensityComboBox</sender> - <signal>activated(int)</signal> - <receiver>SpectrumDisplayForm</receiver> - <slot>Waterfall3DIntensityColorTypeChanged(int)</slot> - <hints> - <hint type="sourcelabel"> - <x>92</x> - <y>44</y> - </hint> - <hint type="destinationlabel"> - <x>20</x> - <y>20</y> - </hint> - </hints> - </connection> - <connection> <sender>SpectrumTypeTab</sender> <signal>currentChanged(int)</signal> <receiver>SpectrumDisplayForm</receiver> diff --git a/gr-qtgui/src/lib/waterfallGlobalData.cc b/gr-qtgui/lib/waterfallGlobalData.cc index 1ba153f0d2..1ba153f0d2 100644 --- a/gr-qtgui/src/lib/waterfallGlobalData.cc +++ b/gr-qtgui/lib/waterfallGlobalData.cc diff --git a/gr-qtgui/src/lib/waterfallGlobalData.h b/gr-qtgui/lib/waterfallGlobalData.h index 51f65064c8..51f65064c8 100644 --- a/gr-qtgui/src/lib/waterfallGlobalData.h +++ b/gr-qtgui/lib/waterfallGlobalData.h diff --git a/gr-qtgui/src/python/.gitignore b/gr-qtgui/python/.gitignore index 604b402c56..604b402c56 100644 --- a/gr-qtgui/src/python/.gitignore +++ b/gr-qtgui/python/.gitignore diff --git a/gr-qtgui/src/python/Makefile.am b/gr-qtgui/python/Makefile.am index 0953a71e54..f1bdf359be 100644 --- a/gr-qtgui/src/python/Makefile.am +++ b/gr-qtgui/python/Makefile.am @@ -22,8 +22,7 @@ include $(top_srcdir)/Makefile.common TESTS = -EXTRA_DIST += run_tests.in \ - qt_digital_window.ui +EXTRA_DIST += run_tests.in if PYTHON TESTS += run_tests @@ -32,12 +31,6 @@ DISTCLEANFILES += run_tests qtguipythondir = $(grpythondir)/qtgui noinst_PYTHON = \ - pyqt_example_f.py \ - pyqt_example.py \ - qt_digital.py \ - qt_digital_window.py \ - usrp2_display.py \ - usrp_display.py \ qa_qtgui.py qtguipython_PYTHON = \ diff --git a/gr-qtgui/python/__init__.py b/gr-qtgui/python/__init__.py new file mode 100644 index 0000000000..db113bbd3f --- /dev/null +++ b/gr-qtgui/python/__init__.py @@ -0,0 +1,25 @@ +# +# 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. +# + +# The presence of this file turns this directory into a Python package + +from qtgui_swig import * +import qtgui_swig as qtgui # to preserve the old interface diff --git a/gr-qtgui/src/python/qa_qtgui.py b/gr-qtgui/python/qa_qtgui.py index fbf0de46e3..9cafd45507 100755 --- a/gr-qtgui/src/python/qa_qtgui.py +++ b/gr-qtgui/python/qa_qtgui.py @@ -21,9 +21,7 @@ # from gnuradio import gr, gr_unittest -import qtgui -from PyQt4 import QtGui, QtCore -import sys, sip +import qtgui_swig class test_qtgui(gr_unittest.TestCase): @@ -34,12 +32,16 @@ class test_qtgui(gr_unittest.TestCase): self.tb = None def test01 (self): - pass - # Test to make sure we can instantiate these - #self.qapp = QtGui.QApplication(sys.argv) - #self.qtsnk = qtgui.sink_c(1024, gr.firdes.WIN_BLACKMAN_hARRIS, - # 0, 1, "Test", - # True, True, False, True, True) + # Test to make sure we can instantiate the sink + self.qtsnk = qtgui_swig.sink_c(1024, gr.firdes.WIN_BLACKMAN_hARRIS, + 0, 1, "Test", + True, True, True, True) + + def test02 (self): + # Test to make sure we can instantiate the sink + self.qtsnk = qtgui_swig.sink_f(1024, gr.firdes.WIN_BLACKMAN_hARRIS, + 0, 1, "Test", + True, True, True, True) if __name__ == '__main__': diff --git a/gr-qtgui/src/python/run_tests.in b/gr-qtgui/python/run_tests.in index 9091947526..9091947526 100644 --- a/gr-qtgui/src/python/run_tests.in +++ b/gr-qtgui/python/run_tests.in diff --git a/gr-qtgui/src/.gitignore b/gr-qtgui/src/.gitignore deleted file mode 100644 index b336cc7cec..0000000000 --- a/gr-qtgui/src/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/gr-qtgui/src/lib/qtgui.h b/gr-qtgui/src/lib/qtgui.h deleted file mode 100644 index 9831697ac0..0000000000 --- a/gr-qtgui/src/lib/qtgui.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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. - */ - -#ifndef INCLUDED_QTGUI_H -#define INCLUDED_QTGUI_H - -#include <gruel/thread.h> -#include <qapplication.h> -#include "SpectrumGUIClass.h" - -class qtgui_event : public QEvent -{ -private: - gruel::mutex &d_mutex; - -public: - qtgui_event(gruel::mutex &mutex) - : QEvent((QEvent::Type)(QEvent::User+101)), - d_mutex(mutex) - { - //nop - } - - void lock() - { - d_mutex.lock(); - } - - void unlock() - { - d_mutex.unlock(); - } -}; - -class qtgui_obj : public QObject -{ -public: - qtgui_obj(QObject *p) - : QObject(p) - { - } - - void customEvent(QEvent *e) - { - if(e->type() == (QEvent::Type)(QEvent::User+101)) { - qtgui_event *qt = (qtgui_event*)e; - qt->unlock(); - } - } -}; - -#endif /* INCLUDED_QTGUI_H */ diff --git a/gr-qtgui/src/python/__init__.py b/gr-qtgui/src/python/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/gr-qtgui/src/python/__init__.py +++ /dev/null diff --git a/gr-qtgui/swig/.gitignore b/gr-qtgui/swig/.gitignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/gr-qtgui/swig/.gitignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/gr-qtgui/swig/Makefile.am b/gr-qtgui/swig/Makefile.am new file mode 100644 index 0000000000..4608687014 --- /dev/null +++ b/gr-qtgui/swig/Makefile.am @@ -0,0 +1,53 @@ +# +# Copyright 2004,2005,2006,2008,2009,2010 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 +include $(top_srcdir)/Makefile.swig + +TESTS = +EXTRA_DIST += $(nobase_guile_DATA) + +AM_CPPFLAGS = \ + -I$(top_srcdir)/gr-qtgui/lib \ + -I$(top_builddir)/gr-qtgui/lib \ + $(STD_DEFINES_AND_INCLUDES) \ + $(PYTHON_CPPFLAGS) \ + $(QT_INCLUDES) \ + $(WITH_INCLUDES) + +############################## +# SWIG interface and library +TOP_SWIG_IFILES = \ + qtgui_swig.i + +# Install so that they end up available as: +# import gnuradio.qtgui +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio/qtgui +qtgui_swig_pythondir_category = \ + gnuradio/qtgui + +# additional libraries for linking with the SWIG-generated library +qtgui_swig_la_swig_libadd = \ + $(abs_top_builddir)/gr-qtgui/lib/libgnuradio-qtgui.la + +# additional SWIG files to be installed +qtgui_swig_swiginclude_headers = diff --git a/gr-qtgui/src/lib/Makefile.swig.gen b/gr-qtgui/swig/Makefile.swig.gen index 9c4c0b58cf..3659601c33 100644 --- a/gr-qtgui/src/lib/Makefile.swig.gen +++ b/gr-qtgui/swig/Makefile.swig.gen @@ -20,37 +20,37 @@ # Boston, MA 02110-1301, USA. # -# Makefile.swig.gen for qtgui.i +# Makefile.swig.gen for qtgui_swig.i ## Default install locations for these files: ## ## Default location for the Python directory is: -## ${prefix}/lib/python${python_version}/site-packages/[category]/qtgui +## ${prefix}/lib/python${python_version}/site-packages/[category]/qtgui_swig ## Default location for the Python exec directory is: -## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/qtgui +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/qtgui_swig ## ## The following can be overloaded to change the install location, but ## this has to be done in the including Makefile.am -before- ## Makefile.swig is included. -qtgui_pythondir_category ?= gnuradio/qtgui -qtgui_pylibdir_category ?= $(qtgui_pythondir_category) -qtgui_pythondir = $(pythondir)/$(qtgui_pythondir_category) -qtgui_pylibdir = $(pyexecdir)/$(qtgui_pylibdir_category) +qtgui_swig_pythondir_category ?= gnuradio/qtgui_swig +qtgui_swig_pylibdir_category ?= $(qtgui_swig_pythondir_category) +qtgui_swig_pythondir = $(pythondir)/$(qtgui_swig_pythondir_category) +qtgui_swig_pylibdir = $(pyexecdir)/$(qtgui_swig_pylibdir_category) # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -qtgui_scmlibdir = $(libdir) +qtgui_swig_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile -# is installed, usually /usr/share/guile/site/qtgui +# is installed, usually /usr/share/guile/site/qtgui_swig # FIXME: determince whether these should be installed with gnuradio. -qtgui_scmdir = $(guiledir) +qtgui_swig_scmdir = $(guiledir) ## SWIG headers are always installed into the same directory. -qtgui_swigincludedir = $(swigincludedir) +qtgui_swig_swigincludedir = $(swigincludedir) ## This is a template file for a "generated" Makefile addition (in ## this case, "Makefile.swig.gen"). By including the top-level @@ -75,70 +75,70 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## Makefile.am by setting the variable value there, then including ## Makefile.swig . -qtgui_swiginclude_HEADERS = \ - qtgui.i \ - $(qtgui_swiginclude_headers) +qtgui_swig_swiginclude_HEADERS = \ + qtgui_swig.i \ + $(qtgui_swig_swiginclude_headers) if PYTHON -qtgui_pylib_LTLIBRARIES = \ - _qtgui.la +qtgui_swig_pylib_LTLIBRARIES = \ + _qtgui_swig.la -_qtgui_la_SOURCES = \ - python/qtgui.cc \ - $(qtgui_la_swig_sources) +_qtgui_swig_la_SOURCES = \ + python/qtgui_swig.cc \ + $(qtgui_swig_la_swig_sources) -qtgui_python_PYTHON = \ - qtgui.py \ - $(qtgui_python) +qtgui_swig_python_PYTHON = \ + qtgui_swig.py \ + $(qtgui_swig_python) -_qtgui_la_LIBADD = \ +_qtgui_swig_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ - $(qtgui_la_swig_libadd) + $(qtgui_swig_la_swig_libadd) -_qtgui_la_LDFLAGS = \ +_qtgui_swig_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ - $(qtgui_la_swig_ldflags) + $(qtgui_swig_la_swig_ldflags) -_qtgui_la_CXXFLAGS = \ +_qtgui_swig_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ -I$(top_builddir) \ - $(qtgui_la_swig_cxxflags) + $(qtgui_swig_la_swig_cxxflags) -python/qtgui.cc: qtgui.py -qtgui.py: qtgui.i +python/qtgui_swig.cc: qtgui_swig.py +qtgui_swig.py: qtgui_swig.i # Include the python dependencies for this file --include python/qtgui.d +-include python/qtgui_swig.d endif # end of if python if GUILE -qtgui_scmlib_LTLIBRARIES = \ - libguile-gnuradio-qtgui.la -libguile_gnuradio_qtgui_la_SOURCES = \ - guile/qtgui.cc \ - $(qtgui_la_swig_sources) -nobase_qtgui_scm_DATA = \ - gnuradio/qtgui.scm \ - gnuradio/qtgui-primitive.scm -libguile_gnuradio_qtgui_la_LIBADD = \ +qtgui_swig_scmlib_LTLIBRARIES = \ + libguile-gnuradio-qtgui_swig.la +libguile_gnuradio_qtgui_swig_la_SOURCES = \ + guile/qtgui_swig.cc \ + $(qtgui_swig_la_swig_sources) +nobase_qtgui_swig_scm_DATA = \ + gnuradio/qtgui_swig.scm \ + gnuradio/qtgui_swig-primitive.scm +libguile_gnuradio_qtgui_swig_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ - $(qtgui_la_swig_libadd) -libguile_gnuradio_qtgui_la_LDFLAGS = \ + $(qtgui_swig_la_swig_libadd) +libguile_gnuradio_qtgui_swig_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ - $(qtgui_la_swig_ldflags) -libguile_gnuradio_qtgui_la_CXXFLAGS = \ + $(qtgui_swig_la_swig_ldflags) +libguile_gnuradio_qtgui_swig_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ -I$(top_builddir) \ - $(qtgui_la_swig_cxxflags) + $(qtgui_swig_la_swig_cxxflags) -guile/qtgui.cc: gnuradio/qtgui.scm -gnuradio/qtgui.scm: qtgui.i -gnuradio/qtgui-primitive.scm: gnuradio/qtgui.scm +guile/qtgui_swig.cc: gnuradio/qtgui_swig.scm +gnuradio/qtgui_swig.scm: qtgui_swig.i +gnuradio/qtgui_swig-primitive.scm: gnuradio/qtgui_swig.scm # Include the guile dependencies for this file --include guile/qtgui.d +-include guile/qtgui_swig.d endif # end of GUILE diff --git a/gr-qtgui/src/Makefile.am b/gr-qtgui/swig/__init__.py index 52b06fbc45..3986f25133 100644 --- a/gr-qtgui/src/Makefile.am +++ b/gr-qtgui/swig/__init__.py @@ -1,5 +1,5 @@ # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -19,7 +19,6 @@ # Boston, MA 02110-1301, USA. # -SUBDIRS = lib -if PYTHON -SUBDIRS += python -endif +# The presence of this file turns this directory into a Python package + +from qtgui_swig import * diff --git a/gr-qtgui/src/lib/qtgui.i b/gr-qtgui/swig/qtgui_swig.i index bb64c6ae2c..c471bb09c5 100644 --- a/gr-qtgui/src/lib/qtgui.i +++ b/gr-qtgui/swig/qtgui_swig.i @@ -33,9 +33,7 @@ GR_SWIG_BLOCK_MAGIC(qtgui,sink_c) double fc=0, double bw=1.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, + bool plottime=true, bool plotconst=true, QWidget *parent=NULL); class qtgui_sink_c : public gr_block @@ -45,17 +43,13 @@ private: double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, - bool plotwaterfall3d, bool plottime, - bool plotconst, - bool use_openGL, + bool plottime, bool plotconst, QWidget *parent); qtgui_sink_c (int fftsize, int wintype, double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, - bool plotwaterfall3d, bool plottime, - bool plotconst, - bool use_openGL, + bool plottime, bool plotconst, QWidget *parent); public: @@ -69,6 +63,7 @@ public: double ymin, double ymax); void set_frequency_axis(double min, double max); void set_constellation_pen_size(int size); + void set_update_time(double t); }; @@ -82,9 +77,7 @@ qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, int wintype, 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, + bool plottime=true, bool plotconst=true, QWidget *parent=NULL); class qtgui_sink_f : public gr_block @@ -94,17 +87,13 @@ private: double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, - bool plotwaterfall3d, bool plottime, - bool plotconst, - bool use_openGL, + bool plottime, bool plotconst, QWidget *parent); qtgui_sink_f (int fftsize, int wintype, double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, - bool plotwaterfall3d, bool plottime, - bool plotconst, - bool use_openGL, + bool plottime, bool plotconst, QWidget *parent); public: @@ -118,11 +107,12 @@ public: double ymin, double ymax); void set_frequency_axis(double min, double max); void set_constellation_pen_size(int size); + void set_update_time(double t); }; #if SWIGGUILE %scheme %{ -(load-extension-global "libguile-gnuradio-qtgui" "scm_init_gnuradio_qtgui_module") +(load-extension-global "libguile-gnuradio-qtgui_swig" "scm_init_gnuradio_qtgui_swig_module") %} %goops %{ |