diff options
-rw-r--r-- | config/grc_gr_qtgui.m4 | 14 | ||||
-rw-r--r-- | gr-qtgui/Makefile.am | 11 | ||||
-rw-r--r-- | gr-qtgui/apps/.gitignore | 2 | ||||
-rw-r--r-- | gr-qtgui/apps/Makefile.am | 45 | ||||
-rwxr-xr-x | gr-qtgui/apps/pyqt_example_c.py (renamed from gr-qtgui/src/python/pyqt_example.py) | 14 | ||||
-rwxr-xr-x | gr-qtgui/apps/pyqt_example_f.py (renamed from gr-qtgui/src/python/pyqt_example_f.py) | 9 | ||||
-rwxr-xr-x | gr-qtgui/apps/qt_digital.py (renamed from gr-qtgui/src/python/qt_digital.py) | 2 | ||||
-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) | 0 | ||||
-rwxr-xr-x | gr-qtgui/apps/usrp_display.py (renamed from gr-qtgui/src/python/usrp_display.py) | 0 | ||||
-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/lib/.gitignore (renamed from gr-qtgui/src/lib/.gitignore) | 0 | ||||
-rw-r--r-- | gr-qtgui/lib/ConstellationDisplayPlot.cc (renamed from gr-qtgui/src/lib/ConstellationDisplayPlot.cc) | 0 | ||||
-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) | 0 | ||||
-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) | 4 | ||||
-rw-r--r-- | gr-qtgui/lib/SpectrumGUIClass.cc (renamed from gr-qtgui/src/lib/SpectrumGUIClass.cc) | 96 | ||||
-rw-r--r-- | gr-qtgui/lib/SpectrumGUIClass.h (renamed from gr-qtgui/src/lib/SpectrumGUIClass.h) | 24 | ||||
-rw-r--r-- | gr-qtgui/lib/TimeDomainDisplayPlot.cc (renamed from gr-qtgui/src/lib/TimeDomainDisplayPlot.cc) | 0 | ||||
-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.h (renamed from gr-qtgui/src/lib/qtgui.h) | 6 | ||||
-rw-r--r-- | gr-qtgui/lib/qtgui_sink_c.cc (renamed from gr-qtgui/src/lib/qtgui_sink_c.cc) | 16 | ||||
-rw-r--r-- | gr-qtgui/lib/qtgui_sink_c.h (renamed from gr-qtgui/src/lib/qtgui_sink_c.h) | 2 | ||||
-rw-r--r-- | gr-qtgui/lib/qtgui_sink_f.cc (renamed from gr-qtgui/src/lib/qtgui_sink_f.cc) | 0 | ||||
-rw-r--r-- | gr-qtgui/lib/qtgui_sink_f.h (renamed from gr-qtgui/src/lib/qtgui_sink_f.h) | 0 | ||||
-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) | 5 | ||||
-rw-r--r-- | gr-qtgui/lib/spectrumdisplayform.h (renamed from gr-qtgui/src/lib/spectrumdisplayform.h) | 0 | ||||
-rw-r--r-- | gr-qtgui/lib/spectrumdisplayform.ui (renamed from gr-qtgui/src/lib/spectrumdisplayform.ui) | 0 | ||||
-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) | 8 | ||||
-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/python/__init__.py | 0 | ||||
-rw-r--r-- | gr-qtgui/swig/.gitignore | 2 | ||||
-rw-r--r-- | gr-qtgui/swig/Makefile.am | 65 | ||||
-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/gnuradio/qtgui.scm | 28 | ||||
-rw-r--r-- | gr-qtgui/swig/qtgui.test | 36 | ||||
-rw-r--r-- | gr-qtgui/swig/qtgui_swig.i (renamed from gr-qtgui/src/lib/qtgui.i) | 2 | ||||
-rw-r--r-- | gr-qtgui/swig/run_guile_tests.in | 14 |
56 files changed, 390 insertions, 173 deletions
diff --git a/config/grc_gr_qtgui.m4 b/config/grc_gr_qtgui.m4 index aa9646b3c..a5eac6293 100644 --- a/config/grc_gr_qtgui.m4 +++ b/config/grc_gr_qtgui.m4 @@ -81,16 +81,20 @@ 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 \ + gr-qtgui/swig/run_guile_tests \ ]) 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 + chmod +x gr-qtgui/swig/run_guile_tests]) ]) ]) diff --git a/gr-qtgui/Makefile.am b/gr-qtgui/Makefile.am index e794266cb..cc194e4c0 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 000000000..282522db0 --- /dev/null +++ b/gr-qtgui/apps/.gitignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in 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/src/python/pyqt_example.py b/gr-qtgui/apps/pyqt_example_c.py index 7c0cfc698..6625857a5 100755 --- a/gr-qtgui/src/python/pyqt_example.py +++ b/gr-qtgui/apps/pyqt_example_c.py @@ -1,10 +1,15 @@ #!/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 +import os +print os.getpid() +raw_input() + + class dialog_box(QtGui.QWidget): def __init__(self, display, control): QtGui.QWidget.__init__(self, None) @@ -28,11 +33,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 +47,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()'), @@ -140,5 +150,5 @@ class my_top_block(gr.top_block): 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 4e36ccca5..55d987329 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()'), @@ -139,5 +144,5 @@ class my_top_block(gr.top_block): 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 679f144ef..7b9e9b773 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 diff --git a/gr-qtgui/src/python/qt_digital_window.py b/gr-qtgui/apps/qt_digital_window.py index 50dd53a92..50dd53a92 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 967252181..967252181 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 75d374c2b..75d374c2b 100755 --- a/gr-qtgui/src/python/usrp2_display.py +++ b/gr-qtgui/apps/usrp2_display.py diff --git a/gr-qtgui/src/python/usrp_display.py b/gr-qtgui/apps/usrp_display.py index 432e74d9a..432e74d9a 100755 --- a/gr-qtgui/src/python/usrp_display.py +++ b/gr-qtgui/apps/usrp_display.py diff --git a/gr-qtgui/src/python/usrp_display_qtgui.py b/gr-qtgui/apps/usrp_display_qtgui.py index 4c9de3a53..4c9de3a53 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 e88ca9dce..e88ca9dce 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 000000000..27b6a21bf --- /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/src/lib/.gitignore b/gr-qtgui/lib/.gitignore index 61b9ca8c1..61b9ca8c1 100644 --- a/gr-qtgui/src/lib/.gitignore +++ b/gr-qtgui/lib/.gitignore diff --git a/gr-qtgui/src/lib/ConstellationDisplayPlot.cc b/gr-qtgui/lib/ConstellationDisplayPlot.cc index 9ad5bdd3c..9ad5bdd3c 100644 --- a/gr-qtgui/src/lib/ConstellationDisplayPlot.cc +++ b/gr-qtgui/lib/ConstellationDisplayPlot.cc diff --git a/gr-qtgui/src/lib/ConstellationDisplayPlot.h b/gr-qtgui/lib/ConstellationDisplayPlot.h index a441a8bfe..a441a8bfe 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 d150e2e4c..d150e2e4c 100644 --- a/gr-qtgui/src/lib/FrequencyDisplayPlot.cc +++ b/gr-qtgui/lib/FrequencyDisplayPlot.cc diff --git a/gr-qtgui/src/lib/FrequencyDisplayPlot.h b/gr-qtgui/lib/FrequencyDisplayPlot.h index 3c22c1397..3c22c1397 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 446a07fd0..687a4f966 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 @@ -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 052730fc2..c62f34290 100644 --- a/gr-qtgui/src/lib/SpectrumGUIClass.cc +++ b/gr-qtgui/lib/SpectrumGUIClass.cc @@ -37,15 +37,13 @@ SpectrumGUIClass::SpectrumGUIClass(const uint64_t maxDataSize, _windowOpennedFlag = false; _fftBuffersCreatedFlag = false; - // Create Mutex Lock - //_windowStateLock = new MutexClass("_windowStateLock"); - _powerValue = 1; } SpectrumGUIClass::~SpectrumGUIClass() { if(GetWindowOpenFlag()){ + printf("spectrumDisplayForm: %p\n", _spectrumDisplayForm); delete _spectrumDisplayForm; } @@ -54,8 +52,6 @@ SpectrumGUIClass::~SpectrumGUIClass() delete[] _realTimeDomainPoints; delete[] _imagTimeDomainPoints; } - - //delete _windowStateLock; } void @@ -64,7 +60,7 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, const bool time, const bool constellation, const bool use_openGL) { - //_windowStateLock->Lock(); + d_mutex.lock(); if(!_windowOpennedFlag){ @@ -82,6 +78,7 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, // Called from the Event Thread _spectrumDisplayForm = new SpectrumDisplayForm(use_openGL, parent); + printf("spectrumDisplayForm: %p\n", _spectrumDisplayForm); // 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,7 +101,7 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent, qApp->postEvent(_spectrumDisplayForm, new QEvent(QEvent::Type(QEvent::User+3))); - qApp->processEvents(); + //qApp->processEvents(); timespec_reset(&_lastGUIUpdateTime); @@ -147,10 +144,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 +154,8 @@ SpectrumGUIClass::GetWindowOpenFlag() void SpectrumGUIClass::SetWindowOpenFlag(const bool newFlag) { - //_windowStateLock->Lock(); + gruel::scoped_lock lock(d_mutex); _windowOpennedFlag = newFlag; - //_windowStateLock->Unlock(); } void @@ -168,7 +163,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 +171,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 +212,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 +294,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 +352,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 +423,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 +438,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 57a749a6a..8ffb411b8 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> @@ -39,9 +37,9 @@ public: 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 +47,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 +82,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 9c98cec5b..9c98cec5b 100644 --- a/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc +++ b/gr-qtgui/lib/TimeDomainDisplayPlot.cc diff --git a/gr-qtgui/src/lib/TimeDomainDisplayPlot.h b/gr-qtgui/lib/TimeDomainDisplayPlot.h index 952b5c8cf..952b5c8cf 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 a8e5361e7..08a71c023 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 6b4e978bb..6b4e978bb 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 251bbad8b..251bbad8b 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 2b1447e03..2b1447e03 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 a11461611..a11461611 100644 --- a/gr-qtgui/src/lib/plot_waterfall.h +++ b/gr-qtgui/lib/plot_waterfall.h diff --git a/gr-qtgui/src/lib/qtgui.h b/gr-qtgui/lib/qtgui.h index 9831697ac..27279e5cd 100644 --- a/gr-qtgui/src/lib/qtgui.h +++ b/gr-qtgui/lib/qtgui.h @@ -40,6 +40,8 @@ public: //nop } + ~qtgui_event() {} + void lock() { d_mutex.lock(); @@ -58,7 +60,9 @@ public: : QObject(p) { } - + + ~qtgui_obj() {} + void customEvent(QEvent *e) { if(e->type() == (QEvent::Type)(QEvent::User+101)) { diff --git a/gr-qtgui/src/lib/qtgui_sink_c.cc b/gr-qtgui/lib/qtgui_sink_c.cc index 05c7b28d5..405971aa0 100644 --- a/gr-qtgui/src/lib/qtgui_sink_c.cc +++ b/gr-qtgui/lib/qtgui_sink_c.cc @@ -71,8 +71,8 @@ qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype, fprintf(stderr, "Warning: plotting Waterfall3D has been removed; enabling plotwaterfall3d has no effect.\n"); } + gruel::scoped_lock lock(d_mutex); d_main_gui = NULL; - lock(); // Perform fftshift operation; // this is usually desired when plotting @@ -93,6 +93,7 @@ qtgui_sink_c::~qtgui_sink_c() delete d_main_gui; delete [] d_residbuf; delete d_fft; + delete d_object; } void @@ -104,17 +105,6 @@ 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) { @@ -122,7 +112,7 @@ qtgui_sink_c::initialize(const bool opengl) d_qApplication = qApp; } else { - int argc; + int argc=0; char **argv = NULL; d_qApplication = new QApplication(argc, argv); } diff --git a/gr-qtgui/src/lib/qtgui_sink_c.h b/gr-qtgui/lib/qtgui_sink_c.h index bbf9983b0..bcdcf65ae 100644 --- a/gr-qtgui/src/lib/qtgui_sink_c.h +++ b/gr-qtgui/lib/qtgui_sink_c.h @@ -99,8 +99,6 @@ private: public: ~qtgui_sink_c(); void exec_(); - void lock(); - void unlock(); QWidget* qwidget(); PyObject* pyqwidget(); diff --git a/gr-qtgui/src/lib/qtgui_sink_f.cc b/gr-qtgui/lib/qtgui_sink_f.cc index 984c2803c..984c2803c 100644 --- a/gr-qtgui/src/lib/qtgui_sink_f.cc +++ b/gr-qtgui/lib/qtgui_sink_f.cc diff --git a/gr-qtgui/src/lib/qtgui_sink_f.h b/gr-qtgui/lib/qtgui_sink_f.h index d80a6a198..d80a6a198 100644 --- a/gr-qtgui/src/lib/qtgui_sink_f.h +++ b/gr-qtgui/lib/qtgui_sink_f.h diff --git a/gr-qtgui/src/lib/spectrumUpdateEvents.cc b/gr-qtgui/lib/spectrumUpdateEvents.cc index 53a205fb7..53a205fb7 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 ccc072c3e..ccc072c3e 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 e0509a294..d85637a67 100644 --- a/gr-qtgui/src/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -74,6 +74,11 @@ SpectrumDisplayForm::~SpectrumDisplayForm() delete[] _realFFTDataPoints; delete[] _averagedValues; + //delete _frequencyDisplayPlot; + //delete _waterfallDisplayPlot; + //delete _timeDomainDisplayPlot; + //delete _constellationDisplayPlot; + for(unsigned int count = 0; count < _historyVector->size(); count++){ delete[] _historyVector->operator[](count); } diff --git a/gr-qtgui/src/lib/spectrumdisplayform.h b/gr-qtgui/lib/spectrumdisplayform.h index fbd08349b..fbd08349b 100644 --- a/gr-qtgui/src/lib/spectrumdisplayform.h +++ b/gr-qtgui/lib/spectrumdisplayform.h diff --git a/gr-qtgui/src/lib/spectrumdisplayform.ui b/gr-qtgui/lib/spectrumdisplayform.ui index 5a23bc8a9..5a23bc8a9 100644 --- a/gr-qtgui/src/lib/spectrumdisplayform.ui +++ b/gr-qtgui/lib/spectrumdisplayform.ui diff --git a/gr-qtgui/src/lib/waterfallGlobalData.cc b/gr-qtgui/lib/waterfallGlobalData.cc index 1ba153f0d..1ba153f0d 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 51f65064c..51f65064c 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 604b402c5..604b402c5 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 0953a71e5..f1bdf359b 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 000000000..db113bbd3 --- /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 fbf0de46e..7d3cf8098 100755 --- a/gr-qtgui/src/python/qa_qtgui.py +++ b/gr-qtgui/python/qa_qtgui.py @@ -21,7 +21,7 @@ # from gnuradio import gr, gr_unittest -import qtgui +import qtgui_swig from PyQt4 import QtGui, QtCore import sys, sip @@ -37,9 +37,9 @@ class test_qtgui(gr_unittest.TestCase): 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) + #self.qtsnk = qtgui_swig.sink_c(1024, gr.firdes.WIN_BLACKMAN_hARRIS, + # 0, 1, "Test", + # True, True, False, True, True) if __name__ == '__main__': diff --git a/gr-qtgui/src/python/run_tests.in b/gr-qtgui/python/run_tests.in index 909194752..909194752 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 b336cc7ce..000000000 --- a/gr-qtgui/src/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/gr-qtgui/src/python/__init__.py b/gr-qtgui/src/python/__init__.py deleted file mode 100644 index e69de29bb..000000000 --- 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 000000000..282522db0 --- /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 000000000..ab1acce71 --- /dev/null +++ b/gr-qtgui/swig/Makefile.am @@ -0,0 +1,65 @@ +# +# 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) + +if GUILE +nobase_guile_DATA = \ + gnuradio/qtgui.scm +endif + +noinst_GUILE = qtgui.test + + +############################## +# 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 = + +if GUILE +TESTS += run_guile_tests +endif
\ No newline at end of file diff --git a/gr-qtgui/src/lib/Makefile.swig.gen b/gr-qtgui/swig/Makefile.swig.gen index 9c4c0b58c..3659601c3 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 52b06fbc4..3986f2513 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/swig/gnuradio/qtgui.scm b/gr-qtgui/swig/gnuradio/qtgui.scm new file mode 100644 index 000000000..fc650d022 --- /dev/null +++ b/gr-qtgui/swig/gnuradio/qtgui.scm @@ -0,0 +1,28 @@ +;;; +;;; 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 this program. If not, see <http://www.gnu.org/licenses/>. +;;; + +;;; Module that just re-exports the qtgui_swig module + +(define-module (gnuradio qtgui) + #:use-module (gnuradio export-safely) + #:use-module (gnuradio qtgui_swig) + #:duplicates (merge-generics replace check)) + +(re-export-all '(gnuradio qtgui_swig)) + diff --git a/gr-qtgui/swig/qtgui.test b/gr-qtgui/swig/qtgui.test new file mode 100644 index 000000000..956a97df9 --- /dev/null +++ b/gr-qtgui/swig/qtgui.test @@ -0,0 +1,36 @@ +;;; -*- Scheme -*- +;;; +;;; 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 this program. If not, see <http://www.gnu.org/licenses/>. +;;; + +;;; If you're using Emacs's Scheme mode: +;;; (put 'with-test-prefix 'scheme-indent-function 1) + +;;; See the comments in gnuradio/test-suite/lib.scm for info on writing tests. +;;; See also the very end of the file, where the test-equal, test-eqv +;;; and test-eq macros are defined. + +(define-module (test-module) + #:use-module (oop goops) + #:use-module (gnuradio core) + #:use-module (gnuradio test-suite lib) + #:duplicates (merge-generics replace check)) + +;;; Confirm we can import the module... +(use-modules (gnuradio qtgui)) + diff --git a/gr-qtgui/src/lib/qtgui.i b/gr-qtgui/swig/qtgui_swig.i index bb64c6ae2..ba97b4e9a 100644 --- a/gr-qtgui/src/lib/qtgui.i +++ b/gr-qtgui/swig/qtgui_swig.i @@ -122,7 +122,7 @@ public: #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 %{ diff --git a/gr-qtgui/swig/run_guile_tests.in b/gr-qtgui/swig/run_guile_tests.in new file mode 100644 index 000000000..5d08b0dd5 --- /dev/null +++ b/gr-qtgui/swig/run_guile_tests.in @@ -0,0 +1,14 @@ +#!/bin/sh + +. @top_builddir@/setup_guile_test_env + +# 1st argument is absolute path to hand coded guile source directory +# 2nd argument is absolute path to component C++ shared library build directory +# 3nd argument is absolute path to component SWIG build directory + +add_local_paths \ + @srcdir@ \ + @abs_builddir@ \ + @abs_builddir@ + +@GUILE@ -e main -c '(use-modules (gnuradio test-suite guile-test))' -t @srcdir@ |