summaryrefslogtreecommitdiff
path: root/gr-wxgui
diff options
context:
space:
mode:
Diffstat (limited to 'gr-wxgui')
-rw-r--r--gr-wxgui/CMakeLists.txt26
-rw-r--r--gr-wxgui/gr-wxgui.pc.in2
-rw-r--r--gr-wxgui/grc/panel.py16
-rw-r--r--gr-wxgui/grc/top_block_gui.py26
-rw-r--r--gr-wxgui/grc/wxgui_constellationsink2.xml1
-rw-r--r--gr-wxgui/grc/wxgui_fftsink2.xml3
-rw-r--r--gr-wxgui/grc/wxgui_histosink2.xml1
-rw-r--r--gr-wxgui/grc/wxgui_numbersink2.xml1
-rw-r--r--gr-wxgui/grc/wxgui_scopesink2.xml10
-rw-r--r--gr-wxgui/grc/wxgui_termsink.xml1
-rw-r--r--gr-wxgui/grc/wxgui_waterfallsink2.xml3
-rw-r--r--gr-wxgui/include/gnuradio/wxgui/CMakeLists.txt32
-rw-r--r--gr-wxgui/include/gnuradio/wxgui/api.h33
-rw-r--r--gr-wxgui/include/gnuradio/wxgui/histo_sink_f.h55
-rw-r--r--gr-wxgui/include/gnuradio/wxgui/oscope_guts.h131
-rw-r--r--gr-wxgui/include/gnuradio/wxgui/oscope_sink_f.h53
-rw-r--r--gr-wxgui/include/gnuradio/wxgui/oscope_sink_x.h91
-rw-r--r--gr-wxgui/include/gnuradio/wxgui/trigger_mode.h44
-rw-r--r--gr-wxgui/lib/CMakeLists.txt77
-rw-r--r--gr-wxgui/lib/gnuradio-wxgui.rc.in54
-rw-r--r--gr-wxgui/lib/histo_sink_f_impl.cc186
-rw-r--r--gr-wxgui/lib/histo_sink_f_impl.h63
-rw-r--r--gr-wxgui/lib/oscope_guts.cc439
-rw-r--r--gr-wxgui/lib/oscope_sink_f_impl.cc83
-rw-r--r--gr-wxgui/lib/oscope_sink_f_impl.h51
-rw-r--r--gr-wxgui/lib/oscope_sink_x.cc161
-rw-r--r--gr-wxgui/python/wxgui/CMakeLists.txt (renamed from gr-wxgui/src/python/CMakeLists.txt)0
-rw-r--r--gr-wxgui/python/wxgui/__init__.py (renamed from gr-wxgui/src/python/__init__.py)5
-rw-r--r--gr-wxgui/python/wxgui/common.py (renamed from gr-wxgui/src/python/common.py)71
-rw-r--r--gr-wxgui/python/wxgui/const_window.py (renamed from gr-wxgui/src/python/const_window.py)8
-rw-r--r--gr-wxgui/python/wxgui/constants.py (renamed from gr-wxgui/src/python/constants.py)0
-rw-r--r--gr-wxgui/python/wxgui/constsink_gl.py (renamed from gr-wxgui/src/python/constsink_gl.py)10
-rw-r--r--gr-wxgui/python/wxgui/fft_window.py (renamed from gr-wxgui/src/python/fft_window.py)8
-rw-r--r--gr-wxgui/python/wxgui/fftsink2.py (renamed from gr-wxgui/src/python/fftsink2.py)0
-rw-r--r--gr-wxgui/python/wxgui/fftsink_gl.py (renamed from gr-wxgui/src/python/fftsink_gl.py)57
-rw-r--r--gr-wxgui/python/wxgui/fftsink_nongl.py (renamed from gr-wxgui/src/python/fftsink_nongl.py)69
-rw-r--r--gr-wxgui/python/wxgui/form.py (renamed from gr-wxgui/src/python/form.py)0
-rw-r--r--gr-wxgui/python/wxgui/forms/__init__.py (renamed from gr-wxgui/src/python/forms/__init__.py)37
-rw-r--r--gr-wxgui/python/wxgui/forms/converters.py (renamed from gr-wxgui/src/python/forms/converters.py)0
-rw-r--r--gr-wxgui/python/wxgui/forms/forms.py (renamed from gr-wxgui/src/python/forms/forms.py)296
-rw-r--r--gr-wxgui/python/wxgui/gui.py (renamed from gr-wxgui/src/python/gui.py)0
-rw-r--r--gr-wxgui/python/wxgui/histo_window.py (renamed from gr-wxgui/src/python/histo_window.py)8
-rw-r--r--gr-wxgui/python/wxgui/histosink_gl.py (renamed from gr-wxgui/src/python/histosink_gl.py)25
-rw-r--r--gr-wxgui/python/wxgui/number_window.py (renamed from gr-wxgui/src/python/number_window.py)12
-rw-r--r--gr-wxgui/python/wxgui/numbersink2.py (renamed from gr-wxgui/src/python/numbersink2.py)60
-rw-r--r--gr-wxgui/python/wxgui/plot.py (renamed from gr-wxgui/src/python/plot.py)0
-rw-r--r--gr-wxgui/python/wxgui/plotter/__init__.py (renamed from gr-wxgui/src/python/plotter/__init__.py)0
-rw-r--r--gr-wxgui/python/wxgui/plotter/bar_plotter.py (renamed from gr-wxgui/src/python/plotter/bar_plotter.py)18
-rw-r--r--gr-wxgui/python/wxgui/plotter/channel_plotter.py (renamed from gr-wxgui/src/python/plotter/channel_plotter.py)34
-rw-r--r--gr-wxgui/python/wxgui/plotter/common.py (renamed from gr-wxgui/src/python/plotter/common.py)34
-rw-r--r--gr-wxgui/python/wxgui/plotter/gltext.py (renamed from gr-wxgui/src/python/plotter/gltext.py)0
-rw-r--r--gr-wxgui/python/wxgui/plotter/grid_plotter_base.py (renamed from gr-wxgui/src/python/plotter/grid_plotter_base.py)106
-rw-r--r--gr-wxgui/python/wxgui/plotter/plotter_base.py (renamed from gr-wxgui/src/python/plotter/plotter_base.py)12
-rw-r--r--gr-wxgui/python/wxgui/plotter/waterfall_plotter.py (renamed from gr-wxgui/src/python/plotter/waterfall_plotter.py)38
-rw-r--r--gr-wxgui/python/wxgui/powermate.py (renamed from gr-wxgui/src/python/powermate.py)0
-rw-r--r--gr-wxgui/python/wxgui/pubsub.py (renamed from gr-wxgui/src/python/pubsub.py)0
-rw-r--r--gr-wxgui/python/wxgui/scope_window.py (renamed from gr-wxgui/src/python/scope_window.py)31
-rw-r--r--gr-wxgui/python/wxgui/scopesink2.py (renamed from gr-wxgui/src/python/scopesink2.py)0
-rw-r--r--gr-wxgui/python/wxgui/scopesink_gl.py (renamed from gr-wxgui/src/python/scopesink_gl.py)42
-rw-r--r--gr-wxgui/python/wxgui/scopesink_nongl.py (renamed from gr-wxgui/src/python/scopesink_nongl.py)451
-rw-r--r--gr-wxgui/python/wxgui/slider.py (renamed from gr-wxgui/src/python/slider.py)9
-rw-r--r--gr-wxgui/python/wxgui/stdgui2.py (renamed from gr-wxgui/src/python/stdgui2.py)0
-rw-r--r--gr-wxgui/python/wxgui/termsink.py (renamed from gr-wxgui/src/python/termsink.py)0
-rw-r--r--gr-wxgui/python/wxgui/waterfall_window.py (renamed from gr-wxgui/src/python/waterfall_window.py)8
-rw-r--r--gr-wxgui/python/wxgui/waterfallsink2.py (renamed from gr-wxgui/src/python/waterfallsink2.py)0
-rw-r--r--gr-wxgui/python/wxgui/waterfallsink_gl.py (renamed from gr-wxgui/src/python/waterfallsink_gl.py)43
-rw-r--r--gr-wxgui/python/wxgui/waterfallsink_nongl.py (renamed from gr-wxgui/src/python/waterfallsink_nongl.py)69
-rw-r--r--gr-wxgui/swig/CMakeLists.txt58
-rw-r--r--gr-wxgui/swig/wxgui_swig.i43
69 files changed, 2599 insertions, 706 deletions
diff --git a/gr-wxgui/CMakeLists.txt b/gr-wxgui/CMakeLists.txt
index 8150c7d802..0006160f8c 100644
--- a/gr-wxgui/CMakeLists.txt
+++ b/gr-wxgui/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -20,10 +20,11 @@
########################################################################
# Setup dependencies
########################################################################
+include(GrBoost)
include(GrPython)
-GR_PYTHON_CHECK_MODULE("wx >= 2.8" wx "wx.version().split()[0] >= '2.8'" WX_FOUND)
-GR_PYTHON_CHECK_MODULE("numpy" numpy True NUMPY_FOUND)
+GR_PYTHON_CHECK_MODULE("wx >= 2.8" wx "wx.version().split()[0] >= '2.8'" WX_FOUND)
+GR_PYTHON_CHECK_MODULE("numpy" numpy True NUMPY_FOUND)
########################################################################
# Register component
@@ -37,7 +38,10 @@ if(NOT CMAKE_CROSSCOMPILING)
endif(NOT CMAKE_CROSSCOMPILING)
GR_REGISTER_COMPONENT("gr-wxgui" ENABLE_GR_WXGUI
- ENABLE_GR_CORE
+ ENABLE_GNURADIO_RUNTIME
+ ENABLE_GR_FFT
+ ENABLE_GR_FILTER
+ ENABLE_GR_ANALOG
ENABLE_PYTHON
${wxgui_python_deps}
)
@@ -47,6 +51,13 @@ GR_REGISTER_COMPONENT("gr-wxgui" ENABLE_GR_WXGUI
########################################################################
if(ENABLE_GR_WXGUI)
+GR_SET_GLOBAL(GR_WXGUI_INCLUDE_DIRS
+ ${CMAKE_CURRENT_SOURCE_DIR}/lib
+ ${CMAKE_CURRENT_SOURCE_DIR}/include
+ ${CMAKE_CURRENT_BINARY_DIR}/lib
+ ${CMAKE_CURRENT_BINARY_DIR}/include
+)
+
########################################################################
# Setup CPack components
########################################################################
@@ -54,7 +65,7 @@ include(GrPackage)
CPACK_COMPONENT("wxgui"
DISPLAY_NAME "WxGUI"
DESCRIPTION "Wx GUI plotter widgets and grc wrappers"
- DEPENDS "core_python"
+ DEPENDS "runtime_python"
)
########################################################################
@@ -83,7 +94,10 @@ install(
########################################################################
# Add subdirectories
########################################################################
+add_subdirectory(include/gnuradio/wxgui)
+add_subdirectory(lib)
add_subdirectory(grc)
-add_subdirectory(src/python)
+add_subdirectory(python/wxgui)
+add_subdirectory(swig)
endif(ENABLE_GR_WXGUI)
diff --git a/gr-wxgui/gr-wxgui.pc.in b/gr-wxgui/gr-wxgui.pc.in
index f713897895..ec4d66c9fc 100644
--- a/gr-wxgui/gr-wxgui.pc.in
+++ b/gr-wxgui/gr-wxgui.pc.in
@@ -5,7 +5,7 @@ includedir=@includedir@
Name: gr-wxgui
Description: A simple wx gui for GNU Radio applications
-Requires: gnuradio-core
+Requires: gnuradio-runtime
Version: @LIBVER@
Libs:
Cflags:
diff --git a/gr-wxgui/grc/panel.py b/gr-wxgui/grc/panel.py
index e62133cac2..9bcb464701 100644
--- a/gr-wxgui/grc/panel.py
+++ b/gr-wxgui/grc/panel.py
@@ -33,17 +33,21 @@ class Panel(wx.Panel):
def Add(self, win):
"""
Add a window to the wx vbox.
- @param win the wx window
+
+ Args:
+ win: the wx window
"""
self._box.Add(win, 0, wx.EXPAND)
def GridAdd(self, win, row, col, row_span=1, col_span=1):
"""
Add a window to the wx grid at the given position.
- @param win the wx window
- @param row the row specification (integer >= 0)
- @param col the column specification (integer >= 0)
- @param row_span the row span specification (integer >= 1)
- @param col_span the column span specification (integer >= 1)
+
+ Args:
+ win: the wx window
+ row: the row specification (integer >= 0)
+ col: the column specification (integer >= 0)
+ row_span: the row span specification (integer >= 1)
+ col_span: the column span specification (integer >= 1)
"""
self._grid.Add(win, wx.GBPosition(row, col), wx.GBSpan(row_span, col_span), wx.EXPAND)
diff --git a/gr-wxgui/grc/top_block_gui.py b/gr-wxgui/grc/top_block_gui.py
index 479f55a302..a0d9f94628 100644
--- a/gr-wxgui/grc/top_block_gui.py
+++ b/gr-wxgui/grc/top_block_gui.py
@@ -31,9 +31,11 @@ class top_block_gui(gr.top_block):
"""
Initialize the gr top block.
Create the wx gui elements.
- @param title the main window title
- @param size the main window size tuple in pixels
- @param icon the file path to an icon or None
+
+ Args:
+ title: the main window title
+ size: the main window size tuple in pixels
+ icon: the file path to an icon or None
"""
#initialize
gr.top_block.__init__(self)
@@ -48,12 +50,7 @@ class top_block_gui(gr.top_block):
def SetIcon(self, *args, **kwargs): self._frame.SetIcon(*args, **kwargs)
- def Run(self, start=True, max_nouts=0):
- """
- Setup the wx gui elements.
- Start the gr top block.
- Block with the wx main loop.
- """
+ def Start(self, start=True, max_nouts=0):
#set minimal window size
self._frame.SetSizeHints(*self._size)
#create callback for quit
@@ -74,5 +71,16 @@ class top_block_gui(gr.top_block):
self.start(max_nouts)
else:
self.start()
+
+ def Run(self, start=True, max_nouts=0):
+ """
+ Setup the wx gui elements.
+ Start the gr top block.
+ Block with the wx main loop.
+ """
#blocking main loop
+ self.Start(start, max_nouts)
+ self._app.MainLoop()
+
+ def Wait(self):
self._app.MainLoop()
diff --git a/gr-wxgui/grc/wxgui_constellationsink2.xml b/gr-wxgui/grc/wxgui_constellationsink2.xml
index 62cadfc9a2..d0314ca547 100644
--- a/gr-wxgui/grc/wxgui_constellationsink2.xml
+++ b/gr-wxgui/grc/wxgui_constellationsink2.xml
@@ -9,6 +9,7 @@
<key>wxgui_constellationsink2</key>
<category>Instrumentation/WX</category>
<import>from gnuradio.wxgui import constsink_gl</import>
+ <import>from gnuradio import wxgui</import>
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
constsink_gl.const_sink_c(
$(parent).GetWin(),
diff --git a/gr-wxgui/grc/wxgui_fftsink2.xml b/gr-wxgui/grc/wxgui_fftsink2.xml
index 4a6237143b..5f82670ac5 100644
--- a/gr-wxgui/grc/wxgui_fftsink2.xml
+++ b/gr-wxgui/grc/wxgui_fftsink2.xml
@@ -8,8 +8,9 @@
<name>WX GUI FFT Sink</name>
<key>wxgui_fftsink2</key>
<category>Instrumentation/WX</category>
- <import>from gnuradio import window</import>
+ <import>from gnuradio.fft import window</import>
<import>from gnuradio.wxgui import fftsink2</import>
+ <import>from gnuradio import wxgui</import>
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
fftsink2.$(type.fcn)(
$(parent).GetWin(),
diff --git a/gr-wxgui/grc/wxgui_histosink2.xml b/gr-wxgui/grc/wxgui_histosink2.xml
index aed7781798..4fc331ab8e 100644
--- a/gr-wxgui/grc/wxgui_histosink2.xml
+++ b/gr-wxgui/grc/wxgui_histosink2.xml
@@ -9,6 +9,7 @@
<key>wxgui_histosink2</key>
<category>Instrumentation/WX</category>
<import>from gnuradio.wxgui import histosink_gl</import>
+ <import>from gnuradio import wxgui</import>
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
histosink_gl.histo_sink_f(
$(parent).GetWin(),
diff --git a/gr-wxgui/grc/wxgui_numbersink2.xml b/gr-wxgui/grc/wxgui_numbersink2.xml
index 6f93714dba..4697164088 100644
--- a/gr-wxgui/grc/wxgui_numbersink2.xml
+++ b/gr-wxgui/grc/wxgui_numbersink2.xml
@@ -9,6 +9,7 @@
<key>wxgui_numbersink2</key>
<category>Instrumentation/WX</category>
<import>from gnuradio.wxgui import numbersink2</import>
+ <import>from gnuradio import wxgui</import>
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
numbersink2.$(type.fcn)(
$(parent).GetWin(),
diff --git a/gr-wxgui/grc/wxgui_scopesink2.xml b/gr-wxgui/grc/wxgui_scopesink2.xml
index 64db47a055..ea43d3a690 100644
--- a/gr-wxgui/grc/wxgui_scopesink2.xml
+++ b/gr-wxgui/grc/wxgui_scopesink2.xml
@@ -9,7 +9,7 @@
<key>wxgui_scopesink2</key>
<category>Instrumentation/WX</category>
<import>from gnuradio.wxgui import scopesink2</import>
- <import>from gnuradio import gr</import>
+ <import>from gnuradio import wxgui</import>
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
scopesink2.$(type.fcn)(
$(parent).GetWin(),
@@ -143,19 +143,19 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
<type>enum</type>
<option>
<name>Auto</name>
- <key>gr.gr_TRIG_MODE_AUTO</key>
+ <key>wxgui.TRIG_MODE_AUTO</key>
</option>
<option>
<name>Normal</name>
- <key>gr.gr_TRIG_MODE_NORM</key>
+ <key>wxgui.TRIG_MODE_NORM</key>
</option>
<option>
<name>Freerun</name>
- <key>gr.gr_TRIG_MODE_FREE</key>
+ <key>wxgui.TRIG_MODE_FREE</key>
</option>
<option>
<name>Stripchart</name>
- <key>gr.gr_TRIG_MODE_STRIPCHART</key>
+ <key>wxgui.TRIG_MODE_STRIPCHART</key>
</option>
</param>
<param>
diff --git a/gr-wxgui/grc/wxgui_termsink.xml b/gr-wxgui/grc/wxgui_termsink.xml
index 2a7623d9d7..1367f4af8a 100644
--- a/gr-wxgui/grc/wxgui_termsink.xml
+++ b/gr-wxgui/grc/wxgui_termsink.xml
@@ -10,6 +10,7 @@
<category>Instrumentation/WX</category>
<import>from gnuradio.wxgui import termsink</import>
+ <import>from gnuradio import wxgui</import>
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
termsink.termsink(
diff --git a/gr-wxgui/grc/wxgui_waterfallsink2.xml b/gr-wxgui/grc/wxgui_waterfallsink2.xml
index 94de667e02..bee28f23fa 100644
--- a/gr-wxgui/grc/wxgui_waterfallsink2.xml
+++ b/gr-wxgui/grc/wxgui_waterfallsink2.xml
@@ -8,8 +8,9 @@
<name>WX GUI Waterfall Sink</name>
<key>wxgui_waterfallsink2</key>
<category>Instrumentation/WX</category>
- <import>from gnuradio import window</import>
+ <import>from gnuradio.fft import window</import>
<import>from gnuradio.wxgui import waterfallsink2</import>
+ <import>from gnuradio import wxgui</import>
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
waterfallsink2.$(type.fcn)(
$(parent).GetWin(),
diff --git a/gr-wxgui/include/gnuradio/wxgui/CMakeLists.txt b/gr-wxgui/include/gnuradio/wxgui/CMakeLists.txt
new file mode 100644
index 0000000000..fad84792e1
--- /dev/null
+++ b/gr-wxgui/include/gnuradio/wxgui/CMakeLists.txt
@@ -0,0 +1,32 @@
+# Copyright 2013 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.
+
+########################################################################
+# Install header files
+########################################################################
+install(FILES
+ api.h
+ histo_sink_f.h
+ oscope_guts.h
+ oscope_sink_f.h
+ oscope_sink_x.h
+ trigger_mode.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/wxgui
+ COMPONENT "wxgui_devel"
+)
diff --git a/gr-wxgui/include/gnuradio/wxgui/api.h b/gr-wxgui/include/gnuradio/wxgui/api.h
new file mode 100644
index 0000000000..6439c8e591
--- /dev/null
+++ b/gr-wxgui/include/gnuradio/wxgui/api.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2013 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_WXGUI_API_H
+#define INCLUDED_WXGUI_API_H
+
+#include <gnuradio/attributes.h>
+
+#ifdef gnuradio_wxgui_EXPORTS
+# define WXGUI_API __GR_ATTR_EXPORT
+#else
+# define WXGUI_API __GR_ATTR_IMPORT
+#endif
+
+#endif /* INCLUDED_WXGUI_API_H */
diff --git a/gr-wxgui/include/gnuradio/wxgui/histo_sink_f.h b/gr-wxgui/include/gnuradio/wxgui/histo_sink_f.h
new file mode 100644
index 0000000000..30f0bc7c0d
--- /dev/null
+++ b/gr-wxgui/include/gnuradio/wxgui/histo_sink_f.h
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,2013 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_GR_HISTO_SINK_F_H
+#define INCLUDED_GR_HISTO_SINK_F_H
+
+#include <gnuradio/wxgui/api.h>
+#include <gnuradio/sync_block.h>
+#include <gnuradio/msg_queue.h>
+
+namespace gr {
+ namespace wxgui {
+
+ /*!
+ * \brief Histogram module.
+ * \ingroup sink_blk
+ */
+ class WXGUI_API histo_sink_f : virtual public sync_block
+ {
+ public:
+ // gr::blocks::histo_sink_f::sptr
+ typedef boost::shared_ptr<histo_sink_f> sptr;
+
+ static sptr make(msg_queue::sptr msgq);
+
+ virtual unsigned int get_frame_size(void) = 0;
+ virtual unsigned int get_num_bins(void) = 0;
+
+ virtual void set_frame_size(unsigned int frame_size) = 0;
+ virtual void set_num_bins(unsigned int num_bins) = 0;
+ };
+
+ } /* namespace wxgui */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_HISTO_SINK_F_H */
diff --git a/gr-wxgui/include/gnuradio/wxgui/oscope_guts.h b/gr-wxgui/include/gnuradio/wxgui/oscope_guts.h
new file mode 100644
index 0000000000..c1a521acf2
--- /dev/null
+++ b/gr-wxgui/include/gnuradio/wxgui/oscope_guts.h
@@ -0,0 +1,131 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2005,2013 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_GR_OSCOPE_GUTS_H
+#define INCLUDED_GR_OSCOPE_GUTS_H
+
+#include <gnuradio/wxgui/api.h>
+#include <gnuradio/wxgui/trigger_mode.h>
+#include <gnuradio/msg_queue.h>
+
+namespace gr {
+ namespace wxgui {
+
+ /*!
+ * \brief guts of oscilloscope trigger and buffer module
+ *
+ * This module processes sets of samples provided the \p
+ * process_sample method. When appropriate given the updateRate,
+ * sampleRate and trigger conditions, process_sample will
+ * periodically write output records of captured data to
+ * output_fd. For each trigger event, nchannels records will be
+ * written. Each record consists of get_samples_per_output_record
+ * binary floats. The trigger instant occurs at the 1/2 way point
+ * in the buffer. Thus, output records consist of 50% pre-trigger
+ * data and 50% post-trigger data.
+ */
+
+ class WXGUI_API oscope_guts
+ {
+ public:
+ static const int MAX_CHANNELS = 8;
+
+ private:
+ enum scope_state { HOLD_OFF, LOOK_FOR_TRIGGER, POST_TRIGGER };
+
+ int d_nchannels; // how many channels
+ msg_queue::sptr d_msgq; // message queue we stuff output records into
+ trigger_mode d_trigger_mode;
+ trigger_slope d_trigger_slope;
+ int d_trigger_channel; // which channel to watch for trigger condition
+ double d_sample_rate; // input sample rate in Hz
+ double d_update_rate; // approx freq to produce an output record (Hz)
+ double d_trigger_level;
+
+ int d_obi; // output buffer index
+ float *d_buffer[MAX_CHANNELS];
+
+ scope_state d_state;
+ int d_decimator_count;
+ int d_decimator_count_init;
+ int d_hold_off_count;
+ int d_hold_off_count_init;
+ int d_pre_trigger_count;
+ int d_post_trigger_count;
+ int d_post_trigger_count_init;
+ float d_trigger_off; //%sample trigger is off
+
+ // NOT IMPLEMENTED
+ oscope_guts(const oscope_guts &rhs); // no copy constructor
+ oscope_guts &operator= (const oscope_guts &rhs); // no assignment operator
+
+ void trigger_changed();
+ void update_rate_or_decimation_changed();
+ bool found_trigger(); // returns true if found
+ void write_output_records();
+
+ void enter_hold_off(); // called on state entry
+ void enter_look_for_trigger();
+ void enter_post_trigger();
+
+ public:
+ // CREATORS
+ oscope_guts(double sample_rate, msg_queue::sptr msgq);
+ ~oscope_guts();
+
+ // MANIPULATORS
+
+ /*!
+ * \param channel_data points to nchannels float values. These
+ * are the values for each channel at this sample time.
+ */
+ void process_sample(const float *channel_data);
+
+ bool set_update_rate(double update_rate);
+ bool set_decimation_count(int decimation_count);
+ bool set_trigger_channel(int channel);
+ bool set_trigger_mode(trigger_mode mode);
+ bool set_trigger_slope(trigger_slope slope);
+ bool set_trigger_level(double trigger_level);
+ bool set_trigger_level_auto(); // set to 50% level
+ bool set_sample_rate(double sample_rate);
+ bool set_num_channels(int nchannels);
+
+ // ACCESSORS
+ int num_channels() const;
+ double sample_rate() const;
+ double update_rate() const;
+ int get_decimation_count() const;
+ int get_trigger_channel() const;
+ trigger_mode get_trigger_mode() const;
+ trigger_slope get_trigger_slope() const;
+ double get_trigger_level() const;
+
+ // # of samples written to each output record.
+ int get_samples_per_output_record() const;
+ };
+
+ } /* namespace wxgui */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_OSCOPE_GUTS_H */
diff --git a/gr-wxgui/include/gnuradio/wxgui/oscope_sink_f.h b/gr-wxgui/include/gnuradio/wxgui/oscope_sink_f.h
new file mode 100644
index 0000000000..9e86442055
--- /dev/null
+++ b/gr-wxgui/include/gnuradio/wxgui/oscope_sink_f.h
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003-2005,2013 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_GR_OSCOPE_SINK_F_H
+#define INCLUDED_GR_OSCOPE_SINK_F_H
+
+#include <gnuradio/wxgui/api.h>
+#include <gnuradio/wxgui/oscope_sink_x.h>
+#include <gnuradio/msg_queue.h>
+
+namespace gr {
+ namespace wxgui {
+
+ /*!
+ * \brief Building block for python oscilloscope module.
+ * \ingroup sink_blk
+ *
+ * Accepts multiple float streams.
+ */
+ class WXGUI_API oscope_sink_f
+ : virtual public oscope_sink_x
+ {
+ public:
+ // gr::blocks::oscope_sink_f::sptr
+ typedef boost::shared_ptr<oscope_sink_f> sptr;
+
+ static sptr make(double sampling_rate, msg_queue::sptr msgq);
+ };
+
+ } /* namespace wxgui */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_OSCOPE_SINK_F_H */
+
diff --git a/gr-wxgui/include/gnuradio/wxgui/oscope_sink_x.h b/gr-wxgui/include/gnuradio/wxgui/oscope_sink_x.h
new file mode 100644
index 0000000000..b72c1dd370
--- /dev/null
+++ b/gr-wxgui/include/gnuradio/wxgui/oscope_sink_x.h
@@ -0,0 +1,91 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2004,2013 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_GR_OSCOPE_SINK_X_H
+#define INCLUDED_GR_OSCOPE_SINK_X_H
+
+#include <gnuradio/wxgui/api.h>
+#include <gnuradio/wxgui/trigger_mode.h>
+#include <gnuradio/wxgui/oscope_guts.h>
+#include <gnuradio/sync_block.h>
+
+namespace gr {
+ namespace wxgui {
+
+ /*!
+ * \brief Abstract class for python oscilloscope module.
+ * \ingroup sink_blk
+ *
+ * Don't instantiate this. Use gr::blocks::oscope_sink_f instead.
+ */
+ class WXGUI_API oscope_sink_x : public sync_block
+ {
+ protected:
+ double d_sampling_rate;
+ oscope_guts *d_guts;
+
+ oscope_sink_x() {};
+ oscope_sink_x(const std::string name,
+ gr::io_signature::sptr input_sig,
+ double sampling_rate);
+ public:
+ virtual ~oscope_sink_x();
+
+ //// gr::blocks::oscope_sink_x::sptr
+ //typedef boost::shared_ptr<oscope_sink_x> sptr;
+ //
+ //static sptr make(const std::string name,
+ // gnuradio/io_signature.h_sptr input_sig,
+ // double sampling_rate);
+
+ bool set_update_rate(double update_rate);
+ bool set_decimation_count(int decimation_count);
+ bool set_trigger_channel(int channel);
+ bool set_trigger_mode(trigger_mode mode);
+ bool set_trigger_slope(trigger_slope slope);
+ bool set_trigger_level(double trigger_level);
+ bool set_trigger_level_auto();
+ bool set_sample_rate(double sample_rate);
+ bool set_num_channels(int nchannels);
+
+ // ACCESSORS
+ int num_channels() const;
+ double sample_rate() const;
+ double update_rate() const;
+ int get_decimation_count() const;
+ int get_trigger_channel() const;
+ trigger_mode get_trigger_mode() const;
+ trigger_slope get_trigger_slope() const;
+ double get_trigger_level() const;
+
+ // # of samples written to each output record.
+ int get_samples_per_output_record() const;
+
+ virtual int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items) = 0;
+ };
+
+ } /* namespace wxgui */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_OSCOPE_SINK_X_H */
diff --git a/gr-wxgui/include/gnuradio/wxgui/trigger_mode.h b/gr-wxgui/include/gnuradio/wxgui/trigger_mode.h
new file mode 100644
index 0000000000..11654ef6c5
--- /dev/null
+++ b/gr-wxgui/include/gnuradio/wxgui/trigger_mode.h
@@ -0,0 +1,44 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2004,2013 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_GR_TRIGGER_MODE_H
+#define INCLUDED_GR_TRIGGER_MODE_H
+
+namespace gr {
+ namespace wxgui {
+
+ enum trigger_mode {
+ TRIG_MODE_FREE,
+ TRIG_MODE_AUTO,
+ TRIG_MODE_NORM,
+ TRIG_MODE_STRIPCHART,
+ };
+
+ enum trigger_slope {
+ TRIG_SLOPE_POS,
+ TRIG_SLOPE_NEG,
+ };
+
+ } /* namespace wxgui */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_TRIGGER_MODE_H */
diff --git a/gr-wxgui/lib/CMakeLists.txt b/gr-wxgui/lib/CMakeLists.txt
new file mode 100644
index 0000000000..c33a7b9a33
--- /dev/null
+++ b/gr-wxgui/lib/CMakeLists.txt
@@ -0,0 +1,77 @@
+# Copyright 2012-2013 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.
+
+########################################################################
+# Setup the include and linker paths
+########################################################################
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}/../include
+ ${GR_WXGUI_INCLUDE_DIRS}
+ ${GNURADIO_RUNTIME_INCLUDE_DIRS}
+ ${VOLK_INCLUDE_DIRS}
+ ${Boost_INCLUDE_DIRS}
+)
+
+link_directories(${Boost_LIBRARY_DIRS})
+
+if(ENABLE_GR_CTRLPORT)
+ ADD_DEFINITIONS(-DGR_CTRLPORT)
+ include_directories(${ICE_INCLUDE_DIR})
+endif(ENABLE_GR_CTRLPORT)
+
+########################################################################
+# Setup library
+########################################################################
+list(APPEND gr_wxgui_sources
+ histo_sink_f_impl.cc
+ oscope_guts.cc
+ oscope_sink_x.cc
+ oscope_sink_f_impl.cc
+)
+
+#Add Windows DLL resource file if using MSVC
+IF(MSVC)
+ include(${CMAKE_SOURCE_DIR}/cmake/Modules/GrVersion.cmake)
+
+ configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-wxgui.rc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-wxgui.rc
+ @ONLY)
+
+ list(APPEND gr_wxgui_sources
+ ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-wxgui.rc
+ )
+ENDIF(MSVC)
+
+list(APPEND wxgui_libs
+ gnuradio-runtime
+ volk
+ ${Boost_LIBRARIES}
+ ${BLOCKS_LIBRARIES}
+ ${LOG4CPP_LIBRARIES}
+)
+
+add_library(gnuradio-wxgui SHARED ${gr_wxgui_sources})
+
+target_link_libraries(gnuradio-wxgui ${wxgui_libs})
+GR_LIBRARY_FOO(gnuradio-wxgui
+ RUNTIME_COMPONENT "wxgui_runtime"
+ DEVEL_COMPONENT "wxgui_devel")
diff --git a/gr-wxgui/lib/gnuradio-wxgui.rc.in b/gr-wxgui/lib/gnuradio-wxgui.rc.in
new file mode 100644
index 0000000000..126db75091
--- /dev/null
+++ b/gr-wxgui/lib/gnuradio-wxgui.rc.in
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013 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 <afxres.h>
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION @MAJOR_VERSION@,@API_COMPAT@,@RC_MINOR_VERSION@,@RC_MAINT_VERSION@
+ PRODUCTVERSION @MAJOR_VERSION@,@API_COMPAT@,@RC_MINOR_VERSION@,@RC_MAINT_VERSION@
+ FILEFLAGSMASK 0x3fL
+#ifndef NDEBUG
+ FILEFLAGS 0x0L
+#else
+ FILEFLAGS 0x1L
+#endif
+ FILEOS VOS__WINDOWS32
+ FILETYPE VFT_DLL
+ FILESUBTYPE VFT2_DRV_INSTALLABLE
+ BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "FileDescription", "gnuradio-blocks"
+ VALUE "FileVersion", "@VERSION@"
+ VALUE "InternalName", "gnuradio-blocks.dll"
+ VALUE "LegalCopyright", "Licensed under GPLv3 or any later version"
+ VALUE "OriginalFilename", "gnuradio-blocks.dll"
+ VALUE "ProductName", "gnuradio-blocks"
+ VALUE "ProductVersion", "@VERSION@"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+ END
diff --git a/gr-wxgui/lib/histo_sink_f_impl.cc b/gr-wxgui/lib/histo_sink_f_impl.cc
new file mode 100644
index 0000000000..f10540fa36
--- /dev/null
+++ b/gr-wxgui/lib/histo_sink_f_impl.cc
@@ -0,0 +1,186 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009-2011,2013 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "histo_sink_f_impl.h"
+#include <gnuradio/io_signature.h>
+#include <boost/math/special_functions/round.hpp>
+
+namespace gr {
+ namespace wxgui {
+
+ static float get_clean_num(float num)
+ {
+ if(num == 0)
+ return 0;
+ /* extract sign and exponent from num */
+ int sign = (num < 0) ? -1 : 1; num = fabs(num);
+ float exponent = floor(log10(num));
+ /* search for closest number with base 1, 2, 5, 10 */
+ float closest_num = 10*pow(10, exponent);
+ if(fabs(num - 1*pow(10, exponent)) < fabs(num - closest_num))
+ closest_num = 1*pow(10, exponent);
+ if(fabs(num - 2*pow(10, exponent)) < fabs(num - closest_num))
+ closest_num = 2*pow(10, exponent);
+ if(fabs(num - 5*pow(10, exponent)) < fabs(num - closest_num))
+ closest_num = 5*pow(10, exponent);
+ return sign*closest_num;
+ }
+
+ histo_sink_f::sptr
+ histo_sink_f::make(msg_queue::sptr msgq)
+ {
+ return gnuradio::get_initial_sptr
+ (new histo_sink_f_impl(msgq));
+ }
+
+ histo_sink_f_impl::histo_sink_f_impl(msg_queue::sptr msgq)
+ : sync_block("histo_sink_f",
+ io_signature::make(1, 1, sizeof(float)),
+ io_signature::make(0, 0, 0)),
+ d_msgq(msgq), d_num_bins(11), d_frame_size(1000),
+ d_sample_count(0), d_bins(NULL), d_samps(NULL)
+ {
+ //allocate arrays and clear
+ set_num_bins(d_num_bins);
+ set_frame_size(d_frame_size);
+ }
+
+ histo_sink_f_impl::~histo_sink_f_impl(void)
+ {
+ delete [] d_samps;
+ delete [] d_bins;
+ }
+
+ int
+ histo_sink_f_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float*)input_items[0];
+ gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of this function
+ for(unsigned int i = 0; i < (unsigned int)noutput_items; i++) {
+ d_samps[d_sample_count] = in[i];
+ d_sample_count++;
+ /* processed a frame? */
+ if(d_sample_count == d_frame_size) {
+ send_frame();
+ clear();
+ }
+ }
+ return noutput_items;
+ }
+
+ void
+ histo_sink_f_impl::send_frame(void)
+ {
+ /* output queue full, drop the data */
+ if(d_msgq->full_p())
+ return;
+ /* find the minimum and maximum */
+ float minimum = d_samps[0];
+ float maximum = d_samps[0];
+ for(unsigned int i = 0; i < d_frame_size; i++) {
+ if(d_samps[i] < minimum) minimum = d_samps[i];
+ if(d_samps[i] > maximum) maximum = d_samps[i];
+ }
+ minimum = get_clean_num(minimum);
+ maximum = get_clean_num(maximum);
+ if(minimum == maximum || minimum > maximum)
+ return; //useless data or screw up?
+ /* load the bins */
+ int index;
+ float bin_width = (maximum - minimum)/(d_num_bins-1);
+ for(unsigned int i = 0; i < d_sample_count; i++) {
+ index = boost::math::iround((d_samps[i] - minimum)/bin_width);
+ /* ensure the index range in case a small floating point error is involed */
+ if(index < 0)
+ index = 0;
+ if(index >= (int)d_num_bins)
+ index = d_num_bins-1;
+ d_bins[index]++;
+ }
+ /* Build a message to hold the output records */
+ message::sptr msg = message::make(0, minimum, maximum, d_num_bins*sizeof(float));
+ float *out = (float *)msg->msg(); // get pointer to raw message buffer
+ /* normalize the bins and put into message */
+ for(unsigned int i = 0; i < d_num_bins; i++) {
+ out[i] = ((float)d_bins[i])/d_frame_size;
+ }
+ /* send the message */
+ d_msgq->handle(msg);
+ }
+
+ void
+ histo_sink_f_impl::clear(void)
+ {
+ d_sample_count = 0;
+ /* zero the bins */
+ for(unsigned int i = 0; i < d_num_bins; i++) {
+ d_bins[i] = 0;
+ }
+ }
+
+ /**************************************************
+ * Getters
+ **************************************************/
+ unsigned int
+ histo_sink_f_impl::get_frame_size(void)
+ {
+ return d_frame_size;
+ }
+
+ unsigned int
+ histo_sink_f_impl::get_num_bins(void)
+ {
+ return d_num_bins;
+ }
+
+ /**************************************************
+ * Setters
+ **************************************************/
+ void
+ histo_sink_f_impl::set_frame_size(unsigned int frame_size)
+ {
+ gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of this function
+ d_frame_size = frame_size;
+ /* allocate a new sample array */
+ delete [] d_samps;
+ d_samps = new float[d_frame_size];
+ clear();
+ }
+
+ void
+ histo_sink_f_impl::set_num_bins(unsigned int num_bins) {
+ gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of this function
+ d_num_bins = num_bins;
+ /* allocate a new bin array */
+ delete [] d_bins;
+ d_bins = new unsigned int[d_num_bins];
+ clear();
+ }
+
+ } /* namespace wxgui */
+} /* namespace gr */
diff --git a/gr-wxgui/lib/histo_sink_f_impl.h b/gr-wxgui/lib/histo_sink_f_impl.h
new file mode 100644
index 0000000000..6c16a8a465
--- /dev/null
+++ b/gr-wxgui/lib/histo_sink_f_impl.h
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009,2013 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_GR_HISTO_SINK_F_IMPL_H
+#define INCLUDED_GR_HISTO_SINK_F_IMPL_H
+
+#include <gnuradio/wxgui/histo_sink_f.h>
+
+namespace gr {
+ namespace wxgui {
+
+ class histo_sink_f_impl : public histo_sink_f
+ {
+ private:
+ msg_queue::sptr d_msgq;
+ unsigned int d_num_bins;
+ unsigned int d_frame_size;
+ unsigned int d_sample_count;
+ unsigned int *d_bins;
+ float *d_samps;
+ gr::thread::mutex d_mutex;
+
+ void send_frame(void);
+ void clear(void);
+
+ public:
+ histo_sink_f_impl(msg_queue::sptr msgq);
+ ~histo_sink_f_impl(void);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ unsigned int get_frame_size(void);
+ unsigned int get_num_bins(void);
+
+ void set_frame_size(unsigned int frame_size);
+ void set_num_bins(unsigned int num_bins);
+ };
+
+ } /* namespace wxgui */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_HISTO_SINK_F_IMPL_H */
diff --git a/gr-wxgui/lib/oscope_guts.cc b/gr-wxgui/lib/oscope_guts.cc
new file mode 100644
index 0000000000..d406932dae
--- /dev/null
+++ b/gr-wxgui/lib/oscope_guts.cc
@@ -0,0 +1,439 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2005,2013 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gnuradio/wxgui/oscope_guts.h>
+#include <stdexcept>
+#include <stdio.h>
+#include <algorithm>
+#include <unistd.h>
+#include <math.h>
+#include <assert.h>
+
+namespace gr {
+ namespace wxgui {
+
+ /*
+ * Bad performance if it's large, and flaky triggering if it's too small
+ */
+ static const int OUTPUT_RECORD_SIZE = 1024; // Must be power of 2
+
+ /*
+ * For (slow-updated) STRIPCHART triggering, we make the record
+ * size larger, since we potentially want to be able to "see"
+ * hours of data. This works as long as the update rates to a
+ * STRIPCHART are low, which they generally are--that's rather
+ * what a stripchart is all about!
+ */
+ static const int SCHART_MULT = 8;
+
+
+ static inline int
+ wrap_bi(int buffer_index, int mx) // wrap buffer index
+ {
+ return buffer_index & (mx - 1);
+ }
+
+ static inline int
+ incr_bi(int buffer_index, int mx) // increment buffer index
+ {
+ return wrap_bi(buffer_index + 1, mx);
+ }
+
+ static inline int
+ decr_bi(int buffer_index, int mx) // decrement buffer index
+ {
+ return wrap_bi(buffer_index - 1, mx);
+ }
+
+ oscope_guts::oscope_guts(double sample_rate, msg_queue::sptr msgq)
+ : d_nchannels(1),
+ d_msgq(msgq),
+ d_trigger_mode(TRIG_MODE_AUTO),
+ d_trigger_slope(TRIG_SLOPE_POS),
+ d_trigger_channel(0),
+ d_sample_rate(sample_rate),
+ d_update_rate(20),
+ d_trigger_level(0),
+ d_obi(0),
+ d_state(HOLD_OFF),
+ d_decimator_count(0),
+ d_decimator_count_init(1),
+ d_hold_off_count(0),
+ d_hold_off_count_init(OUTPUT_RECORD_SIZE/2-1),
+ d_pre_trigger_count(0),
+ d_post_trigger_count(0),
+ d_post_trigger_count_init(OUTPUT_RECORD_SIZE/2)
+ {
+ for(int i = 0; i < MAX_CHANNELS; i++)
+ d_buffer[i] = 0;
+
+ for(int i = 0; i < MAX_CHANNELS; i++) {
+ d_buffer[i] = new float[OUTPUT_RECORD_SIZE*SCHART_MULT];
+ for(int j = 0; j < OUTPUT_RECORD_SIZE*SCHART_MULT; j++)
+ d_buffer[i][j] = 0.0;
+ }
+
+ // be sure buffer is full before first write
+ enter_hold_off();
+ update_rate_or_decimation_changed();
+ }
+
+ oscope_guts::~oscope_guts()
+ {
+ for(int i = 0; i < MAX_CHANNELS; i++)
+ delete [] d_buffer[i];
+ }
+
+ // MANIPULATORS
+ void
+ oscope_guts::process_sample(const float *channel_data)
+ {
+ d_decimator_count--;
+ if(d_decimator_count > 0)
+ return;
+
+ d_decimator_count = d_decimator_count_init;
+
+ if(d_trigger_mode != TRIG_MODE_STRIPCHART) {
+ for(int i = 0; i < d_nchannels; i++)
+ d_buffer[i][d_obi] = channel_data[i]; // copy data into buffer
+
+ switch(d_state) {
+ case HOLD_OFF:
+ d_hold_off_count--;
+ if(d_hold_off_count <= 0)
+ enter_look_for_trigger ();
+ break;
+
+ case LOOK_FOR_TRIGGER:
+ if(found_trigger())
+ enter_post_trigger();
+ break;
+
+ case POST_TRIGGER:
+ d_post_trigger_count--;
+ if(d_post_trigger_count <= 0) {
+ write_output_records();
+ enter_hold_off();
+ }
+ break;
+
+ default:
+ assert(0);
+ }
+
+ d_obi = incr_bi(d_obi, OUTPUT_RECORD_SIZE);
+ }
+ else {
+ for(int i = 0; i < d_nchannels; i++) {
+ for(int j = (OUTPUT_RECORD_SIZE*SCHART_MULT)-1; j > 0; j--) {
+ d_buffer[i][j] = d_buffer[i][j-1];
+ }
+ d_buffer[i][0] = channel_data[i];
+ }
+ d_trigger_off = 0;
+ write_output_records();
+ }
+ }
+
+ /*
+ * Functions called on state entry
+ */
+
+ void
+ oscope_guts::enter_hold_off()
+ {
+ d_state = HOLD_OFF;
+ d_hold_off_count = d_hold_off_count_init;
+ }
+
+ void
+ oscope_guts::enter_look_for_trigger()
+ {
+ d_pre_trigger_count = 0;
+ d_state = LOOK_FOR_TRIGGER;
+ }
+
+ void
+ oscope_guts::enter_post_trigger()
+ {
+ d_state = POST_TRIGGER;
+ d_post_trigger_count = d_post_trigger_count_init;
+ //ensure that the trigger offset is no more than than half a sample
+ if(d_trigger_off > .5)
+ d_trigger_off -= 1;
+ else
+ d_post_trigger_count--;
+ }
+
+ // ----------------------------------------------------------------
+ // returns true if trigger found
+
+ bool
+ oscope_guts::found_trigger()
+ {
+ int mx = d_trigger_mode == TRIG_MODE_STRIPCHART ? OUTPUT_RECORD_SIZE*SCHART_MULT :
+ OUTPUT_RECORD_SIZE;
+
+ float prev_sample = d_buffer[d_trigger_channel][decr_bi(d_obi, mx)];
+ float new_sample = d_buffer[d_trigger_channel][d_obi];
+
+ switch(d_trigger_mode) {
+
+ case TRIG_MODE_AUTO: //too many samples without a trigger
+ d_pre_trigger_count++;
+ if(d_pre_trigger_count > OUTPUT_RECORD_SIZE/2)
+ return true;
+
+ case TRIG_MODE_NORM: //look for trigger
+ switch(d_trigger_slope) {
+
+ case TRIG_SLOPE_POS: //trigger point in pos slope?
+ if(new_sample < d_trigger_level || prev_sample >= d_trigger_level)
+ return false;
+ break;
+
+ case TRIG_SLOPE_NEG: //trigger point in neg slope?
+ if(new_sample > d_trigger_level || prev_sample <= d_trigger_level)
+ return false;
+ break;
+ }
+
+ //calculate the trigger offset in % sample
+ d_trigger_off = (d_trigger_level - prev_sample)/(new_sample - prev_sample);
+ return true;
+
+ case TRIG_MODE_FREE: //free run mode, always trigger
+ d_trigger_off = 0;
+ return true;
+
+ default:
+ assert(0);
+ return false;
+ }
+ }
+
+ // ----------------------------------------------------------------
+ // write output records (duh!)
+
+ void
+ oscope_guts::write_output_records()
+ {
+ int mx;
+
+ mx = d_trigger_mode == TRIG_MODE_STRIPCHART ?
+ OUTPUT_RECORD_SIZE*SCHART_MULT : OUTPUT_RECORD_SIZE;
+
+ // if the output queue if full, drop the data like its hot.
+ if(d_msgq->full_p())
+ return;
+ // Build a message to hold the output records
+ message::sptr msg =
+ message::make(0, // msg type
+ d_nchannels, // arg1 for other side
+ mx, // arg2 for other side
+ ((d_nchannels * mx) + 1) * sizeof(float)); // sizeof payload
+
+ float *out = (float *)msg->msg(); // get pointer to raw message buffer
+
+ for(int ch = 0; ch < d_nchannels; ch++) {
+ // note that d_obi + 1 points at the oldest sample in the buffer
+ for(int i = 0; i < mx; i++) {
+ out[i] = d_buffer[ch][wrap_bi(d_obi + 1 + i, mx)];
+ }
+ out += mx;
+ }
+ //Set the last sample as the trigger offset:
+ // The non gl scope sink will not look at this last sample.
+ // The gl scope sink will use this last sample as an offset.
+ out[0] = d_trigger_off;
+ d_msgq->handle(msg); // send the msg
+ }
+
+ // ----------------------------------------------------------------
+
+ bool
+ oscope_guts::set_update_rate(double update_rate)
+ {
+ d_update_rate = std::min(std::max (1./10., update_rate), d_sample_rate);
+ update_rate_or_decimation_changed();
+ return true;
+ }
+
+ bool
+ oscope_guts::set_decimation_count(int decimator_count)
+ {
+ decimator_count = std::max(1, decimator_count);
+ d_decimator_count_init = decimator_count;
+ update_rate_or_decimation_changed();
+ return true;
+ }
+
+ bool
+ oscope_guts::set_sample_rate(double sample_rate)
+ {
+ d_sample_rate = sample_rate;
+ return set_update_rate(update_rate());
+ }
+
+ void
+ oscope_guts::update_rate_or_decimation_changed()
+ {
+ d_hold_off_count_init =
+ (int)rint(d_sample_rate / d_update_rate / d_decimator_count_init);
+ }
+
+ bool
+ oscope_guts::set_trigger_channel(int channel)
+ {
+ if(channel >= 0 && channel < d_nchannels) {
+ d_trigger_channel = channel;
+ trigger_changed ();
+ return true;
+ }
+
+ return false;
+ }
+
+ bool
+ oscope_guts::set_trigger_mode(trigger_mode mode)
+ {
+ d_trigger_mode = mode;
+ trigger_changed();
+ return true;
+ }
+
+ bool
+ oscope_guts::set_trigger_slope(trigger_slope slope)
+ {
+ d_trigger_slope = slope;
+ trigger_changed();
+ return true;
+ }
+
+ bool
+ oscope_guts::set_trigger_level(double trigger_level)
+ {
+ d_trigger_level = trigger_level;
+ trigger_changed();
+ return true;
+ }
+
+ bool
+ oscope_guts::set_trigger_level_auto()
+ {
+ // find the level 1/2 way between the min and the max
+
+ float min_v = d_buffer[d_trigger_channel][0];
+ float max_v = d_buffer[d_trigger_channel][0];
+
+ for(int i = 1; i < OUTPUT_RECORD_SIZE; i++) {
+ min_v = std::min (min_v, d_buffer[d_trigger_channel][i]);
+ max_v = std::max (max_v, d_buffer[d_trigger_channel][i]);
+ }
+ return set_trigger_level((min_v + max_v) * 0.5);
+ }
+
+ bool
+ oscope_guts::set_num_channels(int nchannels)
+ {
+ if(nchannels > 0 && nchannels <= MAX_CHANNELS) {
+ d_nchannels = nchannels;
+ return true;
+ }
+ return false;
+ }
+
+ void
+ oscope_guts::trigger_changed()
+ {
+ enter_look_for_trigger();
+ }
+
+ // ACCESSORS
+
+ int
+ oscope_guts::num_channels() const
+ {
+ return d_nchannels;
+ }
+
+ double
+ oscope_guts::sample_rate() const
+ {
+ return d_sample_rate;
+ }
+
+ double
+ oscope_guts::update_rate() const
+ {
+ return d_update_rate;
+ }
+
+ int
+ oscope_guts::get_decimation_count() const
+ {
+ return d_decimator_count_init;
+ }
+
+ int
+ oscope_guts::get_trigger_channel() const
+ {
+ return d_trigger_channel;
+ }
+
+ trigger_mode
+ oscope_guts::get_trigger_mode() const
+ {
+ return d_trigger_mode;
+ }
+
+ trigger_slope
+ oscope_guts::get_trigger_slope() const
+ {
+ return d_trigger_slope;
+ }
+
+ double
+ oscope_guts::get_trigger_level() const
+ {
+ return d_trigger_level;
+ }
+
+ int
+ oscope_guts::get_samples_per_output_record() const
+ {
+ int mx;
+
+ mx = OUTPUT_RECORD_SIZE;
+ if(d_trigger_mode == TRIG_MODE_STRIPCHART) {
+ mx = OUTPUT_RECORD_SIZE*SCHART_MULT;
+ }
+ return mx;
+ }
+
+ } /* namespace wxgui */
+} /* namespace gr */
diff --git a/gr-wxgui/lib/oscope_sink_f_impl.cc b/gr-wxgui/lib/oscope_sink_f_impl.cc
new file mode 100644
index 0000000000..9993040ffd
--- /dev/null
+++ b/gr-wxgui/lib/oscope_sink_f_impl.cc
@@ -0,0 +1,83 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003-2005,2010,2013 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "oscope_sink_f_impl.h"
+#include <gnuradio/wxgui/oscope_sink_x.h>
+#include <gnuradio/wxgui/oscope_guts.h>
+#include <gnuradio/io_signature.h>
+
+namespace gr {
+ namespace wxgui {
+
+ oscope_sink_f::sptr
+ oscope_sink_f::make(double sampling_rate, msg_queue::sptr msgq)
+ {
+ return gnuradio::get_initial_sptr
+ (new oscope_sink_f_impl(sampling_rate, msgq));
+ }
+
+ oscope_sink_f_impl::oscope_sink_f_impl(double sampling_rate, msg_queue::sptr msgq)
+ : oscope_sink_x("oscope_sink_f",
+ io_signature::make(1, oscope_guts::MAX_CHANNELS,
+ sizeof(float)),
+ sampling_rate),
+ d_msgq(msgq)
+ {
+ d_guts = new oscope_guts(d_sampling_rate, d_msgq);
+ }
+
+ oscope_sink_f_impl::~oscope_sink_f_impl()
+ {
+ }
+
+ bool
+ oscope_sink_f_impl::check_topology(int ninputs, int noutputs)
+ {
+ return d_guts->set_num_channels(ninputs);
+ }
+
+ int
+ oscope_sink_f_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ int ni = input_items.size();
+ float tmp[oscope_guts::MAX_CHANNELS];
+
+ for(int i = 0; i < noutput_items; i++) {
+
+ // FIXME for now, copy the data. Fix later if reqd
+ for(int ch = 0; ch < ni; ch++)
+ tmp[ch] = ((const float*)input_items[ch])[i];
+
+ d_guts->process_sample(tmp);
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace wxgui */
+} /* namespace gr */
diff --git a/gr-wxgui/lib/oscope_sink_f_impl.h b/gr-wxgui/lib/oscope_sink_f_impl.h
new file mode 100644
index 0000000000..81688f53a5
--- /dev/null
+++ b/gr-wxgui/lib/oscope_sink_f_impl.h
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003-2005,2013 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_GR_OSCOPE_SINK_F_IMPL_H
+#define INCLUDED_GR_OSCOPE_SINK_F_IMPL_H
+
+#include <gnuradio/wxgui/oscope_sink_f.h>
+
+namespace gr {
+ namespace wxgui {
+
+ class oscope_sink_f_impl : public oscope_sink_f
+ {
+ private:
+ msg_queue::sptr d_msgq;
+
+ public:
+ oscope_sink_f_impl(double sampling_rate, msg_queue::sptr msgq);
+ ~oscope_sink_f_impl();
+
+ bool check_topology(int ninputs, int noutputs);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace wxgui */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_OSCOPE_SINK_F_IMPL_H */
+
diff --git a/gr-wxgui/lib/oscope_sink_x.cc b/gr-wxgui/lib/oscope_sink_x.cc
new file mode 100644
index 0000000000..c97495fe53
--- /dev/null
+++ b/gr-wxgui/lib/oscope_sink_x.cc
@@ -0,0 +1,161 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2004,2013 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gnuradio/wxgui/oscope_sink_x.h>
+#include <gnuradio/wxgui/oscope_guts.h>
+#include <gnuradio/io_signature.h>
+
+namespace gr {
+ namespace wxgui {
+
+ oscope_sink_x::oscope_sink_x(const std::string name,
+ gr::io_signature::sptr input_sig,
+ double sampling_rate)
+ : sync_block(name, input_sig,
+ io_signature::make(0, 0, 0)),
+ d_sampling_rate(sampling_rate), d_guts(0)
+ {
+ }
+
+ oscope_sink_x::~oscope_sink_x()
+ {
+ delete d_guts;
+ }
+
+ // ----------------------------------------------------------------
+
+ bool
+ oscope_sink_x::set_update_rate(double update_rate)
+ {
+ return d_guts->set_update_rate(update_rate);
+ }
+
+ bool
+ oscope_sink_x::set_decimation_count(int decimation_count)
+ {
+ return d_guts->set_decimation_count(decimation_count);
+ }
+
+ bool
+ oscope_sink_x::set_trigger_channel(int channel)
+ {
+ return d_guts->set_trigger_channel(channel);
+ }
+
+ bool
+ oscope_sink_x::set_trigger_mode(trigger_mode mode)
+ {
+ return d_guts->set_trigger_mode(mode);
+ }
+
+ bool
+ oscope_sink_x::set_trigger_slope(trigger_slope slope)
+ {
+ return d_guts->set_trigger_slope(slope);
+ }
+
+ bool
+ oscope_sink_x::set_trigger_level(double trigger_level)
+ {
+ return d_guts->set_trigger_level(trigger_level);
+ }
+
+ bool
+ oscope_sink_x::set_trigger_level_auto()
+ {
+ return d_guts->set_trigger_level_auto();
+ }
+
+ bool
+ oscope_sink_x::set_sample_rate(double sample_rate)
+ {
+ return d_guts->set_sample_rate(sample_rate);
+ }
+
+ bool
+ oscope_sink_x::set_num_channels(int nchannels)
+ {
+ return d_guts->set_num_channels(nchannels);
+ }
+
+ // ACCESSORS
+
+ int
+ oscope_sink_x::num_channels() const
+ {
+ return d_guts->num_channels();
+ }
+
+ double
+ oscope_sink_x::sample_rate() const
+ {
+ return d_guts->sample_rate();
+ }
+
+ double
+ oscope_sink_x::update_rate() const
+ {
+ return d_guts->update_rate();
+ }
+
+ int
+ oscope_sink_x::get_decimation_count() const
+ {
+ return d_guts->get_decimation_count();
+ }
+
+ int
+ oscope_sink_x::get_trigger_channel() const
+ {
+ return d_guts->get_trigger_channel();
+ }
+
+ trigger_mode
+ oscope_sink_x::get_trigger_mode() const
+ {
+ return d_guts->get_trigger_mode();
+ }
+
+ trigger_slope
+ oscope_sink_x::get_trigger_slope() const
+ {
+ return d_guts->get_trigger_slope();
+ }
+
+ double
+ oscope_sink_x::get_trigger_level() const
+ {
+ return d_guts->get_trigger_level();
+ }
+
+ int
+ oscope_sink_x::get_samples_per_output_record() const
+ {
+ return d_guts->get_samples_per_output_record();
+ }
+
+ } /* namespace wxgui */
+} /* namespace gr */
diff --git a/gr-wxgui/src/python/CMakeLists.txt b/gr-wxgui/python/wxgui/CMakeLists.txt
index 24e06acd5e..24e06acd5e 100644
--- a/gr-wxgui/src/python/CMakeLists.txt
+++ b/gr-wxgui/python/wxgui/CMakeLists.txt
diff --git a/gr-wxgui/src/python/__init__.py b/gr-wxgui/python/wxgui/__init__.py
index 68f8f4b5ea..dd81647fe9 100644
--- a/gr-wxgui/src/python/__init__.py
+++ b/gr-wxgui/python/wxgui/__init__.py
@@ -20,6 +20,7 @@
#
'''
-This is the gr-wxgui package. This package provides a GUI interface
-using the Wx backend.
+Provides a GUI interface using the Wx backend.
'''
+
+from wxgui_swig import *
diff --git a/gr-wxgui/src/python/common.py b/gr-wxgui/python/wxgui/common.py
index 1410d29dfa..48a62a28ab 100644
--- a/gr-wxgui/src/python/common.py
+++ b/gr-wxgui/python/wxgui/common.py
@@ -24,6 +24,7 @@
##################################################
import wx
from gnuradio import gr
+from gnuradio import blocks
RUN_ALWAYS = gr.prefs().get_bool ('wxgui', 'run_always', False)
@@ -47,7 +48,7 @@ class wxgui_hb(object):
"""
try:
assert points[0] == self or points[0][0] == self
- copy = gr.copy(self._hb.input_signature().sizeof_stream_item(0))
+ copy = blocks.copy(self._hb.input_signature().sizeof_stream_item(0))
handler = self._handler_factory(copy.set_enabled)
if RUN_ALWAYS == False:
handler(False) #initially disable the copy block
@@ -64,8 +65,12 @@ class wxgui_hb(object):
"""
Create a function that will cache the visibility flag,
and only call the handler when that flag changes.
- @param handler the function to call on a change
- @return a function of 1 argument
+
+ Args:
+ handler: the function to call on a change
+
+ Returns:
+ a function of 1 argument
"""
cache = [None]
def callback(visible):
@@ -84,8 +89,10 @@ class wxgui_hb(object):
Bind a handler to a window when its visibility changes.
Specifically, call the handler when the window visibility changes.
This condition is checked on every update ui event.
- @param win the wx window
- @param handler a function of 1 param
+
+ Args:
+ win: the wx window
+ handler: a function of 1 param
"""
#is the window visible in the hierarchy
def is_wx_window_visible(my_win):
@@ -126,8 +133,10 @@ def _register_access_method(destination, controller, key):
def register_access_methods(destination, controller):
"""
Register setter and getter functions in the destination object for all keys in the controller.
- @param destination the object to get new setter and getter methods
- @param controller the pubsub controller
+
+ Args:
+ destination: the object to get new setter and getter methods
+ controller: the pubsub controller
"""
for key in controller.keys(): _register_access_method(destination, controller, key)
@@ -164,8 +173,12 @@ import math
def get_exp(num):
"""
Get the exponent of the number in base 10.
- @param num the floating point number
- @return the exponent as an integer
+
+ Args:
+ num: the floating point number
+
+ Returns:
+ the exponent as an integer
"""
if num == 0: return 0
return int(math.floor(math.log10(abs(num))))
@@ -173,8 +186,12 @@ def get_exp(num):
def get_clean_num(num):
"""
Get the closest clean number match to num with bases 1, 2, 5.
- @param num the number
- @return the closest number
+
+ Args:
+ num: the number
+
+ Returns:
+ the closest number
"""
if num == 0: return 0
sign = num > 0 and 1 or -1
@@ -185,8 +202,12 @@ def get_clean_num(num):
def get_clean_incr(num):
"""
Get the next higher clean number with bases 1, 2, 5.
- @param num the number
- @return the next higher number
+
+ Args:
+ num: the number
+
+ Returns:
+ the next higher number
"""
num = get_clean_num(num)
exp = get_exp(num)
@@ -203,8 +224,12 @@ def get_clean_incr(num):
def get_clean_decr(num):
"""
Get the next lower clean number with bases 1, 2, 5.
- @param num the number
- @return the next lower number
+
+ Args:
+ num: the number
+
+ Returns:
+ the next lower number
"""
num = get_clean_num(num)
exp = get_exp(num)
@@ -221,8 +246,12 @@ def get_clean_decr(num):
def get_min_max(samples):
"""
Get the minimum and maximum bounds for an array of samples.
- @param samples the array of real values
- @return a tuple of min, max
+
+ Args:
+ samples: the array of real values
+
+ Returns:
+ a tuple of min, max
"""
factor = 2.0
mean = numpy.average(samples)
@@ -235,8 +264,12 @@ def get_min_max(samples):
def get_min_max_fft(fft_samps):
"""
Get the minimum and maximum bounds for an array of fft samples.
- @param samples the array of real values
- @return a tuple of min, max
+
+ Args:
+ samples: the array of real values
+
+ Returns:
+ a tuple of min, max
"""
#get the peak level (max of the samples)
peak_level = numpy.max(fft_samps)
diff --git a/gr-wxgui/src/python/const_window.py b/gr-wxgui/python/wxgui/const_window.py
index 2ad89b2a38..1295aff1fa 100644
--- a/gr-wxgui/src/python/const_window.py
+++ b/gr-wxgui/python/wxgui/const_window.py
@@ -60,7 +60,9 @@ class control_panel(wx.Panel):
def __init__(self, parent):
"""
Create a new control panel.
- @param parent the wx parent window
+
+ Args:
+ parent: the wx parent window
"""
self.parent = parent
wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
@@ -174,7 +176,9 @@ class const_window(wx.Panel, pubsub.pubsub):
def handle_msg(self, msg):
"""
Plot the samples onto the complex grid.
- @param msg the array of complex samples
+
+ Args:
+ msg: the array of complex samples
"""
if not self[RUNNING_KEY]: return
#convert to complex floating point numbers
diff --git a/gr-wxgui/src/python/constants.py b/gr-wxgui/python/wxgui/constants.py
index 08cc6a6343..08cc6a6343 100644
--- a/gr-wxgui/src/python/constants.py
+++ b/gr-wxgui/python/wxgui/constants.py
diff --git a/gr-wxgui/src/python/constsink_gl.py b/gr-wxgui/python/wxgui/constsink_gl.py
index 51434df68f..dea76ea753 100644
--- a/gr-wxgui/src/python/constsink_gl.py
+++ b/gr-wxgui/python/wxgui/constsink_gl.py
@@ -24,7 +24,9 @@
##################################################
import const_window
import common
-from gnuradio import gr, blks2
+from gnuradio import gr
+from gnuradio import blocks
+from gnuradio import analog
from pubsub import pubsub
from constants import *
import sys
@@ -68,7 +70,7 @@ class const_sink_c(gr.hier_block2, common.wxgui_hb):
gr.io_signature(0, 0, 0),
)
#blocks
- sd = blks2.stream_to_vector_decimator(
+ sd = blocks.stream_to_vector_decimator(
item_size=gr.sizeof_gr_complex,
sample_rate=sample_rate,
vec_rate=frame_rate,
@@ -99,9 +101,9 @@ class const_sink_c(gr.hier_block2, common.wxgui_hb):
# gain_omega,
# omega_limit,
#)
- agc = gr.feedforward_agc_cc(16, 1)
+ agc = analog.feedforward_agc_cc(16, 1)
msgq = gr.msg_queue(2)
- sink = gr.message_sink(gr.sizeof_gr_complex*const_size, msgq, True)
+ sink = blocks.message_sink(gr.sizeof_gr_complex*const_size, msgq, True)
#controller
def setter(p, k, x): p[k] = x
self.controller = pubsub()
diff --git a/gr-wxgui/src/python/fft_window.py b/gr-wxgui/python/wxgui/fft_window.py
index fac83a4a34..ada926c418 100644
--- a/gr-wxgui/src/python/fft_window.py
+++ b/gr-wxgui/python/wxgui/fft_window.py
@@ -61,7 +61,9 @@ class control_panel(wx.Panel):
def __init__(self, parent):
"""
Create a new control panel.
- @param parent the wx parent window
+
+ Args:
+ parent: the wx parent window
"""
self.parent = parent
wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
@@ -324,7 +326,9 @@ class fft_window(wx.Panel, pubsub.pubsub):
If real, keep take only the positive bins.
Plot the samples onto the grid as channel 1.
If peak hold is enabled, plot peak vals as channel 2.
- @param msg the fft array as a character array
+
+ Args:
+ msg: the fft array as a character array
"""
if not self[RUNNING_KEY]: return
#convert to floating point numbers
diff --git a/gr-wxgui/src/python/fftsink2.py b/gr-wxgui/python/wxgui/fftsink2.py
index 3277cd3ffa..3277cd3ffa 100644
--- a/gr-wxgui/src/python/fftsink2.py
+++ b/gr-wxgui/python/wxgui/fftsink2.py
diff --git a/gr-wxgui/src/python/fftsink_gl.py b/gr-wxgui/python/wxgui/fftsink_gl.py
index dc31e84a10..272a2456ce 100644
--- a/gr-wxgui/src/python/fftsink_gl.py
+++ b/gr-wxgui/python/wxgui/fftsink_gl.py
@@ -1,5 +1,5 @@
#
-# Copyright 2008,2009,2010 Free Software Foundation, Inc.
+# Copyright 2008-2010,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -26,7 +26,10 @@ from __future__ import division
##################################################
import fft_window
import common
-from gnuradio import gr, blks2
+from gnuradio import gr, fft
+from gnuradio import analog
+from gnuradio import blocks
+from gnuradio.fft import logpwrfft
from pubsub import pubsub
from constants import *
import math
@@ -89,7 +92,7 @@ class _fft_sink_base(gr.hier_block2, common.wxgui_hb):
win=win,
)
msgq = gr.msg_queue(2)
- sink = gr.message_sink(gr.sizeof_float*fft_size, msgq, True)
+ sink = blocks.message_sink(gr.sizeof_float*fft_size, msgq, True)
#controller
@@ -132,12 +135,12 @@ class _fft_sink_base(gr.hier_block2, common.wxgui_hb):
self.win.set_callback(callb)
class fft_sink_f(_fft_sink_base):
- _fft_chain = blks2.logpwrfft_f
+ _fft_chain = logpwrfft.logpwrfft_f
_item_size = gr.sizeof_float
_real = True
class fft_sink_c(_fft_sink_base):
- _fft_chain = blks2.logpwrfft_c
+ _fft_chain = logpwrfft.logpwrfft_c
_item_size = gr.sizeof_gr_complex
_real = False
@@ -150,7 +153,7 @@ from gnuradio.wxgui import stdgui2
class test_app_block (stdgui2.std_top_block):
def __init__(self, frame, panel, vbox, argv):
- stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
+ stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)
fft_size = 256
@@ -158,44 +161,44 @@ class test_app_block (stdgui2.std_top_block):
input_rate = 2048.0e3
#Generate some noise
- noise =gr.noise_source_c(gr.GR_UNIFORM, 1.0/10)
+ noise = analog.noise_source_c(analog.GR_UNIFORM, 1.0/10)
# Generate a complex sinusoid
- #src1 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 2e3, 1)
- src1 = gr.sig_source_c (input_rate, gr.GR_CONST_WAVE, 57.50e3, 1)
+ #src1 = analog.sig_source_c(input_rate, analog.GR_SIN_WAVE, 2e3, 1)
+ src1 = analog.sig_source_c(input_rate, analog.GR_CONST_WAVE, 57.50e3, 1)
# We add these throttle blocks so that this demo doesn't
# suck down all the CPU available. Normally you wouldn't use these.
- thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate)
+ thr1 = blocks.throttle(gr.sizeof_gr_complex, input_rate)
- sink1 = fft_sink_c (panel, title="Complex Data", fft_size=fft_size,
- sample_rate=input_rate, baseband_freq=100e3,
- ref_level=0, y_per_div=20, y_divs=10)
- vbox.Add (sink1.win, 1, wx.EXPAND)
+ sink1 = fft_sink_c(panel, title="Complex Data", fft_size=fft_size,
+ sample_rate=input_rate, baseband_freq=100e3,
+ ref_level=0, y_per_div=20, y_divs=10)
+ vbox.Add(sink1.win, 1, wx.EXPAND)
- combine1=gr.add_cc()
+ combine1 = blocks.add_cc()
self.connect(src1, (combine1,0))
self.connect(noise,(combine1,1))
self.connect(combine1,thr1, sink1)
- #src2 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 2e3, 1)
- src2 = gr.sig_source_f (input_rate, gr.GR_CONST_WAVE, 57.50e3, 1)
- thr2 = gr.throttle(gr.sizeof_float, input_rate)
- sink2 = fft_sink_f (panel, title="Real Data", fft_size=fft_size*2,
- sample_rate=input_rate, baseband_freq=100e3,
- ref_level=0, y_per_div=20, y_divs=10)
- vbox.Add (sink2.win, 1, wx.EXPAND)
+ #src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 2e3, 1)
+ src2 = analog.sig_source_f (input_rate, analog.GR_CONST_WAVE, 57.50e3, 1)
+ thr2 = blocks.throttle(gr.sizeof_float, input_rate)
+ sink2 = fft_sink_f(panel, title="Real Data", fft_size=fft_size*2,
+ sample_rate=input_rate, baseband_freq=100e3,
+ ref_level=0, y_per_div=20, y_divs=10)
+ vbox.Add(sink2.win, 1, wx.EXPAND)
- combine2=gr.add_ff()
- c2f2=gr.complex_to_float()
+ combine2 = blocks.add_ff()
+ c2f2 = blocks.complex_to_float()
self.connect(src2, (combine2,0))
self.connect(noise,c2f2,(combine2,1))
self.connect(combine2, thr2,sink2)
def main ():
- app = stdgui2.stdapp (test_app_block, "FFT Sink Test App")
- app.MainLoop ()
+ app = stdgui2.stdapp(test_app_block, "FFT Sink Test App")
+ app.MainLoop()
if __name__ == '__main__':
- main ()
+ main()
diff --git a/gr-wxgui/src/python/fftsink_nongl.py b/gr-wxgui/python/wxgui/fftsink_nongl.py
index 473cc424c4..f567a22256 100644
--- a/gr-wxgui/src/python/fftsink_nongl.py
+++ b/gr-wxgui/python/wxgui/fftsink_nongl.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2003-2007,2009,2010 Free Software Foundation, Inc.
+# Copyright 2003-2007,2009,2010,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -20,8 +20,12 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, gru, window
+from gnuradio import gr, gru, fft
+import gnuradio.filter as grfilter
+from gnuradio import blocks
+from gnuradio import analog
from gnuradio.wxgui import stdgui2
+from gnuradio.filter import window
import wx
import plot
import numpy
@@ -37,7 +41,8 @@ class fft_sink_base(object):
y_divs=8, ref_level=50,
sample_rate=1, fft_size=512,
fft_rate=default_fft_rate,
- average=False, avg_alpha=None, title='', peak_hold=False,use_persistence=False,persist_alpha=0.2):
+ average=False, avg_alpha=None, title='',
+ peak_hold=False, use_persistence=False, persist_alpha=0.2):
# initialize common attributes
self.baseband_freq = baseband_freq
@@ -106,7 +111,8 @@ class fft_sink_f(gr.hier_block2, fft_sink_base):
def __init__(self, parent, baseband_freq=0, ref_scale=2.0,
y_per_div=10, y_divs=8, ref_level=50, sample_rate=1, fft_size=512,
fft_rate=default_fft_rate, average=False, avg_alpha=None,
- title='', size=default_fftsink_size, peak_hold=False, use_persistence=False,persist_alpha=0.2, **kwargs):
+ title='', size=default_fftsink_size, peak_hold=False,
+ use_persistence=False, persist_alpha=0.2, **kwargs):
gr.hier_block2.__init__(self, "fft_sink_f",
gr.io_signature(1, 1, gr.sizeof_float),
@@ -117,28 +123,29 @@ class fft_sink_f(gr.hier_block2, fft_sink_base):
sample_rate=sample_rate, fft_size=fft_size,
fft_rate=fft_rate,
average=average, avg_alpha=avg_alpha, title=title,
- peak_hold=peak_hold,use_persistence=use_persistence,persist_alpha=persist_alpha)
+ peak_hold=peak_hold, use_persistence=use_persistence,
+ persist_alpha=persist_alpha)
- self.s2p = gr.stream_to_vector(gr.sizeof_float, self.fft_size)
- self.one_in_n = gr.keep_one_in_n(gr.sizeof_float * self.fft_size,
- max(1, int(self.sample_rate/self.fft_size/self.fft_rate)))
+ self.s2p = blocks.stream_to_vector(gr.sizeof_float, self.fft_size)
+ self.one_in_n = blocks.keep_one_in_n(gr.sizeof_float * self.fft_size,
+ max(1, int(self.sample_rate/self.fft_size/self.fft_rate)))
mywindow = window.blackmanharris(self.fft_size)
- self.fft = gr.fft_vfc(self.fft_size, True, mywindow)
+ self.fft = fft.fft_vfc(self.fft_size, True, mywindow)
power = 0
for tap in mywindow:
power += tap*tap
- self.c2mag = gr.complex_to_mag(self.fft_size)
- self.avg = gr.single_pole_iir_filter_ff(1.0, self.fft_size)
+ self.c2mag = blocks.complex_to_mag(self.fft_size)
+ self.avg = grfilter.single_pole_iir_filter_ff(1.0, self.fft_size)
# FIXME We need to add 3dB to all bins but the DC bin
- self.log = gr.nlog10_ff(20, self.fft_size,
+ self.log = blocks.nlog10_ff(20, self.fft_size,
-20*math.log10(self.fft_size) # Adjust for number of bins
-10*math.log10(power/self.fft_size) # Adjust for windowing loss
-20*math.log10(ref_scale/2)) # Adjust for reference scale
- self.sink = gr.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True)
+ self.sink = blocks.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True)
self.connect(self, self.s2p, self.one_in_n, self.fft, self.c2mag, self.avg, self.log, self.sink)
self.win = fft_window(self, parent, size=size)
@@ -151,7 +158,8 @@ class fft_sink_c(gr.hier_block2, fft_sink_base):
def __init__(self, parent, baseband_freq=0, ref_scale=2.0,
y_per_div=10, y_divs=8, ref_level=50, sample_rate=1, fft_size=512,
fft_rate=default_fft_rate, average=False, avg_alpha=None,
- title='', size=default_fftsink_size, peak_hold=False, use_persistence=False,persist_alpha=0.2, **kwargs):
+ title='', size=default_fftsink_size, peak_hold=False,
+ use_persistence=False, persist_alpha=0.2, **kwargs):
gr.hier_block2.__init__(self, "fft_sink_c",
gr.io_signature(1, 1, gr.sizeof_gr_complex),
@@ -162,28 +170,29 @@ class fft_sink_c(gr.hier_block2, fft_sink_base):
sample_rate=sample_rate, fft_size=fft_size,
fft_rate=fft_rate,
average=average, avg_alpha=avg_alpha, title=title,
- peak_hold=peak_hold, use_persistence=use_persistence,persist_alpha=persist_alpha)
+ peak_hold=peak_hold, use_persistence=use_persistence,
+ persist_alpha=persist_alpha)
- self.s2p = gr.stream_to_vector(gr.sizeof_gr_complex, self.fft_size)
- self.one_in_n = gr.keep_one_in_n(gr.sizeof_gr_complex * self.fft_size,
- max(1, int(self.sample_rate/self.fft_size/self.fft_rate)))
+ self.s2p = blocks.stream_to_vector(gr.sizeof_gr_complex, self.fft_size)
+ self.one_in_n = blocks.keep_one_in_n(gr.sizeof_gr_complex * self.fft_size,
+ max(1, int(self.sample_rate/self.fft_size/self.fft_rate)))
mywindow = window.blackmanharris(self.fft_size)
- self.fft = gr.fft_vcc(self.fft_size, True, mywindow)
+ self.fft = fft.fft_vcc(self.fft_size, True, mywindow)
power = 0
for tap in mywindow:
power += tap*tap
- self.c2mag = gr.complex_to_mag(self.fft_size)
- self.avg = gr.single_pole_iir_filter_ff(1.0, self.fft_size)
+ self.c2mag = blocks.complex_to_mag(self.fft_size)
+ self.avg = grfilter.single_pole_iir_filter_ff(1.0, self.fft_size)
# FIXME We need to add 3dB to all bins but the DC bin
- self.log = gr.nlog10_ff(20, self.fft_size,
+ self.log = blocks.nlog10_ff(20, self.fft_size,
-20*math.log10(self.fft_size) # Adjust for number of bins
-10*math.log10(power/self.fft_size) # Adjust for windowing loss
-20*math.log10(ref_scale/2)) # Adjust for reference scale
- self.sink = gr.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True)
+ self.sink = blocks.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True)
self.connect(self, self.s2p, self.one_in_n, self.fft, self.c2mag, self.avg, self.log, self.sink)
self.win = fft_window(self, parent, size=size)
@@ -613,12 +622,12 @@ class test_app_block (stdgui2.std_top_block):
# We add these throttle blocks so that this demo doesn't
# suck down all the CPU available. Normally you wouldn't use these.
- thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate)
+ thr1 = blocks.throttle(gr.sizeof_gr_complex, input_rate)
- sink1 = fft_sink_c (panel, title="Complex Data", fft_size=fft_size,
- sample_rate=input_rate, baseband_freq=100e3,
- ref_level=0, y_per_div=20, y_divs=10)
- vbox.Add (sink1.win, 1, wx.EXPAND)
+ sink1 = fft_sink_c(panel, title="Complex Data", fft_size=fft_size,
+ sample_rate=input_rate, baseband_freq=100e3,
+ ref_level=0, y_per_div=20, y_divs=10)
+ vbox.Add(sink1.win, 1, wx.EXPAND)
self.connect(src1, (add1,0))
self.connect(noise1, (add1,1))
@@ -640,8 +649,8 @@ class test_app_block (stdgui2.std_top_block):
self.connect(add2, thr2, sink2)
def main ():
- app = stdgui2.stdapp (test_app_block, "FFT Sink Test App")
- app.MainLoop ()
+ app = stdgui2.stdapp(test_app_block, "FFT Sink Test App")
+ app.MainLoop()
if __name__ == '__main__':
main ()
diff --git a/gr-wxgui/src/python/form.py b/gr-wxgui/python/wxgui/form.py
index 0442e49c84..0442e49c84 100644
--- a/gr-wxgui/src/python/form.py
+++ b/gr-wxgui/python/wxgui/form.py
diff --git a/gr-wxgui/src/python/forms/__init__.py b/gr-wxgui/python/wxgui/forms/__init__.py
index 3068b18fe1..67d3b4a88a 100644
--- a/gr-wxgui/src/python/forms/__init__.py
+++ b/gr-wxgui/python/wxgui/forms/__init__.py
@@ -48,13 +48,15 @@ import wx
class static_box_sizer(wx.StaticBoxSizer):
"""
A box sizer with label and border.
- @param parent the parent widget
- @param sizer add this widget to sizer if provided (optional)
- @param proportion the proportion when added to the sizer (default=0)
- @param flag the flag argument when added to the sizer (default=wx.EXPAND)
- @param label title label for this widget (optional)
- @param bold true to boldify the label
- @param orient the sizer orientation wx.VERTICAL or wx.HORIZONTAL (default=wx.VERTICAL)
+
+ Args:
+ parent: the parent widget
+ sizer: add this widget to sizer if provided (optional)
+ proportion: the proportion when added to the sizer (default=0)
+ flag: the flag argument when added to the sizer (default=wx.EXPAND)
+ label: title label for this widget (optional)
+ bold: true to boldify the label
+ orient: the sizer orientation wx.VERTICAL or wx.HORIZONTAL (default=wx.VERTICAL)
"""
def __init__(self, parent, label='', bold=False, sizer=None, orient=wx.VERTICAL, proportion=0, flag=wx.EXPAND):
box = wx.StaticBox(parent=parent, label=label)
@@ -65,20 +67,17 @@ class static_box_sizer(wx.StaticBoxSizer):
class incr_decr_buttons(wx.BoxSizer):
"""
A horizontal box sizer with a increment and a decrement button.
- @param parent the parent widget
- @param sizer add this widget to sizer if provided (optional)
- @param proportion the proportion when added to the sizer (default=0)
- @param flag the flag argument when added to the sizer (default=wx.EXPAND)
- @param label title label for this widget (optional)
- @param on_incr the callback for pressing the + button
- @param on_decr the callback for pressing the - button
+
+ Args:
+ parent: the parent widget
+ on_incr: the callback for pressing the + button
+ on_decr: the callback for pressing the - button
+ label: title label for this widget (optional)
+ sizer: add this widget to sizer if provided (optional)
+ proportion: the proportion when added to the sizer (default=0)
+ flag: the flag argument when added to the sizer (default=wx.EXPAND)
"""
def __init__(self, parent, on_incr, on_decr, label='', sizer=None, proportion=0, flag=wx.EXPAND):
- """
- @param parent the parent window
- @param on_incr the event handler for increment
- @param on_decr the event handler for decrement
- """
wx.BoxSizer.__init__(self, wx.HORIZONTAL)
buttons_box = wx.BoxSizer(wx.HORIZONTAL)
self._incr_button = wx.Button(parent, label='+', style=wx.BU_EXACTFIT)
diff --git a/gr-wxgui/src/python/forms/converters.py b/gr-wxgui/python/wxgui/forms/converters.py
index db14d2752c..db14d2752c 100644
--- a/gr-wxgui/src/python/forms/converters.py
+++ b/gr-wxgui/python/wxgui/forms/converters.py
diff --git a/gr-wxgui/src/python/forms/forms.py b/gr-wxgui/python/wxgui/forms/forms.py
index cabc5860b9..80822ae174 100644
--- a/gr-wxgui/src/python/forms/forms.py
+++ b/gr-wxgui/python/wxgui/forms/forms.py
@@ -90,11 +90,13 @@ class _form_base(pubsub, wx.BoxSizer):
Bind the update handler to the widget for data events.
This ensures that the gui thread handles updating widgets.
Setup the pusub triggers for external and internal.
- @param widget the main widget
- @param label the optional label
- @param flag additional flags for widget
- @param label_prop the proportion for the label
- @param widget_prop the proportion for the widget
+
+ Args:
+ widget: the main widget
+ label: the optional label
+ flag: additional flags for widget
+ label_prop: the proportion for the label
+ widget_prop: the proportion for the widget
"""
#setup data event
widget.Bind(EVT_DATA, lambda x: self._update(x.data))
@@ -184,18 +186,20 @@ class _slider_base(_form_base):
class static_text(_form_base):
"""
A text box form.
- @param parent the parent widget
- @param sizer add this widget to sizer if provided (optional)
- @param proportion the proportion when added to the sizer (default=0)
- @param flag the flag argument when added to the sizer (default=wx.EXPAND)
- @param ps the pubsub object (optional)
- @param key the pubsub key (optional)
- @param value the default value (optional)
- @param label title label for this widget (optional)
- @param width the width of the form in px
- @param bold true to bold-ify the text (default=False)
- @param units a suffix to add after the text
- @param converter forms.str_converter(), int_converter(), float_converter()...
+
+ Args:
+ parent: the parent widget
+ sizer: add this widget to sizer if provided (optional)
+ proportion: the proportion when added to the sizer (default=0)
+ flag: the flag argument when added to the sizer (default=wx.EXPAND)
+ ps: the pubsub object (optional)
+ key: the pubsub key (optional)
+ value: the default value (optional)
+ label: title label for this widget (optional)
+ width: the width of the form in px
+ bold: true to bold-ify the text (default=False)
+ units: a suffix to add after the text
+ converter: forms.str_converter(), int_converter(), float_converter()...
"""
def __init__(self, label='', width=-1, bold=False, units='', converter=converters.str_converter(), **kwargs):
self._units = units
@@ -214,16 +218,18 @@ class static_text(_form_base):
class text_box(_form_base):
"""
A text box form.
- @param parent the parent widget
- @param sizer add this widget to sizer if provided (optional)
- @param proportion the proportion when added to the sizer (default=0)
- @param flag the flag argument when added to the sizer (default=wx.EXPAND)
- @param ps the pubsub object (optional)
- @param key the pubsub key (optional)
- @param value the default value (optional)
- @param label title label for this widget (optional)
- @param width the width of the form in px
- @param converter forms.str_converter(), int_converter(), float_converter()...
+
+ Args:
+ parent: the parent widget
+ sizer: add this widget to sizer if provided (optional)
+ proportion: the proportion when added to the sizer (default=0)
+ flag: the flag argument when added to the sizer (default=wx.EXPAND)
+ ps: the pubsub object (optional)
+ key: the pubsub key (optional)
+ value: the default value (optional)
+ label: title label for this widget (optional)
+ width: the width of the form in px
+ converter: forms.str_converter(), int_converter(), float_converter()...
"""
def __init__(self, label='', width=-1, converter=converters.eval_converter(), **kwargs):
_form_base.__init__(self, converter=converter, **kwargs)
@@ -249,21 +255,23 @@ class text_box(_form_base):
class slider(_slider_base):
"""
A generic linear slider.
- @param parent the parent widget
- @param sizer add this widget to sizer if provided (optional)
- @param proportion the proportion when added to the sizer (default=0)
- @param flag the flag argument when added to the sizer (default=wx.EXPAND)
- @param ps the pubsub object (optional)
- @param key the pubsub key (optional)
- @param value the default value (optional)
- @param label title label for this widget (optional)
- @param length the length of the slider in px (optional)
- @param style wx.SL_HORIZONTAL or wx.SL_VERTICAL (default=horizontal)
- @param minimum the minimum value
- @param maximum the maximum value
- @param num_steps the number of slider steps (or specify step_size)
- @param step_size the step between slider jumps (or specify num_steps)
- @param cast a cast function, int, or float (default=float)
+
+ Args:
+ parent: the parent widget
+ sizer: add this widget to sizer if provided (optional)
+ proportion: the proportion when added to the sizer (default=0)
+ flag: the flag argument when added to the sizer (default=wx.EXPAND)
+ ps: the pubsub object (optional)
+ key: the pubsub key (optional)
+ value: the default value (optional)
+ label: title label for this widget (optional)
+ length: the length of the slider in px (optional)
+ style: wx.SL_HORIZONTAL or wx.SL_VERTICAL (default=horizontal)
+ minimum: the minimum value
+ maximum: the maximum value
+ num_steps: the number of slider steps (or specify step_size)
+ step_size: the step between slider jumps (or specify num_steps)
+ cast: a cast function, int, or float (default=float)
"""
def __init__(self, minimum=-100, maximum=100, num_steps=100, step_size=None, cast=float, **kwargs):
assert step_size or num_steps
@@ -275,21 +283,23 @@ class log_slider(_slider_base):
"""
A generic logarithmic slider.
The sliders min and max values are base**min_exp and base**max_exp.
- @param parent the parent widget
- @param sizer add this widget to sizer if provided (optional)
- @param proportion the proportion when added to the sizer (default=0)
- @param flag the flag argument when added to the sizer (default=wx.EXPAND)
- @param ps the pubsub object (optional)
- @param key the pubsub key (optional)
- @param value the default value (optional)
- @param label title label for this widget (optional)
- @param length the length of the slider in px (optional)
- @param style wx.SL_HORIZONTAL or wx.SL_VERTICAL (default=horizontal)
- @param min_exp the minimum exponent
- @param max_exp the maximum exponent
- @param base the exponent base in base**exp
- @param num_steps the number of slider steps (or specify step_size)
- @param step_size the exponent step size (or specify num_steps)
+
+ Args:
+ parent: the parent widget
+ sizer: add this widget to sizer if provided (optional)
+ proportion: the proportion when added to the sizer (default=0)
+ flag: the flag argument when added to the sizer (default=wx.EXPAND)
+ ps: the pubsub object (optional)
+ key: the pubsub key (optional)
+ value: the default value (optional)
+ label: title label for this widget (optional)
+ length: the length of the slider in px (optional)
+ style: wx.SL_HORIZONTAL or wx.SL_VERTICAL (default=horizontal)
+ min_exp: the minimum exponent
+ max_exp: the maximum exponent
+ base: the exponent base in base**exp
+ num_steps: the number of slider steps (or specify step_size)
+ step_size: the exponent step size (or specify num_steps)
"""
def __init__(self, min_exp=0, max_exp=1, base=10, num_steps=100, step_size=None, **kwargs):
assert step_size or num_steps
@@ -304,20 +314,22 @@ class gauge(_form_base):
"""
A gauge bar.
The gauge displays floating point values between the minimum and maximum.
- @param parent the parent widget
- @param sizer add this widget to sizer if provided (optional)
- @param proportion the proportion when added to the sizer (default=0)
- @param flag the flag argument when added to the sizer (default=wx.EXPAND)
- @param ps the pubsub object (optional)
- @param key the pubsub key (optional)
- @param value the default value (optional)
- @param label title label for this widget (optional)
- @param length the length of the slider in px (optional)
- @param style wx.GA_HORIZONTAL or wx.GA_VERTICAL (default=horizontal)
- @param minimum the minimum value
- @param maximum the maximum value
- @param num_steps the number of slider steps (or specify step_size)
- @param step_size the step between slider jumps (or specify num_steps)
+
+ Args:
+ parent: the parent widget
+ sizer: add this widget to sizer if provided (optional)
+ proportion: the proportion when added to the sizer (default=0)
+ flag: the flag argument when added to the sizer (default=wx.EXPAND)
+ ps: the pubsub object (optional)
+ key: the pubsub key (optional)
+ value: the default value (optional)
+ label: title label for this widget (optional)
+ length: the length of the slider in px (optional)
+ style: wx.GA_HORIZONTAL or wx.GA_VERTICAL (default=horizontal)
+ minimum: the minimum value
+ maximum: the maximum value
+ num_steps: the number of slider steps (or specify step_size)
+ step_size: the step between slider jumps (or specify num_steps)
"""
def __init__(self, label='', length=-1, minimum=-100, maximum=100, num_steps=100, step_size=None, style=wx.GA_HORIZONTAL, **kwargs):
assert step_size or num_steps
@@ -338,16 +350,18 @@ class gauge(_form_base):
class check_box(_form_base):
"""
Create a check box form.
- @param parent the parent widget
- @param sizer add this widget to sizer if provided (optional)
- @param proportion the proportion when added to the sizer (default=0)
- @param flag the flag argument when added to the sizer (default=wx.EXPAND)
- @param ps the pubsub object (optional)
- @param key the pubsub key (optional)
- @param value the default value (optional)
- @param true the value for form when checked (default=True)
- @param false the value for form when unchecked (default=False)
- @param label title label for this widget (optional)
+
+ Args:
+ parent: the parent widget
+ sizer: add this widget to sizer if provided (optional)
+ proportion: the proportion when added to the sizer (default=0)
+ flag: the flag argument when added to the sizer (default=wx.EXPAND)
+ ps: the pubsub object (optional)
+ key: the pubsub key (optional)
+ value: the default value (optional)
+ true: the value for form when checked (default=True)
+ false: the value for form when unchecked (default=False)
+ label: title label for this widget (optional)
"""
def __init__(self, label='', true=True, false=False, **kwargs):
_form_base.__init__(self, converter=converters.bool_converter(true=true, false=false), **kwargs)
@@ -364,17 +378,19 @@ class check_box(_form_base):
class drop_down(_chooser_base):
"""
Create a drop down menu form.
- @param parent the parent widget
- @param sizer add this widget to sizer if provided (optional)
- @param proportion the proportion when added to the sizer (default=0)
- @param flag the flag argument when added to the sizer (default=wx.EXPAND)
- @param ps the pubsub object (optional)
- @param key the pubsub key (optional)
- @param value the default value (optional)
- @param choices list of possible values
- @param labels list of labels for each choice (default=choices)
- @param label title label for this widget (optional)
- @param width the form width in px (optional)
+
+ Args:
+ parent: the parent widget
+ sizer: add this widget to sizer if provided (optional)
+ proportion: the proportion when added to the sizer (default=0)
+ flag: the flag argument when added to the sizer (default=wx.EXPAND)
+ ps: the pubsub object (optional)
+ key: the pubsub key (optional)
+ value: the default value (optional)
+ choices: list of possible values
+ labels: list of labels for each choice (default=choices)
+ label: title label for this widget (optional)
+ width: the form width in px (optional)
"""
def __init__(self, label='', width=-1, **kwargs):
_chooser_base.__init__(self, **kwargs)
@@ -394,18 +410,18 @@ class drop_down(_chooser_base):
class button(_chooser_base):
"""
Create a multi-state button.
- @param parent the parent widget
- @param sizer add this widget to sizer if provided (optional)
- @param proportion the proportion when added to the sizer (default=0)
- @param flag the flag argument when added to the sizer (default=wx.EXPAND)
- @param ps the pubsub object (optional)
- @param key the pubsub key (optional)
- @param value the default value (optional)
- @param choices list of possible values
- @param labels list of labels for each choice (default=choices)
- @param width the width of the button in pixels (optional)
- @param style style arguments (optional)
- @param label title label for this widget (optional)
+ parent the parent widget
+ sizer add this widget to sizer if provided (optional)
+ proportion the proportion when added to the sizer (default=0)
+ flag the flag argument when added to the sizer (default=wx.EXPAND)
+ ps the pubsub object (optional)
+ key the pubsub key (optional)
+ value the default value (optional)
+ choices list of possible values
+ labels list of labels for each choice (default=choices)
+ width the width of the button in pixels (optional)
+ style style arguments (optional)
+ label title label for this widget (optional)
"""
def __init__(self, label='', style=0, width=-1, **kwargs):
_chooser_base.__init__(self, **kwargs)
@@ -420,17 +436,19 @@ class toggle_button(button):
"""
Create a dual-state button.
This button will alternate between True and False when clicked.
- @param parent the parent widget
- @param sizer add this widget to sizer if provided (optional)
- @param proportion the proportion when added to the sizer (default=0)
- @param flag the flag argument when added to the sizer (default=wx.EXPAND)
- @param ps the pubsub object (optional)
- @param key the pubsub key (optional)
- @param value the default value (optional)
- @param width the width of the button in pixels (optional)
- @param style style arguments (optional)
- @param true_label the button's label in the true state
- @param false_label the button's label in the false state
+
+ Args:
+ parent: the parent widget
+ sizer: add this widget to sizer if provided (optional)
+ proportion: the proportion when added to the sizer (default=0)
+ flag: the flag argument when added to the sizer (default=wx.EXPAND)
+ ps: the pubsub object (optional)
+ key: the pubsub key (optional)
+ value: the default value (optional)
+ width: the width of the button in pixels (optional)
+ style: style arguments (optional)
+ true_label: the button's label in the true state
+ false_label: the button's label in the false state
"""
def __init__(self, true_label='On (click to stop)', false_label='Off (click to start)', **kwargs):
button.__init__(self, choices=[True, False], labels=[true_label, false_label], **kwargs)
@@ -440,16 +458,18 @@ class single_button(toggle_button):
Create a single state button.
This button will callback() when clicked.
For use when state holding is not important.
- @param parent the parent widget
- @param sizer add this widget to sizer if provided (optional)
- @param proportion the proportion when added to the sizer (default=0)
- @param flag the flag argument when added to the sizer (default=wx.EXPAND)
- @param ps the pubsub object (optional)
- @param key the pubsub key (optional)
- @param value the default value (optional)
- @param width the width of the button in pixels (optional)
- @param style style arguments (optional)
- @param label the button's label
+
+ Args:
+ parent: the parent widget
+ sizer: add this widget to sizer if provided (optional)
+ proportion: the proportion when added to the sizer (default=0)
+ flag: the flag argument when added to the sizer (default=wx.EXPAND)
+ ps: the pubsub object (optional)
+ key: the pubsub key (optional)
+ value: the default value (optional)
+ width: the width of the button in pixels (optional)
+ style: style arguments (optional)
+ label: the button's label
"""
def __init__(self, label='click for callback', **kwargs):
toggle_button.__init__(self, true_label=label, false_label=label, value=True, **kwargs)
@@ -460,18 +480,20 @@ class single_button(toggle_button):
class radio_buttons(_chooser_base):
"""
Create a radio button form.
- @param parent the parent widget
- @param sizer add this widget to sizer if provided (optional)
- @param proportion the proportion when added to the sizer (default=0)
- @param flag the flag argument when added to the sizer (default=wx.EXPAND)
- @param ps the pubsub object (optional)
- @param key the pubsub key (optional)
- @param value the default value (optional)
- @param choices list of possible values
- @param labels list of labels for each choice (default=choices)
- @param major_dimension the number of rows/cols (default=auto)
- @param label title label for this widget (optional)
- @param style useful style args: wx.RA_HORIZONTAL, wx.RA_VERTICAL, wx.NO_BORDER (default=wx.RA_HORIZONTAL)
+
+ Args:
+ parent: the parent widget
+ sizer: add this widget to sizer if provided (optional)
+ proportion: the proportion when added to the sizer (default=0)
+ flag: the flag argument when added to the sizer (default=wx.EXPAND)
+ ps: the pubsub object (optional)
+ key: the pubsub key (optional)
+ value the default value (optional)
+ choices: list of possible values
+ labels: list of labels for each choice (default=choices)
+ major_dimension: the number of rows/cols (default=auto)
+ label: title label for this widget (optional)
+ style: useful style args: wx.RA_HORIZONTAL, wx.RA_VERTICAL, wx.NO_BORDER (default=wx.RA_HORIZONTAL)
"""
def __init__(self, style=wx.RA_HORIZONTAL, label='', major_dimension=0, **kwargs):
_chooser_base.__init__(self, **kwargs)
diff --git a/gr-wxgui/src/python/gui.py b/gr-wxgui/python/wxgui/gui.py
index ccc773eabf..ccc773eabf 100644
--- a/gr-wxgui/src/python/gui.py
+++ b/gr-wxgui/python/wxgui/gui.py
diff --git a/gr-wxgui/src/python/histo_window.py b/gr-wxgui/python/wxgui/histo_window.py
index a1b520f9c1..3e38fdcb64 100644
--- a/gr-wxgui/src/python/histo_window.py
+++ b/gr-wxgui/python/wxgui/histo_window.py
@@ -48,7 +48,9 @@ class control_panel(wx.Panel):
def __init__(self, parent):
"""
Create a new control panel.
- @param parent the wx parent window
+
+ Args:
+ parent: the wx parent window
"""
self.parent = parent
wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
@@ -134,7 +136,9 @@ class histo_window(wx.Panel, pubsub.pubsub):
def handle_msg(self, msg):
"""
Handle the message from the fft sink message queue.
- @param msg the frame as a character array
+
+ Args:
+ msg: the frame as a character array
"""
if not self[RUNNING_KEY]: return
#convert to floating point numbers
diff --git a/gr-wxgui/src/python/histosink_gl.py b/gr-wxgui/python/wxgui/histosink_gl.py
index 509f746be6..2126d63191 100644
--- a/gr-wxgui/src/python/histosink_gl.py
+++ b/gr-wxgui/python/wxgui/histosink_gl.py
@@ -1,5 +1,5 @@
#
-# Copyright 2009 Free Software Foundation, Inc.
+# Copyright 2009,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -24,7 +24,10 @@
##################################################
import histo_window
import common
-from gnuradio import gr, blks2
+from gnuradio import gr
+from gnuradio import analog
+from gnuradio import blocks
+from gnuradio import wxgui
from pubsub import pubsub
from constants import *
@@ -53,7 +56,7 @@ class histo_sink_f(gr.hier_block2, common.wxgui_hb):
)
#blocks
msgq = gr.msg_queue(2)
- histo = gr.histo_sink_f(msgq)
+ histo = wxgui.histo_sink_f(msgq)
histo.set_num_bins(num_bins)
histo.set_frame_size(frame_size)
#controller
@@ -94,17 +97,17 @@ class test_app_block (stdgui2.std_top_block):
# build our flow graph
input_rate = 20.48e3
- src2 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 2e3, 1)
- #src2 = gr.sig_source_f (input_rate, gr.GR_CONST_WAVE, 5.75e3, 1)
- thr2 = gr.throttle(gr.sizeof_float, input_rate)
- sink2 = histo_sink_f (panel, title="Data", num_bins=31, frame_size=1000)
- vbox.Add (sink2.win, 1, wx.EXPAND)
+ src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 2e3, 1)
+ #src2 = analog.sig_source_f(input_rate, analog.GR_CONST_WAVE, 5.75e3, 1)
+ thr2 = blocks.throttle(gr.sizeof_float, input_rate)
+ sink2 = histo_sink_f(panel, title="Data", num_bins=31, frame_size=1000)
+ vbox.Add(sink2.win, 1, wx.EXPAND)
self.connect(src2, thr2, sink2)
def main ():
- app = stdgui2.stdapp (test_app_block, "Histo Sink Test App")
- app.MainLoop ()
+ app = stdgui2.stdapp(test_app_block, "Histo Sink Test App")
+ app.MainLoop()
if __name__ == '__main__':
- main ()
+ main()
diff --git a/gr-wxgui/src/python/number_window.py b/gr-wxgui/python/wxgui/number_window.py
index ab9d1ebc00..751047db94 100644
--- a/gr-wxgui/src/python/number_window.py
+++ b/gr-wxgui/python/wxgui/number_window.py
@@ -54,7 +54,9 @@ class control_panel(wx.Panel):
def __init__(self, parent):
"""
Create a new control panel.
- @param parent the wx parent window
+
+ Args:
+ parent: the wx parent window
"""
self.parent = parent
wx.Panel.__init__(self, parent)
@@ -176,7 +178,9 @@ class number_window(wx.Panel, pubsub.pubsub):
"""
Show or hide the gauges.
If this is real, never show the imaginary gauge.
- @param show_gauge true to show
+
+ Args:
+ show_gauge: true to show
"""
self.gauge_real.ShowItems(show_gauge)
self.gauge_imag.ShowItems(show_gauge and not self.real)
@@ -187,7 +191,9 @@ class number_window(wx.Panel, pubsub.pubsub):
Convert the string based message into a float or complex.
If more than one number was read, only take the last number.
Perform peak hold operations, set the gauges and display.
- @param event event.data is the number sample as a character array
+
+ Args:
+ event: event.data is the number sample as a character array
"""
if not self[RUNNING_KEY]: return
format_string = "%%.%df"%self.decimal_places
diff --git a/gr-wxgui/src/python/numbersink2.py b/gr-wxgui/python/wxgui/numbersink2.py
index 011acdfd5e..62a096e112 100644
--- a/gr-wxgui/src/python/numbersink2.py
+++ b/gr-wxgui/python/wxgui/numbersink2.py
@@ -1,5 +1,5 @@
#
-# Copyright 2008 Free Software Foundation, Inc.
+# Copyright 2008,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -24,7 +24,9 @@
##################################################
import number_window
import common
-from gnuradio import gr, blks2
+from gnuradio import gr, filter
+from gnuradio import analog
+from gnuradio import blocks
from pubsub import pubsub
from constants import *
@@ -65,22 +67,22 @@ class _number_sink_base(gr.hier_block2, common.wxgui_hb):
gr.io_signature(0, 0, 0),
)
#blocks
- sd = blks2.stream_to_vector_decimator(
+ sd = blocks.stream_to_vector_decimator(
item_size=self._item_size,
sample_rate=sample_rate,
vec_rate=number_rate,
vec_len=1,
)
if self._real:
- mult = gr.multiply_const_ff(factor)
- add = gr.add_const_ff(ref_level)
- avg = gr.single_pole_iir_filter_ff(1.0)
+ mult = blocks.multiply_const_ff(factor)
+ add = blocks.add_const_ff(ref_level)
+ avg = filter.single_pole_iir_filter_ff(1.0)
else:
- mult = gr.multiply_const_cc(factor)
- add = gr.add_const_cc(ref_level)
- avg = gr.single_pole_iir_filter_cc(1.0)
+ mult = blocks.multiply_const_cc(factor)
+ add = blocks.add_const_cc(ref_level)
+ avg = filter.single_pole_iir_filter_cc(1.0)
msgq = gr.msg_queue(2)
- sink = gr.message_sink(self._item_size, msgq, True)
+ sink = blocks.message_sink(self._item_size, msgq, True)
#controller
self.controller = pubsub()
self.controller.subscribe(SAMPLE_RATE_KEY, sd.set_sample_rate)
@@ -134,38 +136,38 @@ class number_sink_c(_number_sink_base):
import wx
from gnuradio.wxgui import stdgui2
-class test_app_flow_graph (stdgui2.std_top_block):
+class test_app_flow_graph(stdgui2.std_top_block):
def __init__(self, frame, panel, vbox, argv):
- stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
+ stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)
# build our flow graph
input_rate = 20.48e3
# Generate a real and complex sinusoids
- src1 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 2.21e3, 1)
- src2 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 2.21e3, 1)
+ src1 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 2.21e3, 1)
+ src2 = analog.sig_source_c(input_rate, analog.GR_SIN_WAVE, 2.21e3, 1)
# We add these throttle blocks so that this demo doesn't
# suck down all the CPU available. Normally you wouldn't use these.
- thr1 = gr.throttle(gr.sizeof_float, input_rate)
- thr2 = gr.throttle(gr.sizeof_gr_complex, input_rate)
+ thr1 = blocks.throttle(gr.sizeof_float, input_rate)
+ thr2 = blocks.throttle(gr.sizeof_gr_complex, input_rate)
- sink1 = number_sink_f (panel, unit='V',label="Real Data", avg_alpha=0.001,
- sample_rate=input_rate, minval=-1, maxval=1,
- ref_level=0, decimal_places=3)
- vbox.Add (sink1.win, 1, wx.EXPAND)
- sink2 = number_sink_c (panel, unit='V',label="Complex Data", avg_alpha=0.001,
- sample_rate=input_rate, minval=-1, maxval=1,
- ref_level=0, decimal_places=3)
- vbox.Add (sink2.win, 1, wx.EXPAND)
+ sink1 = number_sink_f(panel, unit='V',label="Real Data", avg_alpha=0.001,
+ sample_rate=input_rate, minval=-1, maxval=1,
+ ref_level=0, decimal_places=3)
+ vbox.Add(sink1.win, 1, wx.EXPAND)
+ sink2 = number_sink_c(panel, unit='V',label="Complex Data", avg_alpha=0.001,
+ sample_rate=input_rate, minval=-1, maxval=1,
+ ref_level=0, decimal_places=3)
+ vbox.Add(sink2.win, 1, wx.EXPAND)
- self.connect (src1, thr1, sink1)
- self.connect (src2, thr2, sink2)
+ self.connect(src1, thr1, sink1)
+ self.connect(src2, thr2, sink2)
def main ():
- app = stdgui2.stdapp (test_app_flow_graph, "Number Sink Test App")
- app.MainLoop ()
+ app = stdgui2.stdapp(test_app_flow_graph, "Number Sink Test App")
+ app.MainLoop()
if __name__ == '__main__':
- main ()
+ main()
diff --git a/gr-wxgui/src/python/plot.py b/gr-wxgui/python/wxgui/plot.py
index 041a2a7a50..041a2a7a50 100644
--- a/gr-wxgui/src/python/plot.py
+++ b/gr-wxgui/python/wxgui/plot.py
diff --git a/gr-wxgui/src/python/plotter/__init__.py b/gr-wxgui/python/wxgui/plotter/__init__.py
index 616492a3e6..616492a3e6 100644
--- a/gr-wxgui/src/python/plotter/__init__.py
+++ b/gr-wxgui/python/wxgui/plotter/__init__.py
diff --git a/gr-wxgui/src/python/plotter/bar_plotter.py b/gr-wxgui/python/wxgui/plotter/bar_plotter.py
index 3f9259e9df..487db66b64 100644
--- a/gr-wxgui/src/python/plotter/bar_plotter.py
+++ b/gr-wxgui/python/wxgui/plotter/bar_plotter.py
@@ -108,9 +108,13 @@ class bar_plotter(grid_plotter_base):
Get the text the will populate the point label.
Give X and Y values for the current point.
Give values for the channel at the X coordinate.
- @param x_val the current x value
- @param y_val the current y value
- @return a string with newlines
+
+ Args:
+ x_val: the current x value
+ y_val: the current y value
+
+ Returns:
+ a string with newlines
"""
if len(self._bars) == 0: return ''
scalar = float(len(self._bars)-1)/(self.x_max - self.x_min)
@@ -130,9 +134,11 @@ class bar_plotter(grid_plotter_base):
def set_bars(self, bars, bar_width, color_spec):
"""
Set the bars.
- @param bars a list of bars
- @param bar_width the fractional width of the bar, between 0 and 1
- @param color_spec the color tuple
+
+ Args:
+ bars: a list of bars
+ bar_width: the fractional width of the bar, between 0 and 1
+ color_spec: the color tuple
"""
self.lock()
self._bars = bars
diff --git a/gr-wxgui/src/python/plotter/channel_plotter.py b/gr-wxgui/python/wxgui/plotter/channel_plotter.py
index 4bcc36fd4c..1eac9f5f3a 100644
--- a/gr-wxgui/src/python/plotter/channel_plotter.py
+++ b/gr-wxgui/python/wxgui/plotter/channel_plotter.py
@@ -67,8 +67,12 @@ class channel_plotter(grid_plotter_base):
def enable_legend(self, enable=None):
"""
Enable/disable the legend.
- @param enable true to enable
- @return the enable state when None
+
+ Args:
+ enable: true to enable
+
+ Returns:
+ the enable state when None
"""
if enable is None: return self._enable_legend
self.lock()
@@ -128,9 +132,13 @@ class channel_plotter(grid_plotter_base):
Get the text the will populate the point label.
Give X and Y values for the current point.
Give values for the channel at the X coordinate.
- @param x_val the current x value
- @param y_val the current y value
- @return a string with newlines
+
+ Args:
+ x_val: the current x value
+ y_val: the current y value
+
+ Returns:
+ a string with newlines
"""
#create text
label_str = '%s: %s\n%s: %s'%(
@@ -186,7 +194,9 @@ class channel_plotter(grid_plotter_base):
def clear_waveform(self, channel):
"""
Remove a waveform from the list of waveforms.
- @param channel the channel key
+
+ Args:
+ channel: the channel key
"""
self.lock()
if channel in self._channels.keys():
@@ -198,11 +208,13 @@ class channel_plotter(grid_plotter_base):
def set_waveform(self, channel, samples=[], color_spec=(0, 0, 0), marker=None, trig_off=0):
"""
Set the waveform for a given channel.
- @param channel the channel key
- @param samples the waveform samples
- @param color_spec the 3-tuple for line color
- @param marker None for line
- @param trig_off fraction of sample for trigger offset
+
+ Args:
+ channel: the channel key
+ samples: the waveform samples
+ color_spec: the 3-tuple for line color
+ marker: None for line
+ trig_off: fraction of sample for trigger offset
"""
self.lock()
if channel not in self._channels.keys(): self._legend_cache.changed(True)
diff --git a/gr-wxgui/src/python/plotter/common.py b/gr-wxgui/python/wxgui/plotter/common.py
index 88215e039a..9af636245d 100644
--- a/gr-wxgui/src/python/plotter/common.py
+++ b/gr-wxgui/python/wxgui/plotter/common.py
@@ -30,8 +30,12 @@ import wx
def get_exp(num):
"""
Get the exponent of the number in base 10.
- @param num the floating point number
- @return the exponent as an integer
+
+ Args:
+ num: the floating point number
+
+ Returns:
+ the exponent as an integer
"""
if num == 0: return 0
return int(math.floor(math.log10(abs(num))))
@@ -41,8 +45,12 @@ def get_si_components(num):
Get the SI units for the number.
Extract the coeff and exponent of the number.
The exponent will be a multiple of 3.
- @param num the floating point number
- @return the tuple coeff, exp, prefix
+
+ Args:
+ num: the floating point number
+
+ Returns:
+ the tuple coeff, exp, prefix
"""
num = float(num)
exp = get_exp(num)
@@ -65,8 +73,12 @@ def get_si_components(num):
def sci_format(num):
"""
Format a floating point number into scientific notation.
- @param num the number to format
- @return a label string
+
+ Args:
+ num: the number to format
+
+ Returns:
+ a label string
"""
coeff, exp, prefix = get_si_components(num)
if -3 <= exp < 3: return '%g'%num
@@ -75,9 +87,13 @@ def sci_format(num):
def eng_format(num, units=''):
"""
Format a floating point number into engineering notation.
- @param num the number to format
- @param units the units to append
- @return a label string
+
+ Args:
+ num: the number to format
+ units: the units to append
+
+ Returns:
+ a label string
"""
coeff, exp, prefix = get_si_components(num)
if -3 <= exp < 3: return '%g'%num
diff --git a/gr-wxgui/src/python/plotter/gltext.py b/gr-wxgui/python/wxgui/plotter/gltext.py
index 0b6e3f55b3..0b6e3f55b3 100644
--- a/gr-wxgui/src/python/plotter/gltext.py
+++ b/gr-wxgui/python/wxgui/plotter/gltext.py
diff --git a/gr-wxgui/src/python/plotter/grid_plotter_base.py b/gr-wxgui/python/wxgui/plotter/grid_plotter_base.py
index f1bc8f546d..a492539575 100644
--- a/gr-wxgui/src/python/plotter/grid_plotter_base.py
+++ b/gr-wxgui/python/wxgui/plotter/grid_plotter_base.py
@@ -78,7 +78,9 @@ class grid_plotter_base(plotter_base):
def set_point_label_coordinate(self, coor):
"""
Set the point label coordinate.
- @param coor the coordinate x, y tuple or None
+
+ Args:
+ coor: the coordinate x, y tuple or None
"""
self.lock()
self._point_label_coordinate = coor
@@ -103,8 +105,12 @@ class grid_plotter_base(plotter_base):
Enable/disable the grid aspect ratio.
If enabled, enforce the aspect ratio on the padding:
horizontal_padding:vertical_padding == width:height
- @param enable true to enable
- @return the enable state when None
+
+ Args:
+ enable: true to enable
+
+ Returns:
+ the enable state when None
"""
if enable is None: return self._enable_grid_aspect_ratio
self.lock()
@@ -115,8 +121,12 @@ class grid_plotter_base(plotter_base):
def enable_point_label(self, enable=None):
"""
Enable/disable the point label.
- @param enable true to enable
- @return the enable state when None
+
+ Args:
+ enable: true to enable
+
+ Returns:
+ the enable state when None
"""
if enable is None: return self._enable_point_label
self.lock()
@@ -127,7 +137,9 @@ class grid_plotter_base(plotter_base):
def set_title(self, title):
"""
Set the title.
- @param title the title string
+
+ Args:
+ title the title string
"""
self.lock()
self.title = title
@@ -137,8 +149,10 @@ class grid_plotter_base(plotter_base):
def set_x_label(self, x_label, x_units=''):
"""
Set the x label and units.
- @param x_label the x label string
- @param x_units the x units string
+
+ Args:
+ x_label: the x label string
+ x_units: the x units string
"""
self.lock()
self.x_label = x_label
@@ -149,8 +163,10 @@ class grid_plotter_base(plotter_base):
def set_y_label(self, y_label, y_units=''):
"""
Set the y label and units.
- @param y_label the y label string
- @param y_units the y units string
+
+ Args:
+ y_label: the y label string
+ y_units: the y units string
"""
self.lock()
self.y_label = y_label
@@ -161,10 +177,12 @@ class grid_plotter_base(plotter_base):
def set_x_grid(self, minimum, maximum, step, scale=False):
"""
Set the x grid parameters.
- @param minimum the left-most value
- @param maximum the right-most value
- @param step the grid spacing
- @param scale true to scale the x grid
+
+ Args:
+ minimum: the left-most value
+ maximum: the right-most value
+ step: the grid spacing
+ scale: true to scale the x grid
"""
self.lock()
self.x_min = float(minimum)
@@ -183,10 +201,12 @@ class grid_plotter_base(plotter_base):
def set_y_grid(self, minimum, maximum, step, scale=False):
"""
Set the y grid parameters.
- @param minimum the bottom-most value
- @param maximum the top-most value
- @param step the grid spacing
- @param scale true to scale the y grid
+
+ Args:
+ minimum: the bottom-most value
+ maximum: the top-most value
+ step: the grid spacing
+ scale: true to scale the y grid
"""
self.lock()
self.y_min = float(minimum)
@@ -305,9 +325,13 @@ class grid_plotter_base(plotter_base):
def _get_tick_label(self, tick, unit):
"""
Format the tick value and create a gl text.
- @param tick the floating point tick value
- @param unit the axis unit
- @return the tick label text
+
+ Args:
+ tick: the floating point tick value
+ unit: the axis unit
+
+ Returns:
+ the tick label text
"""
if unit: tick_str = common.sci_format(tick)
else: tick_str = common.eng_format(tick)
@@ -316,11 +340,15 @@ class grid_plotter_base(plotter_base):
def _get_ticks(self, min, max, step, scalar):
"""
Determine the positions for the ticks.
- @param min the lower bound
- @param max the upper bound
- @param step the grid spacing
- @param scalar the grid scaling
- @return a list of tick positions between min and max
+
+ Args:
+ min: the lower bound
+ max: the upper bound
+ step: the grid spacing
+ scalar: the grid scaling
+
+ Returns:
+ a list of tick positions between min and max
"""
#cast to float
min = float(min)
@@ -340,8 +368,12 @@ class grid_plotter_base(plotter_base):
def enable_grid_lines(self, enable=None):
"""
Enable/disable the grid lines.
- @param enable true to enable
- @return the enable state when None
+
+ Args:
+ enable: true to enable
+
+ Returns:
+ the enable state when None
"""
if enable is None: return self._enable_grid_lines
self.lock()
@@ -352,8 +384,10 @@ class grid_plotter_base(plotter_base):
def _draw_grid_line(self, coor1, coor2):
"""
Draw a dashed line from coor1 to coor2.
- @param corr1 a tuple of x, y
- @param corr2 a tuple of x, y
+
+ Args:
+ corr1: a tuple of x, y
+ corr2: a tuple of x, y
"""
if not self.enable_grid_lines(): return
length = math.sqrt((coor1[0] - coor2[0])**2 + (coor1[1] - coor2[1])**2)
@@ -372,11 +406,13 @@ class grid_plotter_base(plotter_base):
"""
Draw a rectangle on the x, y plane.
X and Y are the top-left corner.
- @param x the left position of the rectangle
- @param y the top position of the rectangle
- @param width the width of the rectangle
- @param height the height of the rectangle
- @param fill true to color inside of rectangle
+
+ Args:
+ x: the left position of the rectangle
+ y: the top position of the rectangle
+ width: the width of the rectangle
+ height: the height of the rectangle
+ fill: true to color inside of rectangle
"""
GL.glBegin(fill and GL.GL_QUADS or GL.GL_LINE_LOOP)
GL.glVertex2f(x, y)
diff --git a/gr-wxgui/src/python/plotter/plotter_base.py b/gr-wxgui/python/wxgui/plotter/plotter_base.py
index b8a2ce709e..78e21f3c1d 100644
--- a/gr-wxgui/src/python/plotter/plotter_base.py
+++ b/gr-wxgui/python/wxgui/plotter/plotter_base.py
@@ -37,7 +37,9 @@ class gl_cache(object):
def __init__(self, draw):
"""
Create a new cache.
- @param draw a function to draw gl stuff
+
+ Args:
+ draw: a function to draw gl stuff
"""
self.changed(True)
self._draw = draw
@@ -84,7 +86,9 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex):
Initialize the GLCanvas with double buffering.
Initialize various plotter flags.
Bind the paint and size events.
- @param parent the parent widgit
+
+ Args:
+ parent: the parent widgit
"""
attribList = (wx.glcanvas.WX_GL_DOUBLEBUFFER, wx.glcanvas.WX_GL_RGBA)
wx.glcanvas.GLCanvas.__init__(self, parent, attribList=attribList);
@@ -111,7 +115,9 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex):
"""
Create a new gl cache.
Register its draw and init function.
- @return the new cache object
+
+ Returns:
+ the new cache object
"""
cache = gl_cache(draw_fcn)
self.register_init(cache.init)
diff --git a/gr-wxgui/src/python/plotter/waterfall_plotter.py b/gr-wxgui/python/wxgui/plotter/waterfall_plotter.py
index 6a6bf6330e..02ec67ee4c 100644
--- a/gr-wxgui/src/python/plotter/waterfall_plotter.py
+++ b/gr-wxgui/python/wxgui/plotter/waterfall_plotter.py
@@ -49,8 +49,12 @@ def _get_rbga(red_pts, green_pts, blue_pts, alpha_pts=[(0, 0), (1, 0)]):
The x and y values of the coordinates range from 0 to 1.
The coordinates must be specified so that x increases with the index value.
Resulting values are calculated along the line formed between 2 coordinates.
- @param *_pts an array of x,y coordinates for each color element
- @return array of rbga values (4 bytes) each
+
+ Args:
+ red_pts, green_pts, blue_pts, alpha_pts: an array of x,y coordinates for each color element
+
+ Returns:
+ array of rbga values (4 bytes) each
"""
def _fcn(x, pw):
for (x1, y1), (x2, y2) in zip(pw, pw[1:]):
@@ -167,9 +171,13 @@ class waterfall_plotter(grid_plotter_base):
"""
Get the text the will populate the point label.
Give the X value for the current point.
- @param x_val the current x value
- @param y_val the current y value
- @return a value string with units
+
+ Args:
+ x_val: the current x value
+ y_val: the current y value
+
+ Returns:
+ a value string with units
"""
return '%s: %s'%(self.x_label, common.eng_format(x_val, self.x_units))
@@ -210,7 +218,9 @@ class waterfall_plotter(grid_plotter_base):
def _resize_texture(self, flag=None):
"""
Create the texture to fit the fft_size X num_lines.
- @param flag the set/unset or update flag
+
+ Args:
+ flag: the set/unset or update flag
"""
if flag is not None:
self._resize_texture_flag = flag
@@ -229,7 +239,9 @@ class waterfall_plotter(grid_plotter_base):
Set the color mode.
New samples will be converted to the new color mode.
Old samples will not be recolorized.
- @param color_mode the new color mode string
+
+ Args:
+ color_mode: the new color mode string
"""
self.lock()
if color_mode in COLORS.keys():
@@ -242,7 +254,9 @@ class waterfall_plotter(grid_plotter_base):
"""
Set number of lines.
Powers of two only.
- @param num_lines the new number of lines
+
+ Args:
+ num_lines: the new number of lines
"""
self.lock()
self._num_lines = num_lines
@@ -254,9 +268,11 @@ class waterfall_plotter(grid_plotter_base):
"""
Set the samples to the waterfall.
Convert the samples to color data.
- @param samples the array of floats
- @param minimum the minimum value to scale
- @param maximum the maximum value to scale
+
+ Args:
+ samples: the array of floats
+ minimum: the minimum value to scale
+ maximum: the maximum value to scale
"""
self.lock()
#set the min, max values
diff --git a/gr-wxgui/src/python/powermate.py b/gr-wxgui/python/wxgui/powermate.py
index 7c324c5d95..7c324c5d95 100644
--- a/gr-wxgui/src/python/powermate.py
+++ b/gr-wxgui/python/wxgui/powermate.py
diff --git a/gr-wxgui/src/python/pubsub.py b/gr-wxgui/python/wxgui/pubsub.py
index e55d691978..e55d691978 100644
--- a/gr-wxgui/src/python/pubsub.py
+++ b/gr-wxgui/python/wxgui/pubsub.py
diff --git a/gr-wxgui/src/python/scope_window.py b/gr-wxgui/python/wxgui/scope_window.py
index dc90a60459..357998bf95 100644
--- a/gr-wxgui/src/python/scope_window.py
+++ b/gr-wxgui/python/wxgui/scope_window.py
@@ -30,6 +30,7 @@ import time
import pubsub
from constants import *
from gnuradio import gr #for gr.prefs, trigger modes
+from gnuradio import wxgui
import forms
##################################################
@@ -38,21 +39,21 @@ import forms
DEFAULT_FRAME_RATE = gr.prefs().get_long('wxgui', 'scope_rate', 30)
PERSIST_ALPHA_MIN_EXP, PERSIST_ALPHA_MAX_EXP = -2, 0
SLIDER_STEPS = 100
-DEFAULT_TRIG_MODE = gr.prefs().get_long('wxgui', 'trig_mode', gr.gr_TRIG_MODE_AUTO)
+DEFAULT_TRIG_MODE = gr.prefs().get_long('wxgui', 'trig_mode', wxgui.TRIG_MODE_AUTO)
DEFAULT_WIN_SIZE = (600, 300)
COUPLING_MODES = (
('DC', False),
('AC', True),
)
TRIGGER_MODES = (
- ('Freerun', gr.gr_TRIG_MODE_FREE),
- ('Auto', gr.gr_TRIG_MODE_AUTO),
- ('Normal', gr.gr_TRIG_MODE_NORM),
- ('Stripchart', gr.gr_TRIG_MODE_STRIPCHART),
+ ('Freerun', wxgui.TRIG_MODE_FREE),
+ ('Auto', wxgui.TRIG_MODE_AUTO),
+ ('Normal', wxgui.TRIG_MODE_NORM),
+ ('Stripchart', wxgui.TRIG_MODE_STRIPCHART),
)
TRIGGER_SLOPES = (
- ('Pos +', gr.gr_TRIG_SLOPE_POS),
- ('Neg -', gr.gr_TRIG_SLOPE_NEG),
+ ('Pos +', wxgui.TRIG_SLOPE_POS),
+ ('Neg -', wxgui.TRIG_SLOPE_NEG),
)
CHANNEL_COLOR_SPECS = (
(0.3, 0.3, 1.0),
@@ -84,7 +85,9 @@ class control_panel(wx.Panel):
def __init__(self, parent):
"""
Create a new control panel.
- @param parent the wx parent window
+
+ Args:
+ parent: the wx parent window
"""
WIDTH = 90
self.parent = parent
@@ -279,7 +282,7 @@ class control_panel(wx.Panel):
)
def disable_all(trigger_mode):
for widget in (trigger_slope_chooser, trigger_channel_chooser, trigger_level_buttons, trigger_level_button):
- widget.Disable(trigger_mode == gr.gr_TRIG_MODE_FREE)
+ widget.Disable(trigger_mode == wxgui.TRIG_MODE_FREE)
parent.subscribe(TRIGGER_MODE_KEY, disable_all)
disable_all(parent[TRIGGER_MODE_KEY])
##################################################
@@ -478,12 +481,12 @@ class scope_window(wx.Panel, pubsub.pubsub):
self[TRIGGER_CHANNEL_KEY] = 0
self[TRIGGER_MODE_KEY] = trig_mode
- self[TRIGGER_SLOPE_KEY] = gr.gr_TRIG_SLOPE_POS
+ self[TRIGGER_SLOPE_KEY] = wxgui.TRIG_SLOPE_POS
self[T_FRAC_OFF_KEY] = 0.5
self[USE_PERSISTENCE_KEY] = use_persistence
self[PERSIST_ALPHA_KEY] = persist_alpha
- if self[TRIGGER_MODE_KEY] == gr.gr_TRIG_MODE_STRIPCHART:
+ if self[TRIGGER_MODE_KEY] == wxgui.TRIG_MODE_STRIPCHART:
self[T_FRAC_OFF_KEY] = 0.0
for i in range(num_inputs):
@@ -526,7 +529,9 @@ class scope_window(wx.Panel, pubsub.pubsub):
Handle the message from the scope sink message queue.
Plot the list of arrays of samples onto the grid.
Each samples array gets its own channel.
- @param msg the time domain data as a character array
+
+ Args:
+ msg: the time domain data as a character array
"""
if not self[RUNNING_KEY]: return
#check time elapsed
@@ -635,7 +640,7 @@ class scope_window(wx.Panel, pubsub.pubsub):
if self[TRIGGER_LEVEL_KEY] < self.get_y_min():
self[TRIGGER_LEVEL_KEY] = self.get_y_min(); return
#disable the trigger channel
- if not self[TRIGGER_SHOW_KEY] or self[XY_MODE_KEY] or self[TRIGGER_MODE_KEY] == gr.gr_TRIG_MODE_FREE:
+ if not self[TRIGGER_SHOW_KEY] or self[XY_MODE_KEY] or self[TRIGGER_MODE_KEY] == wxgui.TRIG_MODE_FREE:
self.plotter.clear_waveform(channel='Trig')
else: #show trigger channel
trigger_level = self[TRIGGER_LEVEL_KEY]
diff --git a/gr-wxgui/src/python/scopesink2.py b/gr-wxgui/python/wxgui/scopesink2.py
index 99e268895a..99e268895a 100644
--- a/gr-wxgui/src/python/scopesink2.py
+++ b/gr-wxgui/python/wxgui/scopesink2.py
diff --git a/gr-wxgui/src/python/scopesink_gl.py b/gr-wxgui/python/wxgui/scopesink_gl.py
index e6ff532e76..b2d5670c77 100644
--- a/gr-wxgui/src/python/scopesink_gl.py
+++ b/gr-wxgui/python/wxgui/scopesink_gl.py
@@ -1,5 +1,5 @@
#
-# Copyright 2008,2010 Free Software Foundation, Inc.
+# Copyright 2008,2010,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -24,7 +24,10 @@
##################################################
import scope_window
import common
-from gnuradio import gr
+from gnuradio import gr, filter
+from gnuradio import blocks
+from gnuradio import analog
+from gnuradio import wxgui
from pubsub import pubsub
from constants import *
import math
@@ -43,9 +46,9 @@ class ac_couple_block(gr.hier_block2):
gr.io_signature(1, 1, gr.sizeof_float),
)
#blocks
- lpf = gr.single_pole_iir_filter_ff(0.0)
- sub = gr.sub_ff()
- mute = gr.mute_ff()
+ lpf = filter.single_pole_iir_filter_ff(0.0)
+ sub = blocks.sub_ff()
+ mute = blocks.mute_ff()
#connect
self.connect(self, sub, self)
self.connect(self, lpf, mute, (sub, 1))
@@ -100,7 +103,7 @@ class _scope_sink_base(gr.hier_block2, common.wxgui_hb):
)
#scope
msgq = gr.msg_queue(2)
- scope = gr.oscope_sink_f(sample_rate, msgq)
+ scope = wxgui.oscope_sink_f(sample_rate, msgq)
#controller
self.controller = pubsub()
self.controller.subscribe(SAMPLE_RATE_KEY, scope.set_sample_rate)
@@ -157,7 +160,7 @@ class _scope_sink_base(gr.hier_block2, common.wxgui_hb):
)
else:
for i in range(num_inputs):
- c2f = gr.complex_to_float()
+ c2f = blocks.complex_to_float()
self.wxgui_connect((self, i), c2f)
for j in range(2):
self.connect(
@@ -206,18 +209,21 @@ class test_top_block (stdgui2.std_top_block):
# Generate a complex sinusoid
ampl=1.0e3
- self.src0 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 25.1e3*input_rate/default_input_rate, ampl)
- self.noise =gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 11.1*25.1e3*input_rate/default_input_rate, ampl/10)
- #self.noise =gr.noise_source_c(gr.GR_GAUSSIAN, ampl/10)
- self.combine=gr.add_cc()
+ self.src0 = analog.sig_source_c(input_rate, analog.GR_SIN_WAVE,
+ 25.1e3*input_rate/default_input_rate, ampl)
+ self.noise = analog.sig_source_c(input_rate, analog.GR_SIN_WAVE,
+ 11.1*25.1e3*input_rate/default_input_rate,
+ ampl/10)
+ #self.noise = analog.noise_source_c(analog.GR_GAUSSIAN, ampl/10)
+ self.combine = blocks.add_cc()
# We add this throttle block so that this demo doesn't suck down
# all the CPU available. You normally wouldn't use it...
- self.thr = gr.throttle(gr.sizeof_gr_complex, input_rate)
+ self.thr = blocks.throttle(gr.sizeof_gr_complex, input_rate)
- scope = scope_sink_c (panel,"Secret Data",sample_rate=input_rate,
- v_scale=v_scale, t_scale=t_scale)
- vbox.Add (scope.win, 1, wx.EXPAND)
+ scope = scope_sink_c(panel,"Secret Data",sample_rate=input_rate,
+ v_scale=v_scale, t_scale=t_scale)
+ vbox.Add(scope.win, 1, wx.EXPAND)
# Ultimately this will be
# self.connect("src0 throttle scope")
@@ -226,8 +232,8 @@ class test_top_block (stdgui2.std_top_block):
self.connect(self.combine, self.thr, scope)
def main ():
- app = stdgui2.stdapp (test_top_block, "O'Scope Test App")
- app.MainLoop ()
+ app = stdgui2.stdapp(test_top_block, "O'Scope Test App")
+ app.MainLoop()
if __name__ == '__main__':
- main ()
+ main()
diff --git a/gr-wxgui/src/python/scopesink_nongl.py b/gr-wxgui/python/wxgui/scopesink_nongl.py
index d45e799060..28a473860f 100644
--- a/gr-wxgui/src/python/scopesink_nongl.py
+++ b/gr-wxgui/python/wxgui/scopesink_nongl.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2003,2004,2006,2007 Free Software Foundation, Inc.
+# Copyright 2003,2004,2006,2007,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -21,6 +21,9 @@
#
from gnuradio import gr, gru, eng_notation
+from gnuradio import analog
+from gnuradio import blocks
+from gnuradio import wxgui
from gnuradio.wxgui import stdgui2
import wx
import gnuradio.wxgui.plot as plot
@@ -41,11 +44,11 @@ class scope_sink_f(gr.hier_block2):
gr.io_signature(0,0,0))
msgq = gr.msg_queue(2) # message queue that holds at most 2 messages
- self.guts = gr.oscope_sink_f(sample_rate, msgq)
+ self.guts = wxgui.oscope_sink_f(sample_rate, msgq)
for i in range(num_inputs):
self.connect((self, i), (self.guts, i))
- self.win = scope_window(win_info (msgq, sample_rate, frame_decim,
+ self.win = scope_window(win_info(msgq, sample_rate, frame_decim,
v_scale, t_scale, self.guts, title), parent)
def set_sample_rate(self, sample_rate):
@@ -62,12 +65,12 @@ class scope_sink_c(gr.hier_block2):
gr.io_signature(0,0,0))
msgq = gr.msg_queue(2) # message queue that holds at most 2 messages
- self.guts = gr.oscope_sink_f(sample_rate, msgq)
+ self.guts = wxgui.oscope_sink_f(sample_rate, msgq)
for i in range(num_inputs):
- c2f = gr.complex_to_float()
+ c2f = blocks.complex_to_float()
self.connect((self, i), c2f)
- self.connect((c2f, 0), (self.guts, 2*i+0))
- self.connect((c2f, 1), (self.guts, 2*i+1))
+ self.connect((c2f, 0),(self.guts, 2*i+0))
+ self.connect((c2f, 1),(self.guts, 2*i+1))
self.win = scope_window(win_info(msgq, sample_rate, frame_decim,
v_scale, t_scale, self.guts, title), parent)
@@ -81,7 +84,7 @@ class constellation_sink(scope_sink_c):
def __init__(self, parent, title='Constellation', sample_rate=1,
size=default_scopesink_size, frame_decim=default_frame_decim):
scope_sink_c.__init__(self, parent=parent, title=title, sample_rate=sample_rate,
- size=size, frame_decim=frame_decim)
+ size=size, frame_decim=frame_decim)
self.win.info.xy = True #constellation mode
# ========================================================================
@@ -141,21 +144,21 @@ def EVT_DATA_EVENT(win, func):
class DataEvent(wx.PyEvent):
def __init__(self, data):
wx.PyEvent.__init__(self)
- self.SetEventType (wxDATA_EVENT)
+ self.SetEventType(wxDATA_EVENT)
self.data = data
- def Clone (self):
- self.__class__ (self.GetId())
+ def Clone(self):
+ self.__class__(self.GetId())
-class win_info (object):
+class win_info(object):
__slots__ = ['msgq', 'sample_rate', 'frame_decim', 'v_scale',
'scopesink', 'title',
'time_scale_cursor', 'v_scale_cursor', 'marker', 'xy',
'autorange', 'running']
- def __init__ (self, msgq, sample_rate, frame_decim, v_scale, t_scale,
- scopesink, title = "Oscilloscope", xy=False):
+ def __init__(self, msgq, sample_rate, frame_decim, v_scale, t_scale,
+ scopesink, title = "Oscilloscope", xy=False):
self.msgq = msgq
self.sample_rate = sample_rate
self.frame_decim = frame_decim
@@ -170,30 +173,30 @@ class win_info (object):
self.autorange = not v_scale
self.running = True
- def get_time_per_div (self):
- return self.time_scale_cursor.current ()
+ def get_time_per_div(self):
+ return self.time_scale_cursor.current()
- def get_volts_per_div (self):
- return self.v_scale_cursor.current ()
+ def get_volts_per_div(self):
+ return self.v_scale_cursor.current()
def set_sample_rate(self, sample_rate):
self.sample_rate = sample_rate
- def get_sample_rate (self):
+ def get_sample_rate(self):
return self.sample_rate
- def get_decimation_rate (self):
+ def get_decimation_rate(self):
return 1.0
- def set_marker (self, s):
+ def set_marker(self, s):
self.marker = s
- def get_marker (self):
+ def get_marker(self):
return self.marker
-class input_watcher (gru.msgq_runner):
- def __init__ (self, msgq, event_receiver, frame_decim, **kwds):
+class input_watcher(gru.msgq_runner):
+ def __init__(self, msgq, event_receiver, frame_decim, **kwds):
self.event_receiver = event_receiver
self.frame_decim = frame_decim
self.iscan = 0
@@ -211,166 +214,166 @@ class input_watcher (gru.msgq_runner):
bytes_per_chan = nsamples * gr.sizeof_float
records = []
- for ch in range (nchan):
+ for ch in range(nchan):
start = ch * bytes_per_chan
chan_data = s[start:start+bytes_per_chan]
- rec = numpy.fromstring (chan_data, numpy.float32)
- records.append (rec)
+ rec = numpy.fromstring(chan_data, numpy.float32)
+ records.append(rec)
# print "nrecords = %d, reclen = %d" % (len (records),nsamples)
- de = DataEvent (records)
- wx.PostEvent (self.event_receiver, de)
+ de = DataEvent(records)
+ wx.PostEvent(self.event_receiver, de)
records = []
del de
self.iscan -= 1
-class scope_window (wx.Panel):
+class scope_window(wx.Panel):
- def __init__ (self, info, parent, id = -1,
- pos = wx.DefaultPosition, size = wx.DefaultSize, name = ""):
- wx.Panel.__init__ (self, parent, -1)
+ def __init__(self, info, parent, id = -1,
+ pos = wx.DefaultPosition, size = wx.DefaultSize, name = ""):
+ wx.Panel.__init__(self, parent, -1)
self.info = info
- vbox = wx.BoxSizer (wx.VERTICAL)
+ vbox = wx.BoxSizer(wx.VERTICAL)
- self.graph = graph_window (info, self, -1)
+ self.graph = graph_window(info, self, -1)
- vbox.Add (self.graph, 1, wx.EXPAND)
- vbox.Add (self.make_control_box(), 0, wx.EXPAND)
- vbox.Add (self.make_control2_box(), 0, wx.EXPAND)
+ vbox.Add(self.graph, 1, wx.EXPAND)
+ vbox.Add(self.make_control_box(), 0, wx.EXPAND)
+ vbox.Add(self.make_control2_box(), 0, wx.EXPAND)
self.sizer = vbox
- self.SetSizer (self.sizer)
- self.SetAutoLayout (True)
- self.sizer.Fit (self)
+ self.SetSizer(self.sizer)
+ self.SetAutoLayout(True)
+ self.sizer.Fit(self)
self.set_autorange(self.info.autorange)
# second row of control buttons etc. appears BELOW control_box
- def make_control2_box (self):
- ctrlbox = wx.BoxSizer (wx.HORIZONTAL)
+ def make_control2_box(self):
+ ctrlbox = wx.BoxSizer(wx.HORIZONTAL)
- self.inc_v_button = wx.Button (self, 1101, " < ", style=wx.BU_EXACTFIT)
- self.inc_v_button.SetToolTipString ("Increase vertical range")
- wx.EVT_BUTTON (self, 1101, self.incr_v_scale) # ID matches button ID above
+ self.inc_v_button = wx.Button(self, 1101, " < ", style=wx.BU_EXACTFIT)
+ self.inc_v_button.SetToolTipString("Increase vertical range")
+ wx.EVT_BUTTON(self, 1101, self.incr_v_scale) # ID matches button ID above
- self.dec_v_button = wx.Button (self, 1100, " > ", style=wx.BU_EXACTFIT)
- self.dec_v_button.SetToolTipString ("Decrease vertical range")
- wx.EVT_BUTTON (self, 1100, self.decr_v_scale)
+ self.dec_v_button = wx.Button(self, 1100, " > ", style=wx.BU_EXACTFIT)
+ self.dec_v_button.SetToolTipString("Decrease vertical range")
+ wx.EVT_BUTTON(self, 1100, self.decr_v_scale)
- self.v_scale_label = wx.StaticText (self, 1002, "None") # vertical /div
- self.update_v_scale_label ()
+ self.v_scale_label = wx.StaticText(self, 1002, "None") # vertical /div
+ self.update_v_scale_label()
- self.autorange_checkbox = wx.CheckBox (self, 1102, "Autorange")
- self.autorange_checkbox.SetToolTipString ("Select autorange on/off")
+ self.autorange_checkbox = wx.CheckBox(self, 1102, "Autorange")
+ self.autorange_checkbox.SetToolTipString("Select autorange on/off")
wx.EVT_CHECKBOX(self, 1102, self.autorange_checkbox_event)
- ctrlbox.Add ((5,0) ,0) # left margin space
- ctrlbox.Add (self.inc_v_button, 0, wx.EXPAND)
- ctrlbox.Add (self.dec_v_button, 0, wx.EXPAND)
- ctrlbox.Add (self.v_scale_label, 0, wx.ALIGN_CENTER)
- ctrlbox.Add ((20,0) ,0) # spacer
- ctrlbox.Add (self.autorange_checkbox, 0, wx.ALIGN_CENTER)
+ ctrlbox.Add((5,0) ,0) # left margin space
+ ctrlbox.Add(self.inc_v_button, 0, wx.EXPAND)
+ ctrlbox.Add(self.dec_v_button, 0, wx.EXPAND)
+ ctrlbox.Add(self.v_scale_label, 0, wx.ALIGN_CENTER)
+ ctrlbox.Add((20,0) ,0) # spacer
+ ctrlbox.Add(self.autorange_checkbox, 0, wx.ALIGN_CENTER)
return ctrlbox
- def make_control_box (self):
- ctrlbox = wx.BoxSizer (wx.HORIZONTAL)
+ def make_control_box(self):
+ ctrlbox = wx.BoxSizer(wx.HORIZONTAL)
- tb_left = wx.Button (self, 1001, " < ", style=wx.BU_EXACTFIT)
- tb_left.SetToolTipString ("Increase time base")
- wx.EVT_BUTTON (self, 1001, self.incr_timebase)
+ tb_left = wx.Button(self, 1001, " < ", style=wx.BU_EXACTFIT)
+ tb_left.SetToolTipString("Increase time base")
+ wx.EVT_BUTTON(self, 1001, self.incr_timebase)
- tb_right = wx.Button (self, 1000, " > ", style=wx.BU_EXACTFIT)
- tb_right.SetToolTipString ("Decrease time base")
- wx.EVT_BUTTON (self, 1000, self.decr_timebase)
+ tb_right = wx.Button(self, 1000, " > ", style=wx.BU_EXACTFIT)
+ tb_right.SetToolTipString("Decrease time base")
+ wx.EVT_BUTTON(self, 1000, self.decr_timebase)
- self.time_base_label = wx.StaticText (self, 1002, "")
- self.update_timebase_label ()
+ self.time_base_label = wx.StaticText(self, 1002, "")
+ self.update_timebase_label()
- ctrlbox.Add ((5,0) ,0)
- # ctrlbox.Add (wx.StaticText (self, -1, "Horiz Scale: "), 0, wx.ALIGN_CENTER)
- ctrlbox.Add (tb_left, 0, wx.EXPAND)
- ctrlbox.Add (tb_right, 0, wx.EXPAND)
- ctrlbox.Add (self.time_base_label, 0, wx.ALIGN_CENTER)
+ ctrlbox.Add((5,0) ,0)
+ # ctrlbox.Add(wx.StaticText(self, -1, "Horiz Scale: "), 0, wx.ALIGN_CENTER)
+ ctrlbox.Add(tb_left, 0, wx.EXPAND)
+ ctrlbox.Add(tb_right, 0, wx.EXPAND)
+ ctrlbox.Add(self.time_base_label, 0, wx.ALIGN_CENTER)
- ctrlbox.Add ((10,0) ,1) # stretchy space
+ ctrlbox.Add((10,0) ,1) # stretchy space
- ctrlbox.Add (wx.StaticText (self, -1, "Trig: "), 0, wx.ALIGN_CENTER)
- self.trig_chan_choice = wx.Choice (self, 1004,
- choices = ['Ch1', 'Ch2', 'Ch3', 'Ch4'])
- self.trig_chan_choice.SetToolTipString ("Select channel for trigger")
- wx.EVT_CHOICE (self, 1004, self.trig_chan_choice_event)
- ctrlbox.Add (self.trig_chan_choice, 0, wx.ALIGN_CENTER)
+ ctrlbox.Add(wx.StaticText(self, -1, "Trig: "), 0, wx.ALIGN_CENTER)
+ self.trig_chan_choice = wx.Choice(self, 1004,
+ choices = ['Ch1', 'Ch2', 'Ch3', 'Ch4'])
+ self.trig_chan_choice.SetToolTipString("Select channel for trigger")
+ wx.EVT_CHOICE(self, 1004, self.trig_chan_choice_event)
+ ctrlbox.Add(self.trig_chan_choice, 0, wx.ALIGN_CENTER)
- self.trig_mode_choice = wx.Choice (self, 1005,
- choices = ['Free', 'Auto', 'Norm'])
+ self.trig_mode_choice = wx.Choice(self, 1005,
+ choices = ['Free', 'Auto', 'Norm'])
self.trig_mode_choice.SetSelection(1)
- self.trig_mode_choice.SetToolTipString ("Select trigger slope or Auto (untriggered roll)")
- wx.EVT_CHOICE (self, 1005, self.trig_mode_choice_event)
- ctrlbox.Add (self.trig_mode_choice, 0, wx.ALIGN_CENTER)
+ self.trig_mode_choice.SetToolTipString("Select trigger slope or Auto (untriggered roll)")
+ wx.EVT_CHOICE(self, 1005, self.trig_mode_choice_event)
+ ctrlbox.Add(self.trig_mode_choice, 0, wx.ALIGN_CENTER)
- trig_level50 = wx.Button (self, 1006, "50%")
- trig_level50.SetToolTipString ("Set trigger level to 50%")
- wx.EVT_BUTTON (self, 1006, self.set_trig_level50)
- ctrlbox.Add (trig_level50, 0, wx.EXPAND)
+ trig_level50 = wx.Button(self, 1006, "50%")
+ trig_level50.SetToolTipString("Set trigger level to 50%")
+ wx.EVT_BUTTON(self, 1006, self.set_trig_level50)
+ ctrlbox.Add(trig_level50, 0, wx.EXPAND)
- run_stop = wx.Button (self, 1007, "Run/Stop")
- run_stop.SetToolTipString ("Toggle Run/Stop mode")
- wx.EVT_BUTTON (self, 1007, self.run_stop)
- ctrlbox.Add (run_stop, 0, wx.EXPAND)
+ run_stop = wx.Button(self, 1007, "Run/Stop")
+ run_stop.SetToolTipString("Toggle Run/Stop mode")
+ wx.EVT_BUTTON(self, 1007, self.run_stop)
+ ctrlbox.Add(run_stop, 0, wx.EXPAND)
- ctrlbox.Add ((10, 0) ,1) # stretchy space
+ ctrlbox.Add((10, 0) ,1) # stretchy space
- ctrlbox.Add (wx.StaticText (self, -1, "Fmt: "), 0, wx.ALIGN_CENTER)
- self.marker_choice = wx.Choice (self, 1002, choices = self._marker_choices)
- self.marker_choice.SetToolTipString ("Select plotting with lines, pluses or dots")
- wx.EVT_CHOICE (self, 1002, self.marker_choice_event)
- ctrlbox.Add (self.marker_choice, 0, wx.ALIGN_CENTER)
+ ctrlbox.Add(wx.StaticText(self, -1, "Fmt: "), 0, wx.ALIGN_CENTER)
+ self.marker_choice = wx.Choice(self, 1002, choices = self._marker_choices)
+ self.marker_choice.SetToolTipString("Select plotting with lines, pluses or dots")
+ wx.EVT_CHOICE(self, 1002, self.marker_choice_event)
+ ctrlbox.Add(self.marker_choice, 0, wx.ALIGN_CENTER)
- self.xy_choice = wx.Choice (self, 1003, choices = ['X:t', 'X:Y'])
- self.xy_choice.SetToolTipString ("Select X vs time or X vs Y display")
- wx.EVT_CHOICE (self, 1003, self.xy_choice_event)
- ctrlbox.Add (self.xy_choice, 0, wx.ALIGN_CENTER)
+ self.xy_choice = wx.Choice(self, 1003, choices = ['X:t', 'X:Y'])
+ self.xy_choice.SetToolTipString("Select X vs time or X vs Y display")
+ wx.EVT_CHOICE(self, 1003, self.xy_choice_event)
+ ctrlbox.Add(self.xy_choice, 0, wx.ALIGN_CENTER)
return ctrlbox
_marker_choices = ['line', 'plus', 'dot']
- def update_timebase_label (self):
- time_per_div = self.info.get_time_per_div ()
- s = ' ' + eng_notation.num_to_str (time_per_div) + 's/div'
- self.time_base_label.SetLabel (s)
+ def update_timebase_label(self):
+ time_per_div = self.info.get_time_per_div()
+ s = ' ' + eng_notation.num_to_str(time_per_div) + 's/div'
+ self.time_base_label.SetLabel(s)
- def decr_timebase (self, evt):
- self.info.time_scale_cursor.prev ()
- self.update_timebase_label ()
+ def decr_timebase(self, evt):
+ self.info.time_scale_cursor.prev()
+ self.update_timebase_label()
- def incr_timebase (self, evt):
- self.info.time_scale_cursor.next ()
- self.update_timebase_label ()
+ def incr_timebase(self, evt):
+ self.info.time_scale_cursor.next()
+ self.update_timebase_label()
- def update_v_scale_label (self):
- volts_per_div = self.info.get_volts_per_div ()
- s = ' ' + eng_notation.num_to_str (volts_per_div) + '/div' # Not V/div
- self.v_scale_label.SetLabel (s)
+ def update_v_scale_label(self):
+ volts_per_div = self.info.get_volts_per_div()
+ s = ' ' + eng_notation.num_to_str(volts_per_div) + '/div' # Not V/div
+ self.v_scale_label.SetLabel(s)
- def decr_v_scale (self, evt):
- self.info.v_scale_cursor.prev ()
- self.update_v_scale_label ()
+ def decr_v_scale(self, evt):
+ self.info.v_scale_cursor.prev()
+ self.update_v_scale_label()
- def incr_v_scale (self, evt):
- self.info.v_scale_cursor.next ()
- self.update_v_scale_label ()
+ def incr_v_scale(self, evt):
+ self.info.v_scale_cursor.next()
+ self.update_v_scale_label()
- def marker_choice_event (self, evt):
- s = evt.GetString ()
- self.set_marker (s)
+ def marker_choice_event(self, evt):
+ s = evt.GetString()
+ self.set_marker(s)
def set_autorange(self, on):
if on:
@@ -395,64 +398,64 @@ class scope_window (wx.Panel):
else:
self.set_autorange(False)
- def set_marker (self, s):
- self.info.set_marker (s) # set info for drawing routines
- i = self.marker_choice.FindString (s)
+ def set_marker(self, s):
+ self.info.set_marker(s) # set info for drawing routines
+ i = self.marker_choice.FindString(s)
assert i >= 0, "Hmmm, set_marker problem"
- self.marker_choice.SetSelection (i)
+ self.marker_choice.SetSelection(i)
- def set_format_line (self):
- self.set_marker ('line')
+ def set_format_line(self):
+ self.set_marker('line')
- def set_format_dot (self):
- self.set_marker ('dot')
+ def set_format_dot(self):
+ self.set_marker('dot')
- def set_format_plus (self):
- self.set_marker ('plus')
+ def set_format_plus(self):
+ self.set_marker('plus')
- def xy_choice_event (self, evt):
- s = evt.GetString ()
+ def xy_choice_event(self, evt):
+ s = evt.GetString()
self.info.xy = s == 'X:Y'
- def trig_chan_choice_event (self, evt):
- s = evt.GetString ()
- ch = int (s[-1]) - 1
- self.info.scopesink.set_trigger_channel (ch)
+ def trig_chan_choice_event(self, evt):
+ s = evt.GetString()
+ ch = int(s[-1]) - 1
+ self.info.scopesink.set_trigger_channel(ch)
- def trig_mode_choice_event (self, evt):
+ def trig_mode_choice_event(self, evt):
sink = self.info.scopesink
- s = evt.GetString ()
+ s = evt.GetString()
if s == 'Norm':
- sink.set_trigger_mode (gr.gr_TRIG_MODE_NORM)
+ sink.set_trigger_mode(wxgui.TRIG_MODE_NORM)
elif s == 'Auto':
- sink.set_trigger_mode (gr.gr_TRIG_MODE_AUTO)
+ sink.set_trigger_mode(wxgui.TRIG_MODE_AUTO)
elif s == 'Free':
- sink.set_trigger_mode (gr.gr_TRIG_MODE_FREE)
+ sink.set_trigger_mode(wxgui.TRIG_MODE_FREE)
else:
assert 0, "Bad trig_mode_choice string"
- def set_trig_level50 (self, evt):
- self.info.scopesink.set_trigger_level_auto ()
+ def set_trig_level50(self, evt):
+ self.info.scopesink.set_trigger_level_auto()
- def run_stop (self, evt):
+ def run_stop(self, evt):
self.info.running = not self.info.running
-class graph_window (plot.PlotCanvas):
+class graph_window(plot.PlotCanvas):
channel_colors = ['BLUE', 'RED',
'CYAN', 'MAGENTA', 'GREEN', 'YELLOW']
- def __init__ (self, info, parent, id = -1,
+ def __init__(self, info, parent, id = -1,
pos = wx.DefaultPosition, size = (640, 240),
style = wx.DEFAULT_FRAME_STYLE, name = ""):
- plot.PlotCanvas.__init__ (self, parent, id, pos, size, style, name)
+ plot.PlotCanvas.__init__(self, parent, id, pos, size, style, name)
- self.SetXUseScopeTicks (True)
- self.SetEnableGrid (True)
- self.SetEnableZoom (True)
+ self.SetXUseScopeTicks(True)
+ self.SetEnableGrid(True)
+ self.SetEnableZoom(True)
self.SetEnableLegend(True)
- # self.SetBackgroundColour ('black')
+ # self.SetBackgroundColour('black')
self.info = info;
self.y_range = None
@@ -462,38 +465,38 @@ class graph_window (plot.PlotCanvas):
self.avg_x_min = None
self.avg_x_max = None
- EVT_DATA_EVENT (self, self.format_data)
+ EVT_DATA_EVENT(self, self.format_data)
- self.input_watcher = input_watcher (info.msgq, self, info.frame_decim)
+ self.input_watcher = input_watcher(info.msgq, self, info.frame_decim)
- def channel_color (self, ch):
+ def channel_color(self, ch):
return self.channel_colors[ch % len(self.channel_colors)]
- def format_data (self, evt):
+ def format_data(self, evt):
if not self.info.running:
return
if self.info.xy:
- self.format_xy_data (evt)
+ self.format_xy_data(evt)
return
info = self.info
records = evt.data
- nchannels = len (records)
- npoints = len (records[0])
+ nchannels = len(records)
+ npoints = len(records[0])
objects = []
- Ts = 1.0 / (info.get_sample_rate () / info.get_decimation_rate ())
- x_vals = Ts * numpy.arange (-npoints/2, npoints/2)
+ Ts = 1.0 / (info.get_sample_rate() / info.get_decimation_rate())
+ x_vals = Ts * numpy.arange(-npoints/2, npoints/2)
# preliminary clipping based on time axis here, instead of in graphics code
- time_per_window = self.info.get_time_per_div () * 10
- n = int (time_per_window / Ts + 0.5)
+ time_per_window = self.info.get_time_per_div() * 10
+ n = int(time_per_window / Ts + 0.5)
n = n & ~0x1 # make even
- n = max (2, min (n, npoints))
+ n = max(2, min(n, npoints))
- self.SetXUseScopeTicks (True) # use 10 divisions, no labels
+ self.SetXUseScopeTicks(True) # use 10 divisions, no labels
for ch in range(nchannels):
r = records[ch]
@@ -502,74 +505,74 @@ class graph_window (plot.PlotCanvas):
lb = npoints/2 - n/2
ub = npoints/2 + n/2
- # points = zip (x_vals[lb:ub], r[lb:ub])
- points = numpy.zeros ((ub-lb, 2), numpy.float64)
+ # points = zip(x_vals[lb:ub], r[lb:ub])
+ points = numpy.zeros((ub-lb, 2), numpy.float64)
points[:,0] = x_vals[lb:ub]
points[:,1] = r[lb:ub]
- m = info.get_marker ()
+ m = info.get_marker()
if m == 'line':
- objects.append (plot.PolyLine (points,
- colour=self.channel_color (ch),
- legend=('Ch%d' % (ch+1,))))
+ objects.append(plot.PolyLine(points,
+ colour=self.channel_color(ch),
+ legend=('Ch%d' % (ch+1,))))
else:
- objects.append (plot.PolyMarker (points,
- marker=m,
- colour=self.channel_color (ch),
- legend=('Ch%d' % (ch+1,))))
+ objects.append(plot.PolyMarker(points,
+ marker=m,
+ colour=self.channel_color(ch),
+ legend=('Ch%d' % (ch+1,))))
- graphics = plot.PlotGraphics (objects,
- title=self.info.title,
- xLabel = '', yLabel = '')
+ graphics = plot.PlotGraphics(objects,
+ title=self.info.title,
+ xLabel = '', yLabel = '')
- time_per_div = info.get_time_per_div ()
+ time_per_div = info.get_time_per_div()
x_range = (-5.0 * time_per_div, 5.0 * time_per_div) # ranges are tuples!
- volts_per_div = info.get_volts_per_div ()
+ volts_per_div = info.get_volts_per_div()
if not self.info.autorange:
self.y_range = (-4.0 * volts_per_div, 4.0 * volts_per_div)
- self.Draw (graphics, xAxis=x_range, yAxis=self.y_range)
- self.update_y_range () # autorange to self.y_range
+ self.Draw(graphics, xAxis=x_range, yAxis=self.y_range)
+ self.update_y_range() # autorange to self.y_range
- def format_xy_data (self, evt):
+ def format_xy_data(self, evt):
info = self.info
records = evt.data
- nchannels = len (records)
- npoints = len (records[0])
+ nchannels = len(records)
+ npoints = len(records[0])
if nchannels < 2:
return
objects = []
- # points = zip (records[0], records[1])
- points = numpy.zeros ((len(records[0]), 2), numpy.float32)
+ # points = zip(records[0], records[1])
+ points = numpy.zeros((len(records[0]), 2), numpy.float32)
points[:,0] = records[0]
points[:,1] = records[1]
- self.SetXUseScopeTicks (False)
+ self.SetXUseScopeTicks(False)
- m = info.get_marker ()
+ m = info.get_marker()
if m == 'line':
- objects.append (plot.PolyLine (points,
- colour=self.channel_color (0)))
+ objects.append(plot.PolyLine(points,
+ colour=self.channel_color(0)))
else:
- objects.append (plot.PolyMarker (points,
- marker=m,
- colour=self.channel_color (0)))
+ objects.append(plot.PolyMarker(points,
+ marker=m,
+ colour=self.channel_color(0)))
- graphics = plot.PlotGraphics (objects,
- title=self.info.title,
- xLabel = 'I', yLabel = 'Q')
+ graphics = plot.PlotGraphics(objects,
+ title=self.info.title,
+ xLabel = 'I', yLabel = 'Q')
- self.Draw (graphics, xAxis=self.x_range, yAxis=self.y_range)
- self.update_y_range ()
- self.update_x_range ()
+ self.Draw(graphics, xAxis=self.x_range, yAxis=self.y_range)
+ self.update_y_range()
+ self.update_x_range()
- def update_y_range (self):
+ def update_y_range(self):
alpha = 1.0/25
graphics = self.last_draw[0]
- p1, p2 = graphics.boundingBox () # min, max points of graphics
+ p1, p2 = graphics.boundingBox() # min, max points of graphics
if self.avg_y_min: # prevent vertical scale from jumping abruptly --?
self.avg_y_min = p1[1] * alpha + self.avg_y_min * (1 - alpha)
@@ -578,15 +581,15 @@ class graph_window (plot.PlotCanvas):
self.avg_y_min = p1[1] # -500.0 workaround, sometimes p1 is ~ 10^35
self.avg_y_max = p2[1] # 500.0
- self.y_range = self._axisInterval ('auto', self.avg_y_min, self.avg_y_max)
+ self.y_range = self._axisInterval('auto', self.avg_y_min, self.avg_y_max)
# print "p1 %s p2 %s y_min %s y_max %s y_range %s" \
# % (p1, p2, self.avg_y_min, self.avg_y_max, self.y_range)
- def update_x_range (self):
+ def update_x_range(self):
alpha = 1.0/25
graphics = self.last_draw[0]
- p1, p2 = graphics.boundingBox () # min, max points of graphics
+ p1, p2 = graphics.boundingBox() # min, max points of graphics
if self.avg_x_min:
self.avg_x_min = p1[0] * alpha + self.avg_x_min * (1 - alpha)
@@ -595,16 +598,16 @@ class graph_window (plot.PlotCanvas):
self.avg_x_min = p1[0]
self.avg_x_max = p2[0]
- self.x_range = self._axisInterval ('auto', self.avg_x_min, self.avg_x_max)
+ self.x_range = self._axisInterval('auto', self.avg_x_min, self.avg_x_max)
# ----------------------------------------------------------------
# Stand-alone test application
# ----------------------------------------------------------------
-class test_top_block (stdgui2.std_top_block):
+class test_top_block(stdgui2.std_top_block):
def __init__(self, frame, panel, vbox, argv):
- stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
+ stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)
if len(argv) > 1:
frame_decim = int(argv[1])
@@ -626,26 +629,26 @@ class test_top_block (stdgui2.std_top_block):
input_rate = 1e6
# Generate a complex sinusoid
- self.src0 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 25.1e3, 1e3)
+ self.src0 = analog.sig_source_c(input_rate, analog.GR_SIN_WAVE, 25.1e3, 1e3)
# We add this throttle block so that this demo doesn't suck down
# all the CPU available. You normally wouldn't use it...
- self.thr = gr.throttle(gr.sizeof_gr_complex, input_rate)
+ self.thr = blocks.throttle(gr.sizeof_gr_complex, input_rate)
- scope = scope_sink_c (panel,"Secret Data",sample_rate=input_rate,
- frame_decim=frame_decim,
- v_scale=v_scale, t_scale=t_scale)
- vbox.Add (scope.win, 1, wx.EXPAND)
+ scope = scope_sink_c(panel,"Secret Data",sample_rate=input_rate,
+ frame_decim=frame_decim,
+ v_scale=v_scale, t_scale=t_scale)
+ vbox.Add(scope.win, 1, wx.EXPAND)
# Ultimately this will be
# self.connect("src0 throttle scope")
self.connect(self.src0, self.thr, scope)
-def main ():
- app = stdgui2.stdapp (test_top_block, "O'Scope Test App")
- app.MainLoop ()
+def main():
+ app = stdgui2.stdapp(test_top_block, "O'Scope Test App")
+ app.MainLoop()
if __name__ == '__main__':
- main ()
+ main()
# ----------------------------------------------------------------
diff --git a/gr-wxgui/src/python/slider.py b/gr-wxgui/python/wxgui/slider.py
index e8cdcfcaca..7194de47c2 100644
--- a/gr-wxgui/src/python/slider.py
+++ b/gr-wxgui/python/wxgui/slider.py
@@ -6,11 +6,10 @@ def slider(parent, min, max, callback):
"""
Return a wx.Slider object.
- @param min: minimum slider value
- @type min: float
- @param max: maximum slider value
- @type max: float
- @param callback: function of one arg invoked when slider moves.
+ Args:
+ min: minimum slider value (float)
+ max: maximum slider value (float)
+ callback: function of one arg invoked when slider moves.
@rtype: wx.Slider
"""
new_id = wx.NewId()
diff --git a/gr-wxgui/src/python/stdgui2.py b/gr-wxgui/python/wxgui/stdgui2.py
index 71436d72c4..71436d72c4 100644
--- a/gr-wxgui/src/python/stdgui2.py
+++ b/gr-wxgui/python/wxgui/stdgui2.py
diff --git a/gr-wxgui/src/python/termsink.py b/gr-wxgui/python/wxgui/termsink.py
index a0cfd575d6..a0cfd575d6 100644
--- a/gr-wxgui/src/python/termsink.py
+++ b/gr-wxgui/python/wxgui/termsink.py
diff --git a/gr-wxgui/src/python/waterfall_window.py b/gr-wxgui/python/wxgui/waterfall_window.py
index cd60104d7a..7d401223c2 100644
--- a/gr-wxgui/src/python/waterfall_window.py
+++ b/gr-wxgui/python/wxgui/waterfall_window.py
@@ -61,7 +61,9 @@ class control_panel(wx.Panel):
def __init__(self, parent):
"""
Create a new control panel.
- @param parent the wx parent window
+
+ Args:
+ parent: the wx parent window
"""
self.parent = parent
wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
@@ -259,7 +261,9 @@ class waterfall_window(wx.Panel, pubsub.pubsub):
If complex, reorder the fft samples so the negative bins come first.
If real, keep take only the positive bins.
Send the data to the plotter.
- @param msg the fft array as a character array
+
+ Args:
+ msg: the fft array as a character array
"""
if not self[RUNNING_KEY]: return
#convert to floating point numbers
diff --git a/gr-wxgui/src/python/waterfallsink2.py b/gr-wxgui/python/wxgui/waterfallsink2.py
index 0b876fc3e2..0b876fc3e2 100644
--- a/gr-wxgui/src/python/waterfallsink2.py
+++ b/gr-wxgui/python/wxgui/waterfallsink2.py
diff --git a/gr-wxgui/src/python/waterfallsink_gl.py b/gr-wxgui/python/wxgui/waterfallsink_gl.py
index b69c5dda0c..ead97df1e7 100644
--- a/gr-wxgui/src/python/waterfallsink_gl.py
+++ b/gr-wxgui/python/wxgui/waterfallsink_gl.py
@@ -1,5 +1,5 @@
#
-# Copyright 2008,2009 Free Software Foundation, Inc.
+# Copyright 2008,2009,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -24,7 +24,10 @@
##################################################
import waterfall_window
import common
-from gnuradio import gr, blks2
+from gnuradio import gr, fft
+from gnuradio import analog
+from gnuradio import blocks
+from gnuradio.fft import logpwrfft
from pubsub import pubsub
from constants import *
@@ -74,7 +77,7 @@ class _waterfall_sink_base(gr.hier_block2, common.wxgui_hb):
win=win,
)
msgq = gr.msg_queue(2)
- sink = gr.message_sink(gr.sizeof_float*fft_size, msgq, True)
+ sink = blocks.message_sink(gr.sizeof_float*fft_size, msgq, True)
#controller
self.controller = pubsub()
self.controller.subscribe(AVERAGE_KEY, fft.set_average)
@@ -117,12 +120,12 @@ class _waterfall_sink_base(gr.hier_block2, common.wxgui_hb):
self.win.set_callback(callb)
class waterfall_sink_f(_waterfall_sink_base):
- _fft_chain = blks2.logpwrfft_f
+ _fft_chain = logpwrfft.logpwrfft_f
_item_size = gr.sizeof_float
_real = True
class waterfall_sink_c(_waterfall_sink_base):
- _fft_chain = blks2.logpwrfft_c
+ _fft_chain = logpwrfft.logpwrfft_c
_item_size = gr.sizeof_gr_complex
_real = False
@@ -133,9 +136,9 @@ class waterfall_sink_c(_waterfall_sink_base):
import wx
from gnuradio.wxgui import stdgui2
-class test_top_block (stdgui2.std_top_block):
+class test_top_block(stdgui2.std_top_block):
def __init__(self, frame, panel, vbox, argv):
- stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
+ stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)
fft_size = 512
@@ -143,30 +146,30 @@ class test_top_block (stdgui2.std_top_block):
input_rate = 20.000e3
# Generate a complex sinusoid
- self.src1 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 5.75e3, 1000)
- #src1 = gr.sig_source_c (input_rate, gr.GR_CONST_WAVE, 5.75e3, 1000)
+ self.src1 = analog.sig_source_c(input_rate, analog.GR_SIN_WAVE, 5.75e3, 1000)
+ #src1 = analog.sig_source_c(input_rate, analog.GR_CONST_WAVE, 5.75e3, 1000)
# We add these throttle blocks so that this demo doesn't
# suck down all the CPU available. Normally you wouldn't use these.
- self.thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate)
+ self.thr1 = blocks.throttle(gr.sizeof_gr_complex, input_rate)
- sink1 = waterfall_sink_c (panel, title="Complex Data", fft_size=fft_size,
- sample_rate=input_rate, baseband_freq=100e3)
+ sink1 = waterfall_sink_c(panel, title="Complex Data", fft_size=fft_size,
+ sample_rate=input_rate, baseband_freq=100e3)
self.connect(self.src1, self.thr1, sink1)
- vbox.Add (sink1.win, 1, wx.EXPAND)
+ vbox.Add(sink1.win, 1, wx.EXPAND)
# generate a real sinusoid
- self.src2 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 5.75e3, 1000)
- self.thr2 = gr.throttle(gr.sizeof_float, input_rate)
- sink2 = waterfall_sink_f (panel, title="Real Data", fft_size=fft_size,
- sample_rate=input_rate, baseband_freq=100e3)
+ self.src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 5.75e3, 1000)
+ self.thr2 = blocks.throttle(gr.sizeof_float, input_rate)
+ sink2 = waterfall_sink_f(panel, title="Real Data", fft_size=fft_size,
+ sample_rate=input_rate, baseband_freq=100e3)
self.connect(self.src2, self.thr2, sink2)
- vbox.Add (sink2.win, 1, wx.EXPAND)
+ vbox.Add(sink2.win, 1, wx.EXPAND)
def main ():
- app = stdgui2.stdapp (test_top_block, "Waterfall Sink Test App")
- app.MainLoop ()
+ app = stdgui2.stdapp(test_top_block, "Waterfall Sink Test App")
+ app.MainLoop()
if __name__ == '__main__':
main ()
diff --git a/gr-wxgui/src/python/waterfallsink_nongl.py b/gr-wxgui/python/wxgui/waterfallsink_nongl.py
index bf77b4b131..5cfcd24413 100644
--- a/gr-wxgui/src/python/waterfallsink_nongl.py
+++ b/gr-wxgui/python/wxgui/waterfallsink_nongl.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2003-2005,2007,2008 Free Software Foundation, Inc.
+# Copyright 2003-2005,2007,2008,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -20,8 +20,11 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, gru, window
+from gnuradio import gr, gru, fft, filter
+from gnuradio import blocks
+from gnuradio import analog
from gnuradio.wxgui import stdgui2
+from gnuradio.filter import window
import wx
import gnuradio.wxgui.plot as plot
import numpy
@@ -89,16 +92,16 @@ class waterfall_sink_f(gr.hier_block2, waterfall_sink_base):
fft_rate=fft_rate,
average=average, avg_alpha=avg_alpha, title=title)
- self.s2p = gr.serial_to_parallel(gr.sizeof_float, self.fft_size)
- self.one_in_n = gr.keep_one_in_n(gr.sizeof_float * self.fft_size,
- max(1, int(self.sample_rate/self.fft_size/self.fft_rate)))
+ self.s2p = blocks.stream_to_vector(gr.sizeof_float, self.fft_size)
+ self.one_in_n = blocks.keep_one_in_n(gr.sizeof_float * self.fft_size,
+ max(1, int(self.sample_rate/self.fft_size/self.fft_rate)))
mywindow = window.blackmanharris(self.fft_size)
- self.fft = gr.fft_vfc(self.fft_size, True, mywindow)
- self.c2mag = gr.complex_to_mag(self.fft_size)
- self.avg = gr.single_pole_iir_filter_ff(1.0, self.fft_size)
- self.log = gr.nlog10_ff(20, self.fft_size, -20*math.log10(self.fft_size))
- self.sink = gr.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True)
+ self.fft = fft.fft_vfc(self.fft_size, True, mywindow)
+ self.c2mag = blocks.complex_to_mag(self.fft_size)
+ self.avg = filter.single_pole_iir_filter_ff(1.0, self.fft_size)
+ self.log = blocks.nlog10_ff(20, self.fft_size, -20*math.log10(self.fft_size))
+ self.sink = blocks.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True)
self.connect(self, self.s2p, self.one_in_n, self.fft, self.c2mag, self.avg, self.log, self.sink)
self.win = waterfall_window(self, parent, size=size)
@@ -120,16 +123,16 @@ class waterfall_sink_c(gr.hier_block2, waterfall_sink_base):
fft_rate=fft_rate,
average=average, avg_alpha=avg_alpha, title=title)
- self.s2p = gr.serial_to_parallel(gr.sizeof_gr_complex, self.fft_size)
- self.one_in_n = gr.keep_one_in_n(gr.sizeof_gr_complex * self.fft_size,
- max(1, int(self.sample_rate/self.fft_size/self.fft_rate)))
+ self.s2p = blocks.stream_to_vector(gr.sizeof_gr_complex, self.fft_size)
+ self.one_in_n = blocks.keep_one_in_n(gr.sizeof_gr_complex * self.fft_size,
+ max(1, int(self.sample_rate/self.fft_size/self.fft_rate)))
mywindow = window.blackmanharris(self.fft_size)
- self.fft = gr.fft_vcc(self.fft_size, True, mywindow)
- self.c2mag = gr.complex_to_mag(self.fft_size)
- self.avg = gr.single_pole_iir_filter_ff(1.0, self.fft_size)
- self.log = gr.nlog10_ff(20, self.fft_size, -20*math.log10(self.fft_size))
- self.sink = gr.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True)
+ self.fft = fft.fft_vcc(self.fft_size, True, mywindow)
+ self.c2mag = blocks.complex_to_mag(self.fft_size)
+ self.avg = filter.single_pole_iir_filter_ff(1.0, self.fft_size)
+ self.log = blocks.nlog10_ff(20, self.fft_size, -20*math.log10(self.fft_size))
+ self.sink = blocks.message_sink(gr.sizeof_float * self.fft_size, self.msgq, True)
self.connect(self, self.s2p, self.one_in_n, self.fft, self.c2mag, self.avg, self.log, self.sink)
self.win = waterfall_window(self, parent, size=size)
@@ -394,7 +397,7 @@ def next_down(v, seq):
class test_top_block (stdgui2.std_top_block):
def __init__(self, frame, panel, vbox, argv):
- stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
+ stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)
fft_size = 512
@@ -402,30 +405,30 @@ class test_top_block (stdgui2.std_top_block):
input_rate = 20.000e3
# Generate a complex sinusoid
- self.src1 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 5.75e3, 1000)
- #src1 = gr.sig_source_c (input_rate, gr.GR_CONST_WAVE, 5.75e3, 1000)
+ self.src1 = analog.sig_source_c(input_rate, analog.GR_SIN_WAVE, 5.75e3, 1000)
+ #src1 = analog.sig_source_c(input_rate, analog.GR_CONST_WAVE, 5.75e3, 1000)
# We add these throttle blocks so that this demo doesn't
# suck down all the CPU available. Normally you wouldn't use these.
- self.thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate)
+ self.thr1 = blocks.throttle(gr.sizeof_gr_complex, input_rate)
- sink1 = waterfall_sink_c (panel, title="Complex Data", fft_size=fft_size,
- sample_rate=input_rate, baseband_freq=100e3)
+ sink1 = waterfall_sink_c(panel, title="Complex Data", fft_size=fft_size,
+ sample_rate=input_rate, baseband_freq=100e3)
self.connect(self.src1, self.thr1, sink1)
- vbox.Add (sink1.win, 1, wx.EXPAND)
+ vbox.Add(sink1.win, 1, wx.EXPAND)
# generate a real sinusoid
- self.src2 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 5.75e3, 1000)
- self.thr2 = gr.throttle(gr.sizeof_float, input_rate)
- sink2 = waterfall_sink_f (panel, title="Real Data", fft_size=fft_size,
- sample_rate=input_rate, baseband_freq=100e3)
+ self.src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 5.75e3, 1000)
+ self.thr2 = blocks.throttle(gr.sizeof_float, input_rate)
+ sink2 = waterfall_sink_f(panel, title="Real Data", fft_size=fft_size,
+ sample_rate=input_rate, baseband_freq=100e3)
self.connect(self.src2, self.thr2, sink2)
- vbox.Add (sink2.win, 1, wx.EXPAND)
+ vbox.Add(sink2.win, 1, wx.EXPAND)
def main ():
- app = stdgui2.stdapp (test_top_block, "Waterfall Sink Test App")
- app.MainLoop ()
+ app = stdgui2.stdapp(test_top_block, "Waterfall Sink Test App")
+ app.MainLoop()
if __name__ == '__main__':
- main ()
+ main()
diff --git a/gr-wxgui/swig/CMakeLists.txt b/gr-wxgui/swig/CMakeLists.txt
new file mode 100644
index 0000000000..f02f1f1455
--- /dev/null
+++ b/gr-wxgui/swig/CMakeLists.txt
@@ -0,0 +1,58 @@
+# Copyright 2013 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.
+
+########################################################################
+# Setup swig generation
+########################################################################
+include(GrPython)
+include(GrSwig)
+
+set(GR_SWIG_INCLUDE_DIRS
+ ${CMAKE_CURRENT_BINARY_DIR}/../include
+ ${GR_WXGUI_INCLUDE_DIRS}
+ ${GNURADIO_RUNTIME_SWIG_INCLUDE_DIRS}
+ ${Boost_INCLUDE_DIRS}
+)
+
+if(ENABLE_GR_CTRLPORT)
+ list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT")
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR})
+endif(ENABLE_GR_CTRLPORT)
+
+set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/wxgui_swig_doc.i)
+set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/gnuradio/wxgui)
+set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc)
+set(GR_SWIG_TARGET_DEPS wxgui_generated_includes)
+set(GR_SWIG_LIBRARIES gnuradio-wxgui)
+
+GR_SWIG_MAKE(wxgui_swig wxgui_swig.i)
+
+GR_SWIG_INSTALL(
+ TARGETS wxgui_swig
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/wxgui
+ COMPONENT "wxgui_python"
+)
+
+install(
+ FILES
+ wxgui_swig.i
+ ${CMAKE_CURRENT_BINARY_DIR}/wxgui_swig_doc.i
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
+ COMPONENT "wxgui_swig"
+)
diff --git a/gr-wxgui/swig/wxgui_swig.i b/gr-wxgui/swig/wxgui_swig.i
new file mode 100644
index 0000000000..f370da407a
--- /dev/null
+++ b/gr-wxgui/swig/wxgui_swig.i
@@ -0,0 +1,43 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013 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.
+ */
+
+#define WXGUI_API
+
+%include "gnuradio.i"
+
+//load generated python docstrings
+%include "wxgui_swig_doc.i"
+
+%include "gnuradio/wxgui/trigger_mode.h"
+
+%{
+#include "gnuradio/wxgui/oscope_sink_x.h"
+#include "gnuradio/wxgui/histo_sink_f.h"
+#include "gnuradio/wxgui/oscope_sink_f.h"
+%}
+
+%include "gnuradio/wxgui/oscope_sink_x.h"
+%include "gnuradio/wxgui/histo_sink_f.h"
+%include "gnuradio/wxgui/oscope_sink_f.h"
+
+GR_SWIG_BLOCK_MAGIC2(wxgui, histo_sink_f);
+GR_SWIG_BLOCK_MAGIC2(wxgui, oscope_sink_f);