summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/grc_gr_qtgui.m414
-rw-r--r--config/grc_gr_wxgui.m41
-rw-r--r--gr-qtgui/Makefile.am6
-rw-r--r--gr-qtgui/grc/.gitignore2
-rw-r--r--gr-qtgui/grc/Makefile.am33
-rw-r--r--gr-qtgui/grc/qtgui_check_box.xml83
-rw-r--r--gr-qtgui/grc/qtgui_chooser.xml251
-rw-r--r--gr-qtgui/grc/qtgui_entry.xml68
-rw-r--r--gr-qtgui/grc/qtgui_label.xml66
-rw-r--r--gr-qtgui/grc/qtgui_range.xml211
-rw-r--r--gr-qtgui/grc/qtgui_sink_x.xml136
-rw-r--r--gr-qtgui/grc/qtgui_tab_widget.xml84
-rw-r--r--gr-wxgui/Makefile.am2
-rw-r--r--gr-wxgui/grc/.gitignore2
-rw-r--r--gr-wxgui/grc/Makefile.am45
-rw-r--r--gr-wxgui/grc/__init__.py (renamed from grc/grc_gnuradio/wxgui/__init__.py)0
-rw-r--r--gr-wxgui/grc/notebook.xml (renamed from grc/blocks/notebook.xml)3
-rw-r--r--gr-wxgui/grc/panel.py (renamed from grc/grc_gnuradio/wxgui/panel.py)0
-rw-r--r--gr-wxgui/grc/top_block_gui.py (renamed from grc/grc_gnuradio/wxgui/top_block_gui.py)0
-rw-r--r--gr-wxgui/grc/variable_check_box.xml (renamed from grc/blocks/variable_check_box.xml)3
-rw-r--r--gr-wxgui/grc/variable_chooser.xml (renamed from grc/blocks/variable_chooser.xml)3
-rw-r--r--gr-wxgui/grc/variable_slider.xml (renamed from grc/blocks/variable_slider.xml)3
-rw-r--r--gr-wxgui/grc/variable_static_text.xml (renamed from grc/blocks/variable_static_text.xml)3
-rw-r--r--gr-wxgui/grc/variable_text_box.xml (renamed from grc/blocks/variable_text_box.xml)3
-rw-r--r--gr-wxgui/grc/wxgui_constellationsink2.xml (renamed from grc/blocks/wxgui_constellationsink2.xml)3
-rw-r--r--gr-wxgui/grc/wxgui_fftsink2.xml (renamed from grc/blocks/wxgui_fftsink2.xml)3
-rw-r--r--gr-wxgui/grc/wxgui_histosink2.xml (renamed from grc/blocks/wxgui_histosink2.xml)3
-rw-r--r--gr-wxgui/grc/wxgui_numbersink2.xml (renamed from grc/blocks/wxgui_numbersink2.xml)3
-rw-r--r--gr-wxgui/grc/wxgui_scopesink2.xml (renamed from grc/blocks/wxgui_scopesink2.xml)3
-rw-r--r--gr-wxgui/grc/wxgui_termsink.xml (renamed from grc/blocks/wxgui_termsink.xml)3
-rw-r--r--gr-wxgui/grc/wxgui_waterfallsink2.xml (renamed from grc/blocks/wxgui_waterfallsink2.xml)3
-rw-r--r--grc/blocks/Makefile.am19
-rw-r--r--grc/blocks/blks2_variable_sink_x.xml77
-rw-r--r--grc/blocks/block_tree.xml25
-rw-r--r--grc/blocks/gr_probe_avg_mag_sqrd_x.xml24
-rw-r--r--grc/blocks/gr_probe_density_b.xml17
-rw-r--r--grc/blocks/gr_probe_mpsk_snr_c.xml41
-rw-r--r--grc/blocks/gr_probe_signal_f.xml21
-rw-r--r--grc/blocks/options.xml11
-rw-r--r--grc/blocks/probe_function.xml44
-rw-r--r--grc/blocks/variable_function_probe.xml70
-rw-r--r--grc/grc_gnuradio/Makefile.am10
-rw-r--r--grc/grc_gnuradio/blks2/__init__.py4
-rw-r--r--grc/grc_gnuradio/blks2/probe.py123
-rw-r--r--grc/grc_gnuradio/blks2/variable_sink.py64
-rw-r--r--grc/python/Generator.py24
-rw-r--r--grc/python/Param.py27
-rw-r--r--grc/python/Platform.py2
-rw-r--r--grc/python/flow_graph.tmpl55
49 files changed, 1217 insertions, 484 deletions
diff --git a/config/grc_gr_qtgui.m4 b/config/grc_gr_qtgui.m4
index 4027bb332..92392c883 100644
--- a/config/grc_gr_qtgui.m4
+++ b/config/grc_gr_qtgui.m4
@@ -1,4 +1,4 @@
-dnl Copyright 2001,2002,2003,2004,2005,2006,2008 Free Software Foundation, Inc.
+dnl Copyright 2001,2002,2003,2004,2005,2006,2008,2011 Free Software Foundation, Inc.
dnl
dnl This file is part of GNU Radio
dnl
@@ -29,13 +29,12 @@ AC_DEFUN([GRC_GR_QTGUI],[
dnl no : otherwise
PYTHON_CHECK_MODULE([PyQt4.QtCore], [PyQt4 for Qt4], \
- [passed=yes], [passed=no], \
- [PyQt4.QtCore.PYQT_VERSION >= 260000])
+ [], [passed=no], \
+ [PyQt4.QtCore.PYQT_VERSION >= 260000])
- # Enable this if we want to test for PyQwt, too
- #PYTHON_CHECK_MODULE([PyQt4.Qwt5], [PyQwt5 for Qt4], \
- # [passed=yes], [passed=no], \
- # [PyQt4.Qwt5.QWT_VERSION >= 327000])
+ PYTHON_CHECK_MODULE([PyQt4.Qwt5], [PyQwt5 for Qt4], \
+ [], [passed=no], \
+ [PyQt4.Qwt5.QWT_VERSION >= 327000])
# Check for:
# QtOpenGL
@@ -82,6 +81,7 @@ AC_DEFUN([GRC_GR_QTGUI],[
AC_CONFIG_FILES([ \
gr-qtgui/Makefile \
+ gr-qtgui/grc/Makefile \
gr-qtgui/src/Makefile \
gr-qtgui/src/lib/Makefile \
gr-qtgui/src/python/Makefile \
diff --git a/config/grc_gr_wxgui.m4 b/config/grc_gr_wxgui.m4
index c443f7c6c..17925fcc5 100644
--- a/config/grc_gr_wxgui.m4
+++ b/config/grc_gr_wxgui.m4
@@ -36,6 +36,7 @@ AC_DEFUN([GRC_GR_WXGUI],[
AC_CONFIG_FILES([ \
gr-wxgui/Makefile \
gr-wxgui/gr-wxgui.pc \
+ gr-wxgui/grc/Makefile \
gr-wxgui/src/Makefile \
gr-wxgui/src/python/Makefile \
gr-wxgui/src/python/plotter/Makefile \
diff --git a/gr-qtgui/Makefile.am b/gr-qtgui/Makefile.am
index d53f96c1f..30b249589 100644
--- a/gr-qtgui/Makefile.am
+++ b/gr-qtgui/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2008 Free Software Foundation, Inc.
+# Copyright 2008-2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,3 +23,7 @@ include $(top_srcdir)/Makefile.common
SUBDIRS = src
DIST_SUBDIRS = src
+
+if PYTHON
+SUBDIRS += grc
+endif
diff --git a/gr-qtgui/grc/.gitignore b/gr-qtgui/grc/.gitignore
new file mode 100644
index 000000000..b336cc7ce
--- /dev/null
+++ b/gr-qtgui/grc/.gitignore
@@ -0,0 +1,2 @@
+/Makefile
+/Makefile.in
diff --git a/gr-qtgui/grc/Makefile.am b/gr-qtgui/grc/Makefile.am
new file mode 100644
index 000000000..b3114268c
--- /dev/null
+++ b/gr-qtgui/grc/Makefile.am
@@ -0,0 +1,33 @@
+#
+# Copyright 2010-2011 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+include $(top_srcdir)/Makefile.common
+
+grcblocksdir = $(grc_blocksdir)
+
+dist_grcblocks_DATA = \
+ qtgui_check_box.xml \
+ qtgui_entry.xml \
+ qtgui_label.xml \
+ qtgui_range.xml \
+ qtgui_sink_x.xml \
+ qtgui_tab_widget.xml \
+ qtgui_chooser.xml
diff --git a/gr-qtgui/grc/qtgui_check_box.xml b/gr-qtgui/grc/qtgui_check_box.xml
new file mode 100644
index 000000000..95f4f968a
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_check_box.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable Check Box:
+## a gui check box form
+###################################################
+ -->
+<block>
+ <name>QT GUI Check Box</name>
+ <key>variable_qtgui_check_box</key>
+ <category>QT GUI Widgets</category>
+ <import>from PyQt4 import Qt</import>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make>#set $win = '_%s_check_box'%$id
+#if not $label()
+ #set $label = '"%s"'%$id
+#end if
+$win = Qt.QCheckBox($label)
+self._$(id)_choices = {True: $true, False: $false}
+self._$(id)_choices_inv = dict((v,k) for k,v in self._$(id)_choices.iteritems())
+self._$(id)_callback = lambda i: $(win).setChecked(self._$(id)_choices_inv[i])
+self._$(id)_callback(self.$id)
+$(win).stateChanged.connect(lambda i: self.set_$(id)(self._$(id)_choices[bool(i)]))
+$(gui_hint()($win))</make>
+ <callback>self.set_$(id)($value)</callback>
+ <callback>self._$(id)_callback($id)</callback>
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $label() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>int</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option><name>Float</name><key>real</key><opt>conv:float</opt></option>
+ <option><name>Integer</name><key>int</key><opt>conv:int</opt></option>
+ <option><name>String</name><key>string</key><opt>conv:str</opt></option>
+ <option><name>Boolean</name><key>bool</key><opt>conv:bool</opt></option>
+ <option><name>Any</name><key>raw</key><opt>conv:eval</opt></option>
+ </param>
+ <param>
+ <name>Default Value</name>
+ <key>value</key>
+ <value>True</value>
+ <type>$type</type>
+ </param>
+ <param>
+ <name>True</name>
+ <key>true</key>
+ <value>True</value>
+ <type>$type</type>
+ </param>
+ <param>
+ <name>False</name>
+ <key>false</key>
+ <value>False</value>
+ <type>$type</type>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+ <check>$value in ($true, $false)</check>
+ <doc>
+This block creates a variable check box. \
+Leave the label blank to use the variable id as the label.
+
+A check box selects between two values of similar type. \
+Te values do not necessarily need to be of boolean type.
+
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-qtgui/grc/qtgui_chooser.xml b/gr-qtgui/grc/qtgui_chooser.xml
new file mode 100644
index 000000000..cb5090289
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_chooser.xml
@@ -0,0 +1,251 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable Chooser:
+## A chooser, radio buttons
+###################################################
+ -->
+<block>
+ <name>QT GUI Chooser</name>
+ <key>variable_qtgui_chooser</key>
+ <category>QT GUI Widgets</category>
+ <import>from PyQt4 import Qt</import>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make>#slurp
+#set $all_options = [$option0, $option1, $option2, $option3, $option4][:int($num_opts())]
+#set $all_labels = [$label0, $label1, $label2, $label3, $label4][:int($num_opts())]
+#if not $label()
+ #set $label = '"%s"'%$id
+#end if
+########################################################################
+## Create the options list
+########################################################################
+#if int($num_opts())
+self._$(id)_options = (#slurp
+ #for $ch in $all_options
+$ch, #slurp
+ #end for
+)
+#else
+self._$(id)_options = $options
+#end if
+########################################################################
+## Create the labels list
+########################################################################
+#if int($num_opts())
+self._$(id)_labels = (#slurp
+ #for i, $lbl in enumerate($all_labels)
+ #if $lbl()
+$lbl, #slurp
+ #else
+str(self._$(id)_options[$i]), #slurp
+ #end if
+ #end for
+)
+#elif $labels()
+self._$(id)_labels = $labels
+#else
+self._$(id)_labels = map(str, self._$(id)_options)
+#end if
+########################################################################
+## Create the combo box
+########################################################################
+#if $widget() == 'combo_box'
+#set $win = 'self._%s_tool_bar'%$id
+$win = Qt.QToolBar(self)
+$(win).addWidget(Qt.QLabel($label+": "))
+self._$(id)_combo_box = Qt.QComboBox()
+$(win).addWidget(self._$(id)_combo_box)
+for label in self._$(id)_labels: self._$(id)_combo_box.addItem(label)
+self._$(id)_callback = lambda i: self._$(id)_combo_box.setCurrentIndex(self._$(id)_options.index(i))
+self._$(id)_callback(self.$id)
+self._$(id)_combo_box.currentIndexChanged.connect(
+ lambda i: self.set_$(id)(self._$(id)_options[i]))
+#end if
+########################################################################
+## Create the radio buttons
+########################################################################
+#if $widget() == 'radio_buttons'
+#set $win = 'self._%s_group_box'%$id
+$win = Qt.QGroupBox($label)
+self._$(id)_box = $(orient)()
+self._$(id)_button_group = Qt.QButtonGroup()
+$(win).setLayout(self._$(id)_box)
+for i, label in enumerate(self._$(id)_labels):
+ radio_button = Qt.QRadioButton(label)
+ self._$(id)_box.addWidget(radio_button)
+ self._$(id)_button_group.addButton(radio_button, i)
+self._$(id)_callback = lambda i: self._$(id)_button_group.button(self._$(id)_options.index(i)).setChecked(True)
+self._$(id)_callback(self.$id)
+self._$(id)_button_group.buttonClicked[int].connect(
+ lambda i: self.set_$(id)(self._$(id)_options[i]))
+#end if
+$(gui_hint()($win))</make>
+ <callback>self.set_$(id)($value)</callback>
+ <callback>self._$(id)_callback($id)</callback>
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $label() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>int</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option><name>Float</name><key>real</key></option>
+ <option><name>Integer</name><key>int</key></option>
+ <option><name>String</name><key>string</key></option>
+ <option><name>Any</name><key>raw</key></option>
+ </param>
+ <param>
+ <name>Num Options</name>
+ <key>num_opts</key>
+ <value>3</value>
+ <type>enum</type>
+ <option><name>List</name><key>0</key></option>
+ <option><name>1</name><key>1</key></option>
+ <option><name>2</name><key>2</key></option>
+ <option><name>3</name><key>3</key></option>
+ <option><name>4</name><key>4</key></option>
+ <option><name>5</name><key>5</key></option>
+ </param>
+ <param>
+ <name>Default Value</name>
+ <key>value</key>
+ <value>0</value>
+ <type>$type</type>
+ </param>
+ <param>
+ <name>Options</name>
+ <key>options</key>
+ <value>[0, 1, 2]</value>
+ <type>raw</type>
+ <hide>#if int($num_opts()) then 'all' else 'none'#</hide>
+ </param>
+ <param>
+ <name>Labels</name>
+ <key>labels</key>
+ <value>[]</value>
+ <type>raw</type>
+ <hide>#if int($num_opts()) then 'all' else 'none'#</hide>
+ </param>
+ <param>
+ <name>Option 0</name>
+ <key>option0</key>
+ <value>0</value>
+ <type>$type</type>
+ <hide>#if int($num_opts()) > 0 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 0</name>
+ <key>label0</key>
+ <value></value>
+ <type>string</type>
+ <hide>$((int($num_opts()) > 0) and ($label0() and 'none' or 'part') or 'all')</hide>
+ </param>
+ <param>
+ <name>Option 1</name>
+ <key>option1</key>
+ <value>1</value>
+ <type>$type</type>
+ <hide>#if int($num_opts()) > 1 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 1</name>
+ <key>label1</key>
+ <value></value>
+ <type>string</type>
+ <hide>$((int($num_opts()) > 1) and ($label1() and 'none' or 'part') or 'all')</hide>
+ </param>
+ <param>
+ <name>Option 2</name>
+ <key>option2</key>
+ <value>2</value>
+ <type>$type</type>
+ <hide>#if int($num_opts()) > 2 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 2</name>
+ <key>label2</key>
+ <value></value>
+ <type>string</type>
+ <hide>$((int($num_opts()) > 2) and ($label2() and 'none' or 'part') or 'all')</hide>
+ </param>
+ <param>
+ <name>Option 3</name>
+ <key>option3</key>
+ <value>3</value>
+ <type>$type</type>
+ <hide>#if int($num_opts()) > 3 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 3</name>
+ <key>label3</key>
+ <value></value>
+ <type>string</type>
+ <hide>$((int($num_opts()) > 3) and ($label3() and 'none' or 'part') or 'all')</hide>
+ </param>
+ <param>
+ <name>Option 4</name>
+ <key>option4</key>
+ <value>4</value>
+ <type>$type</type>
+ <hide>#if int($num_opts()) > 4 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 4</name>
+ <key>label4</key>
+ <value></value>
+ <type>string</type>
+ <hide>$((int($num_opts()) > 4) and ($label4() and 'none' or 'part') or 'all')</hide>
+ </param>
+ <param>
+ <name>Widget</name>
+ <key>widget</key>
+ <value>combo_box</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option><name>Combo Box</name><key>combo_box</key></option>
+ <option><name>Radio Buttons</name><key>radio_buttons</key></option>
+ </param>
+ <param>
+ <name>Orientation</name>
+ <key>orient</key>
+ <value>Qt.QVBoxLayout</value>
+ <type>enum</type>
+ <hide>#if $widget() == 'radio_buttons' then 'part' else 'all'#</hide>
+ <option>
+ <name>Horizontal</name>
+ <key>Qt.QHBoxLayout</key>
+ </option>
+ <option>
+ <name>Vertical</name>
+ <key>Qt.QVBoxLayout</key>
+ </option>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+ <doc>
+This block creates a variable with enumerated options. \
+The gui widget is implemented as a combo box or radio button group. \
+Leave the label blank to use the variable id as the label.
+
+Choose the number of options available to your chooser. \
+When the label is left blank, the option will be used as the label. \
+Set the number of options to "list" to enter a single list of options and labels. \
+When the labels is an empty list, the options will be used as the label.
+
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-qtgui/grc/qtgui_entry.xml b/gr-qtgui/grc/qtgui_entry.xml
new file mode 100644
index 000000000..1a98402a0
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_entry.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable Text Entry:
+## a gui text box form
+###################################################
+ -->
+<block>
+ <name>QT GUI Entry</name>
+ <key>variable_qtgui_entry</key>
+ <category>QT GUI Widgets</category>
+ <import>from PyQt4 import Qt</import>
+ <import>from gnuradio import eng_notation</import>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make>#set $win = 'self._%s_tool_bar'%$id
+$win = Qt.QToolBar(self)
+#if not $label()
+ #set $label = '"%s"'%$id
+#end if
+$(win).addWidget(Qt.QLabel($label+": "))
+self._$(id)_line_edit = Qt.QLineEdit(str(self.$id))
+self._$(id)_tool_bar.addWidget(self._$(id)_line_edit)
+self._$(id)_line_edit.returnPressed.connect(
+ lambda: self.set_$(id)($(type.conv)(self._$(id)_line_edit.text().toAscii())))
+$(gui_hint()($win))</make>
+ <callback>self.set_$(id)($value)</callback>
+ <callback>self._$(id)_line_edit.setText($(type.str)($id))</callback>
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $label() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>int</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option><name>Float</name><key>real</key><opt>conv:eng_notation.str_to_num</opt><opt>str:eng_notation.num_to_str</opt></option>
+ <option><name>Integer</name><key>int</key><opt>conv:int</opt><opt>str:str</opt></option>
+ <option><name>String</name><key>string</key><opt>conv:str</opt><opt>str:str</opt></option>
+ <option><name>Boolean</name><key>bool</key><opt>conv:bool</opt><opt>str:str</opt></option>
+ <option><name>Any</name><key>raw</key><opt>conv:eval</opt><opt>str:repr</opt></option>
+ </param>
+ <param>
+ <name>Default Value</name>
+ <key>value</key>
+ <value>0</value>
+ <type>$type</type>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+ <doc>
+This block creates a variable with a text entry box. \
+Leave the label blank to use the variable id as the label.
+
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-qtgui/grc/qtgui_label.xml b/gr-qtgui/grc/qtgui_label.xml
new file mode 100644
index 000000000..5049118c4
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_label.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable Label Text:
+## a gui static text form
+###################################################
+ -->
+<block>
+ <name>QT GUI Label</name>
+ <key>variable_qtgui_label</key>
+ <category>QT GUI Widgets</category>
+ <import>from PyQt4 import Qt</import>
+ <import>from gnuradio import eng_notation</import>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make>#set $win = 'self._%s_tool_bar'%$id
+$win = Qt.QToolBar(self)
+#if not $label()
+ #set $label = '"%s"'%$id
+#end if
+$(win).addWidget(Qt.QLabel($label+": "))
+self._$(id)_label = Qt.QLabel(str(self.$id))
+self._$(id)_tool_bar.addWidget(self._$(id)_label)
+$(gui_hint()($win))</make>
+ <callback>self.set_$(id)($value)</callback>
+ <callback>self._$(id)_label.setText($(type.str)($id))</callback>
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $label() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>int</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option><name>Float</name><key>real</key><opt>conv:eng_notation.str_to_num</opt><opt>str:eng_notation.num_to_str</opt></option>
+ <option><name>Integer</name><key>int</key><opt>conv:int</opt><opt>str:str</opt></option>
+ <option><name>String</name><key>string</key><opt>conv:str</opt><opt>str:str</opt></option>
+ <option><name>Boolean</name><key>bool</key><opt>conv:bool</opt><opt>str:str</opt></option>
+ <option><name>Any</name><key>raw</key><opt>conv:eval</opt><opt>str:repr</opt></option>
+ </param>
+ <param>
+ <name>Default Value</name>
+ <key>value</key>
+ <value>0</value>
+ <type>$type</type>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+ <doc>
+This block creates a variable with a label widget for text. \
+Leave the label blank to use the variable id as the label.
+
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-qtgui/grc/qtgui_range.xml b/gr-qtgui/grc/qtgui_range.xml
new file mode 100644
index 000000000..6b0555f98
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_range.xml
@@ -0,0 +1,211 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable Range:
+## ranged widgets like a slider or a knob
+###################################################
+ -->
+<block>
+ <name>QT GUI Range</name>
+ <key>variable_qtgui_range</key>
+ <category>QT GUI Widgets</category>
+ <import>from PyQt4 import Qt</import>
+ <import>import PyQt4.Qwt5 as Qwt</import>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make>#set $win = 'self._%s_layout'%$id
+#if not $label()
+ #set $label = '"%s"'%$id
+#end if
+########################################################################
+#if $widget() == "knob"
+########################################################################
+$win = Qt.QVBoxLayout()
+self._$(id)_knob = Qwt.QwtKnob()
+self._$(id)_knob.setRange($start, $stop, $step)
+self._$(id)_knob.setValue(self.$id)
+self._$(id)_knob.valueChanged.connect(self.set_$(id))
+$(win).addWidget(self._$(id)_knob)
+self._$(id)_label = Qt.QLabel($label)
+self._$(id)_label.setAlignment(Qt.Qt.AlignTop | Qt.Qt.AlignHCenter)
+$(win).addWidget(self._$(id)_label)
+#end if
+########################################################################
+#if $widget() == "thermo"
+########################################################################
+$win = Qt.QVBoxLayout()
+self._$(id)_label = Qt.QLabel($label)
+self._$(id)_thermo = Qwt.QwtThermo()
+self._$(id)_thermo.setScalePosition(Qwt.QwtThermo.$orient.scalepos)
+self._$(id)_thermo.setRange($start, $stop)
+self._$(id)_thermo.setValue(self.$id)
+self._$(id)_thermo.$(orient.minfcn)($min_len)
+#if 'horizontal' in $orient().lower()
+self._$(id)_label.setAlignment(Qt.Qt.AlignBottom | Qt.Qt.AlignHCenter)
+$(win).addWidget(self._$(id)_label)
+$(win).addWidget(self._$(id)_thermo)
+#elif 'vertical' in $orient().lower()
+self._$(id)_label.setAlignment(Qt.Qt.AlignTop)
+$(win).addWidget(self._$(id)_thermo)
+$(win).addWidget(self._$(id)_label)
+#end if
+#end if
+########################################################################
+#if $widget() == "counter"
+########################################################################
+$win = Qt.QHBoxLayout()
+$(win).addWidget(Qt.QLabel($label+": "))
+self._$(id)_counter = Qwt.QwtCounter()
+self._$(id)_counter.setRange($start, $stop, $step)
+self._$(id)_counter.setNumButtons(2)
+self._$(id)_counter.setMinimumWidth($min_len)
+self._$(id)_counter.setValue(self.$id)
+$(win).addWidget(self._$(id)_counter)
+self._$(id)_counter.valueChanged.connect(self.set_$(id))
+#end if
+########################################################################
+#if $widget() == "slider"
+########################################################################
+$win = Qt.QVBoxLayout()
+self._$(id)_label = Qt.QLabel($label)
+self._$(id)_slider = Qwt.QwtSlider(None, Qt.$orient, Qwt.QwtSlider.$orient.scalepos, Qwt.QwtSlider.BgSlot)
+self._$(id)_slider.setRange($start, $stop, $step)
+self._$(id)_slider.setValue(self.$id)
+self._$(id)_slider.$(orient.minfcn)($min_len)
+self._$(id)_slider.valueChanged.connect(self.set_$(id))
+#if 'horizontal' in $orient().lower()
+self._$(id)_label.setAlignment(Qt.Qt.AlignBottom | Qt.Qt.AlignHCenter)
+$(win).addWidget(self._$(id)_label)
+$(win).addWidget(self._$(id)_slider)
+#elif 'vertical' in $orient().lower()
+self._$(id)_label.setAlignment(Qt.Qt.AlignTop)
+$(win).addWidget(self._$(id)_slider)
+$(win).addWidget(self._$(id)_label)
+#end if
+#end if
+########################################################################
+#if $widget() == "counter_slider"
+########################################################################
+$win = Qt.QVBoxLayout()
+self._$(id)_tool_bar = Qt.QToolBar(self)
+$(win).addWidget(self._$(id)_tool_bar)
+self._$(id)_tool_bar.addWidget(Qt.QLabel($label+": "))
+self._$(id)_counter = Qwt.QwtCounter()
+self._$(id)_counter.setRange($start, $stop, $step)
+self._$(id)_counter.setNumButtons(2)
+self._$(id)_counter.setValue(self.$id)
+self._$(id)_tool_bar.addWidget(self._$(id)_counter)
+self._$(id)_counter.valueChanged.connect(self.set_$(id))
+self._$(id)_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
+self._$(id)_slider.setRange($start, $stop, $step)
+self._$(id)_slider.setValue(self.$id)
+self._$(id)_slider.setMinimumWidth($min_len)
+self._$(id)_slider.valueChanged.connect(self.set_$(id))
+$(win).addWidget(self._$(id)_slider)
+#end if
+$(gui_hint()($win))</make>
+ <callback>self.set_$(id)($value)</callback>
+ <callback>#if $widget() == "knob"
+self._$(id)_knob.setValue($id)
+#end if
+#if $widget() == "thermo"
+self._$(id)_thermo.setValue($id)
+#end if
+#if $widget() == "counter"
+self._$(id)_counter.setValue($id)
+#end if
+#if $widget() == "slider"
+self._$(id)_slider.setValue($id)
+#end if
+#if $widget() == "counter_slider"
+self._$(id)_counter.setValue($id)
+self._$(id)_slider.setValue($id)
+#end if</callback>
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $label() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Default Value</name>
+ <key>value</key>
+ <value>50</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Start</name>
+ <key>start</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Stop</name>
+ <key>stop</key>
+ <value>100</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Step</name>
+ <key>step</key>
+ <value>1</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Widget</name>
+ <key>widget</key>
+ <value>counter_slider</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option><name>Counter + Slider</name><key>counter_slider</key></option>
+ <option><name>Counter</name><key>counter</key></option>
+ <option><name>Slider</name><key>slider</key></option>
+ <option><name>Knob</name><key>knob</key></option>
+ <option><name>Thermo</name><key>thermo</key></option>
+ </param>
+ <param>
+ <name>Orientation</name>
+ <key>orient</key>
+ <value>Qt.Horizontal</value>
+ <type>enum</type>
+ <hide>#if $widget() in ("slider", "thermo") then 'part' else 'all'#</hide>
+ <option>
+ <name>Horizontal</name>
+ <key>Qt.Horizontal</key>
+ <opt>scalepos:BottomScale</opt>
+ <opt>minfcn:setMinimumWidth</opt>
+ </option>
+ <option>
+ <name>Vertical</name>
+ <key>Qt.Vertical</key>
+ <opt>scalepos:LeftScale</opt>
+ <opt>minfcn:setMinimumHeight</opt>
+ </option>
+ </param>
+ <param>
+ <name>Minimum Length</name>
+ <key>min_len</key>
+ <value>200</value>
+ <type>int</type>
+ <hide>#if $widget().split('_')[0] in ("slider", "counter", "thermo") then 'part' else 'all'#</hide>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+ <check>$start &lt;= $value &lt;= $stop</check>
+ <check>$start &lt; $stop</check>
+ <doc>
+This block creates a variable with a slider. \
+Leave the label blank to use the variable id as the label. \
+The value must be a real number. \
+The value must be between the start and the stop.
+
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-qtgui/grc/qtgui_sink_x.xml b/gr-qtgui/grc/qtgui_sink_x.xml
new file mode 100644
index 000000000..7a5f5ec13
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_sink_x.xml
@@ -0,0 +1,136 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##QT GUI Sink
+###################################################
+ -->
+<block>
+ <name>QT GUI Sink</name>
+ <key>qtgui_sink_x</key>
+ <category>QT GUI Widgets</category>
+ <import>from PyQt4 import Qt</import>
+ <import>from gnuradio.qtgui import qtgui</import>
+ <import>from gnuradio.gr import firdes</import>
+ <import>import sip</import>
+ <make>#set $win = 'self._%s_win'%$id
+qtgui.$(type.fcn)(
+ $fftsize, \#fftsize
+ $wintype, \#wintype
+ $fc, \#fc
+ $bw, \#bw
+ $name, \#name
+ $plotfreq, \#plotfreq
+ $plotwaterfall, \#plotwaterfall
+ $plotwaterfall3d, \#plotwaterfall3d
+ $plottime, \#plottime
+ $plotconst, \#plotconst
+)
+self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget)
+$(gui_hint()($win))</make>
+ <callback>set_frequency_range($fc, $bw)</callback>
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>complex</value>
+ <type>enum</type>
+ <option><name>Complex</name><key>complex</key><opt>fcn:sink_c</opt></option>
+ <option><name>Float</name><key>float</key><opt>fcn:sink_f</opt></option>
+ </param>
+ <param>
+ <name>Name</name>
+ <key>name</key>
+ <value>QT GUI Plot</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>FFT Size</name>
+ <key>fftsize</key>
+ <value>1024</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Window Type</name>
+ <key>wintype</key>
+ <value>firdes.WIN_BLACKMAN_hARRIS</value>
+ <type>int</type>
+ <hide>part</hide>
+ <option>
+ <name>Blackman-harris</name>
+ <key>firdes.WIN_BLACKMAN_hARRIS</key>
+ </option>
+ </param>
+ <param>
+ <name>Center Frequency (Hz)</name>
+ <key>fc</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Bandwidth (Hz)</name>
+ <key>bw</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Plot Frequency</name>
+ <key>plotfreq</key>
+ <value>True</value>
+ <type>bool</type>
+ <hide>part</hide>
+ <option><name>On</name><key>True</key></option>
+ <option><name>Off</name><key>False</key></option>
+ </param>
+ <param>
+ <name>Plot Waterfall</name>
+ <key>plotwaterfall</key>
+ <value>True</value>
+ <type>bool</type>
+ <hide>part</hide>
+ <option><name>On</name><key>True</key></option>
+ <option><name>Off</name><key>False</key></option>
+ </param>
+ <param>
+ <name>Plot Waterfall 3D</name>
+ <key>plotwaterfall3d</key>
+ <value>True</value>
+ <type>bool</type>
+ <hide>part</hide>
+ <option><name>On</name><key>True</key></option>
+ <option><name>Off</name><key>False</key></option>
+ </param>
+ <param>
+ <name>Plot Time</name>
+ <key>plottime</key>
+ <value>True</value>
+ <type>bool</type>
+ <hide>part</hide>
+ <option><name>On</name><key>True</key></option>
+ <option><name>Off</name><key>False</key></option>
+ </param>
+ <param>
+ <name>Plot Const</name>
+ <key>plotconst</key>
+ <value>True</value>
+ <type>bool</type>
+ <hide>part</hide>
+ <option><name>On</name><key>True</key></option>
+ <option><name>Off</name><key>False</key></option>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <nports>$num_inputs</nports>
+ </sink>
+ <doc>
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-qtgui/grc/qtgui_tab_widget.xml b/gr-qtgui/grc/qtgui_tab_widget.xml
new file mode 100644
index 000000000..f90054109
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_tab_widget.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##WX GUI Notebook
+###################################################
+ -->
+<block>
+ <name>QT GUI Tab Widget</name>
+ <key>qtgui_tab_widget</key>
+ <category>QT GUI Widgets</category>
+ <import>from PyQt4 import Qt</import>
+ <make>#set $win = 'self.%s'%$id
+Qt.QTabWidget()
+#set $all_labels = [$label0, $label1, $label2, $label3, $label4][:int($num_tabs())]
+#for i, label in enumerate($all_labels)
+self.$(id)_widget_$(i) = Qt.QWidget()
+self.$(id)_layout_$(i) = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.$(id)_widget_$(i))
+self.$(id)_grid_layout_$(i) = Qt.QGridLayout()
+self.$(id)_layout_$(i).addLayout(self.$(id)_grid_layout_$(i))
+$(win).addTab(self.$(id)_widget_$(i), $label)
+#end for
+$(gui_hint()($win))</make>
+ <param>
+ <name>Num Tabs</name>
+ <key>num_tabs</key>
+ <value>1</value>
+ <type>enum</type>
+ <option><name>1</name><key>1</key></option>
+ <option><name>2</name><key>2</key></option>
+ <option><name>3</name><key>3</key></option>
+ <option><name>4</name><key>4</key></option>
+ <option><name>5</name><key>5</key></option>
+ </param>
+ <param>
+ <name>Label 0</name>
+ <key>label0</key>
+ <value>Tab 0</value>
+ <type>string</type>
+ <hide>#if int($num_tabs()) > 0 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 1</name>
+ <key>label1</key>
+ <value>Tab 1</value>
+ <type>string</type>
+ <hide>#if int($num_tabs()) > 1 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 2</name>
+ <key>label2</key>
+ <value>Tab 2</value>
+ <type>string</type>
+ <hide>#if int($num_tabs()) > 2 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 3</name>
+ <key>label3</key>
+ <value>Tab 3</value>
+ <type>string</type>
+ <hide>#if int($num_tabs()) > 3 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Label 4</name>
+ <key>label4</key>
+ <value>Tab 4</value>
+ <type>string</type>
+ <hide>#if int($num_tabs()) > 4 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+ <doc>
+This block creates a tabbed widget to organize other widgets. \
+The ID of this block can be used as the tab_id in the GUI hints of other widgets.
+
+The GUI hint can be used to position the widget within the application. \
+The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
+Both the tab specification and the grid position are optional.
+ </doc>
+</block>
diff --git a/gr-wxgui/Makefile.am b/gr-wxgui/Makefile.am
index cee66e587..cfc7a429c 100644
--- a/gr-wxgui/Makefile.am
+++ b/gr-wxgui/Makefile.am
@@ -27,7 +27,7 @@ EXTRA_DIST += \
README.gl
if PYTHON
-SUBDIRS = src
+SUBDIRS = src grc
etcdir = $(gr_prefsdir)
dist_etc_DATA = gr-wxgui.conf
diff --git a/gr-wxgui/grc/.gitignore b/gr-wxgui/grc/.gitignore
new file mode 100644
index 000000000..b336cc7ce
--- /dev/null
+++ b/gr-wxgui/grc/.gitignore
@@ -0,0 +1,2 @@
+/Makefile
+/Makefile.in
diff --git a/gr-wxgui/grc/Makefile.am b/gr-wxgui/grc/Makefile.am
new file mode 100644
index 000000000..d8c7b3471
--- /dev/null
+++ b/gr-wxgui/grc/Makefile.am
@@ -0,0 +1,45 @@
+#
+# Copyright 2011 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+include $(top_srcdir)/Makefile.common
+
+grcblocksdir = $(grc_blocksdir)
+dist_grcblocks_DATA = \
+ notebook.xml \
+ variable_check_box.xml \
+ variable_chooser.xml \
+ variable_slider.xml \
+ variable_static_text.xml \
+ variable_text_box.xml \
+ wxgui_constellationsink2.xml \
+ wxgui_fftsink2.xml \
+ wxgui_histosink2.xml \
+ wxgui_numbersink2.xml \
+ wxgui_scopesink2.xml \
+ wxgui_termsink.xml \
+ wxgui_waterfallsink2.xml
+
+#The wxgui module contains a top_block + wxgui frame.
+wxgui_pythondir = $(pythondir)/grc_gnuradio/wxgui
+wxgui_python_PYTHON = \
+ __init__.py \
+ panel.py \
+ top_block_gui.py
diff --git a/grc/grc_gnuradio/wxgui/__init__.py b/gr-wxgui/grc/__init__.py
index 81427253b..81427253b 100644
--- a/grc/grc_gnuradio/wxgui/__init__.py
+++ b/gr-wxgui/grc/__init__.py
diff --git a/grc/blocks/notebook.xml b/gr-wxgui/grc/notebook.xml
index d41db9e2d..bb3de51cb 100644
--- a/grc/blocks/notebook.xml
+++ b/gr-wxgui/grc/notebook.xml
@@ -5,8 +5,9 @@
###################################################
-->
<block>
- <name>Notebook</name>
+ <name>WX GUI Notebook</name>
<key>notebook</key>
+ <category>WX GUI Widgets</category>
<import>from grc_gnuradio import wxgui as grc_wxgui</import>
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
self.$(id) = wx.Notebook($(parent).GetWin(), style=$style)
diff --git a/grc/grc_gnuradio/wxgui/panel.py b/gr-wxgui/grc/panel.py
index e62133cac..e62133cac 100644
--- a/grc/grc_gnuradio/wxgui/panel.py
+++ b/gr-wxgui/grc/panel.py
diff --git a/grc/grc_gnuradio/wxgui/top_block_gui.py b/gr-wxgui/grc/top_block_gui.py
index 333ccf1c1..333ccf1c1 100644
--- a/grc/grc_gnuradio/wxgui/top_block_gui.py
+++ b/gr-wxgui/grc/top_block_gui.py
diff --git a/grc/blocks/variable_check_box.xml b/gr-wxgui/grc/variable_check_box.xml
index a703703c7..0c7bd1081 100644
--- a/grc/blocks/variable_check_box.xml
+++ b/gr-wxgui/grc/variable_check_box.xml
@@ -6,8 +6,9 @@
###################################################
-->
<block>
- <name>Variable Check Box</name>
+ <name>WX GUI Check Box</name>
<key>variable_check_box</key>
+ <category>WX GUI Widgets</category>
<import>from gnuradio.wxgui import forms</import>
<var_make>self.$(id) = $(id) = $value</var_make>
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
diff --git a/grc/blocks/variable_chooser.xml b/gr-wxgui/grc/variable_chooser.xml
index ee41f26db..e16e88c5d 100644
--- a/grc/blocks/variable_chooser.xml
+++ b/gr-wxgui/grc/variable_chooser.xml
@@ -7,8 +7,9 @@
###################################################
-->
<block>
- <name>Variable Chooser</name>
+ <name>WX GUI Chooser</name>
<key>variable_chooser</key>
+ <category>WX GUI Widgets</category>
<import>from gnuradio.wxgui import forms</import>
<var_make>self.$(id) = $(id) = $value</var_make>
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
diff --git a/grc/blocks/variable_slider.xml b/gr-wxgui/grc/variable_slider.xml
index c13d20856..5e3c175aa 100644
--- a/grc/blocks/variable_slider.xml
+++ b/gr-wxgui/grc/variable_slider.xml
@@ -6,8 +6,9 @@
###################################################
-->
<block>
- <name>Variable Slider</name>
+ <name>WX GUI Slider</name>
<key>variable_slider</key>
+ <category>WX GUI Widgets</category>
<import>from gnuradio.wxgui import forms</import>
<var_make>self.$(id) = $(id) = $value</var_make>
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
diff --git a/grc/blocks/variable_static_text.xml b/gr-wxgui/grc/variable_static_text.xml
index c866b998d..cd122e76a 100644
--- a/grc/blocks/variable_static_text.xml
+++ b/gr-wxgui/grc/variable_static_text.xml
@@ -6,8 +6,9 @@
###################################################
-->
<block>
- <name>Variable Static Text</name>
+ <name>WX GUI Static Text</name>
<key>variable_static_text</key>
+ <category>WX GUI Widgets</category>
<import>from gnuradio.wxgui import forms</import>
<var_make>self.$(id) = $(id) = $value</var_make>
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
diff --git a/grc/blocks/variable_text_box.xml b/gr-wxgui/grc/variable_text_box.xml
index 1b4b4355e..afff839cf 100644
--- a/grc/blocks/variable_text_box.xml
+++ b/gr-wxgui/grc/variable_text_box.xml
@@ -6,8 +6,9 @@
###################################################
-->
<block>
- <name>Variable Text Box</name>
+ <name>WX GUI Text Box</name>
<key>variable_text_box</key>
+ <category>WX GUI Widgets</category>
<import>from gnuradio.wxgui import forms</import>
<var_make>self.$(id) = $(id) = $value</var_make>
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
diff --git a/grc/blocks/wxgui_constellationsink2.xml b/gr-wxgui/grc/wxgui_constellationsink2.xml
index 598b55064..c200790f9 100644
--- a/grc/blocks/wxgui_constellationsink2.xml
+++ b/gr-wxgui/grc/wxgui_constellationsink2.xml
@@ -5,8 +5,9 @@
###################################################
-->
<block>
- <name>Constellation Sink</name>
+ <name>WX GUI Constellation Sink</name>
<key>wxgui_constellationsink2</key>
+ <category>WX GUI Widgets</category>
<import>from gnuradio.wxgui import constsink_gl</import>
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
constsink_gl.const_sink_c(
diff --git a/grc/blocks/wxgui_fftsink2.xml b/gr-wxgui/grc/wxgui_fftsink2.xml
index 8df8f90d0..9b35ab848 100644
--- a/grc/blocks/wxgui_fftsink2.xml
+++ b/gr-wxgui/grc/wxgui_fftsink2.xml
@@ -5,8 +5,9 @@
###################################################
-->
<block>
- <name>FFT Sink</name>
+ <name>WX GUI FFT Sink</name>
<key>wxgui_fftsink2</key>
+ <category>WX GUI Widgets</category>
<import>from gnuradio import window</import>
<import>from gnuradio.wxgui import fftsink2</import>
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
diff --git a/grc/blocks/wxgui_histosink2.xml b/gr-wxgui/grc/wxgui_histosink2.xml
index 9edf9650d..f4f6a2959 100644
--- a/grc/blocks/wxgui_histosink2.xml
+++ b/gr-wxgui/grc/wxgui_histosink2.xml
@@ -5,8 +5,9 @@
###################################################
-->
<block>
- <name>Histo Sink</name>
+ <name>WX GUI Histo Sink</name>
<key>wxgui_histosink2</key>
+ <category>WX GUI Widgets</category>
<import>from gnuradio.wxgui import histosink_gl</import>
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
histosink_gl.histo_sink_f(
diff --git a/grc/blocks/wxgui_numbersink2.xml b/gr-wxgui/grc/wxgui_numbersink2.xml
index ad93dec08..255926610 100644
--- a/grc/blocks/wxgui_numbersink2.xml
+++ b/gr-wxgui/grc/wxgui_numbersink2.xml
@@ -5,8 +5,9 @@
###################################################
-->
<block>
- <name>Number Sink</name>
+ <name>WX GUI Number Sink</name>
<key>wxgui_numbersink2</key>
+ <category>WX GUI Widgets</category>
<import>from gnuradio.wxgui import numbersink2</import>
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
numbersink2.$(type.fcn)(
diff --git a/grc/blocks/wxgui_scopesink2.xml b/gr-wxgui/grc/wxgui_scopesink2.xml
index ef0377373..dbf983e11 100644
--- a/grc/blocks/wxgui_scopesink2.xml
+++ b/gr-wxgui/grc/wxgui_scopesink2.xml
@@ -5,8 +5,9 @@
###################################################
-->
<block>
- <name>Scope Sink</name>
+ <name>WX GUI Scope Sink</name>
<key>wxgui_scopesink2</key>
+ <category>WX GUI Widgets</category>
<import>from gnuradio.wxgui import scopesink2</import>
<import>from gnuradio import gr</import>
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
diff --git a/grc/blocks/wxgui_termsink.xml b/gr-wxgui/grc/wxgui_termsink.xml
index 985d89b58..3e35c7578 100644
--- a/grc/blocks/wxgui_termsink.xml
+++ b/gr-wxgui/grc/wxgui_termsink.xml
@@ -5,8 +5,9 @@
###################################################
-->
<block>
- <name>Terminal Sink</name>
+ <name>WX GUI Terminal Sink</name>
<key>wxgui_termsink</key>
+ <category>WX GUI Widgets</category>
<import>from gnuradio.wxgui import termsink</import>
diff --git a/grc/blocks/wxgui_waterfallsink2.xml b/gr-wxgui/grc/wxgui_waterfallsink2.xml
index 3de67597f..7c646c3b2 100644
--- a/grc/blocks/wxgui_waterfallsink2.xml
+++ b/gr-wxgui/grc/wxgui_waterfallsink2.xml
@@ -5,8 +5,9 @@
###################################################
-->
<block>
- <name>Waterfall Sink</name>
+ <name>WX GUI Waterfall Sink</name>
<key>wxgui_waterfallsink2</key>
+ <category>WX GUI Widgets</category>
<import>from gnuradio import window</import>
<import>from gnuradio.wxgui import waterfallsink2</import>
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
diff --git a/grc/blocks/Makefile.am b/grc/blocks/Makefile.am
index 9b5bda298..6f7802169 100644
--- a/grc/blocks/Makefile.am
+++ b/grc/blocks/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2008, 2009 Free Software Foundation, Inc.
+# Copyright 2008-2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -58,7 +58,6 @@ dist_ourdata_DATA = \
blks2_tcp_sink.xml \
blks2_tcp_source.xml \
blks2_valve.xml \
- blks2_variable_sink_x.xml \
blks2_wfm_rcv.xml \
blks2_wfm_rcv_pll.xml \
blks2_wfm_tx.xml \
@@ -156,6 +155,7 @@ dist_ourdata_DATA = \
gr_probe_avg_mag_sqrd_x.xml \
gr_probe_density_b.xml \
gr_probe_mpsk_snr_c.xml \
+ gr_probe_signal_f.xml \
gr_pwr_squelch_xx.xml \
gr_quadrature_demod_cf.xml \
gr_rational_resampler_base_xxx.xml \
@@ -195,12 +195,10 @@ dist_ourdata_DATA = \
import.xml \
low_pass_filter.xml \
note.xml \
- notebook.xml \
options.xml \
pad_sink.xml \
pad_source.xml \
parameter.xml \
- probe_function.xml \
random_source_x.xml \
root_raised_cosine_filter.xml \
trellis_encoder_xx.xml \
@@ -211,20 +209,9 @@ dist_ourdata_DATA = \
trellis_viterbi_combined_xx.xml \
trellis_viterbi_x.xml \
variable.xml \
- variable_check_box.xml \
- variable_chooser.xml \
variable_config.xml \
- variable_slider.xml \
- variable_static_text.xml \
- variable_text_box.xml \
+ variable_function_probe.xml \
virtual_sink.xml \
virtual_source.xml \
- wxgui_constellationsink2.xml \
- wxgui_fftsink2.xml \
- wxgui_histosink2.xml \
- wxgui_numbersink2.xml \
- wxgui_scopesink2.xml \
- wxgui_termsink.xml \
- wxgui_waterfallsink2.xml \
xmlrpc_client.xml \
xmlrpc_server.xml
diff --git a/grc/blocks/blks2_variable_sink_x.xml b/grc/blocks/blks2_variable_sink_x.xml
deleted file mode 100644
index 5709c9f76..000000000
--- a/grc/blocks/blks2_variable_sink_x.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Variable Sink: Custom blks2 block
-###################################################
- -->
-<block>
- <name>Variable Sink</name>
- <key>blks2_variable_sink_x</key>
- <import>from grc_gnuradio import blks2 as grc_blks2</import>
- <make>grc_blks2.variable_sink_$(type.fcn)(
- vlen=$vlen,
- decim=$decim,
- callback=self.set_$(variable()),
-)</make>
- <callback>set_decim($decim)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:c</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:f</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:i</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:s</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:b</opt>
- </option>
- </param>
- <param>
- <name>Variable</name>
- <key>variable</key>
- <value></value>
- <type>string</type>
- </param>
- <param>
- <name>Decimation</name>
- <key>decim</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <doc>
-Read samples from the input stream and \
-write one in every decimation samples to the variable.
-
-The variable must be the id of an existing variable block.
- </doc>
-</block>
diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml
index 466fb05ea..549ffbdbf 100644
--- a/grc/blocks/block_tree.xml
+++ b/grc/blocks/block_tree.xml
@@ -25,7 +25,6 @@
</cat>
<cat>
<name>Sinks</name>
- <block>blks2_variable_sink_x</block>
<block>gr_vector_sink_x</block>
<block>gr_null_sink</block>
<block>gr_file_sink</block>
@@ -37,16 +36,6 @@
<block>virtual_sink</block>
</cat>
<cat>
- <name>Graphical Sinks</name>
- <block>wxgui_numbersink2</block>
- <block>wxgui_scopesink2</block>
- <block>wxgui_fftsink2</block>
- <block>wxgui_constellationsink2</block>
- <block>wxgui_waterfallsink2</block>
- <block>wxgui_histosink2</block>
- <block>wxgui_termsink</block>
- </cat>
- <cat>
<name>Operators</name>
<block>gr_add_xx</block>
<block>gr_sub_xx</block>
@@ -136,7 +125,7 @@
<block>gr_pll_freqdet_cf</block>
<block>gr_pll_refout_cc</block>
- <block>gr_fll_band_edge_cc</block>
+ <block>gr_fll_band_edge_cc</block>
<block>gr_correlate_access_code_bb</block>
<block>gr_pn_correlator_cc</block>
@@ -260,7 +249,7 @@
<block>gr_additive_scrambler_bb</block>
</cat>
<cat>
- <name>Vocoders</name>
+ <name>Vocoders</name>
<block>blks2_cvsd_encode</block>
<block>blks2_cvsd_decode</block>
</cat>
@@ -269,17 +258,13 @@
<block>gr_probe_avg_mag_sqrd_x</block>
<block>gr_probe_density_b</block>
<block>gr_probe_mpsk_snr_c</block>
- <block>probe_function</block>
+ <block>gr_probe_signal_f</block>
</cat>
<cat>
<name>Variables</name>
<block>variable</block>
- <block>variable_slider</block>
- <block>variable_chooser</block>
- <block>variable_check_box</block>
- <block>variable_text_box</block>
- <block>variable_static_text</block>
<block>variable_config</block>
+ <block>variable_function_probe</block>
<block>parameter</block>
</cat>
<cat>
@@ -304,7 +289,5 @@
<block>xmlrpc_server</block>
<block>xmlrpc_client</block>
-
- <block>notebook</block>
</cat>
</cat>
diff --git a/grc/blocks/gr_probe_avg_mag_sqrd_x.xml b/grc/blocks/gr_probe_avg_mag_sqrd_x.xml
index eb855956a..6bf706ae1 100644
--- a/grc/blocks/gr_probe_avg_mag_sqrd_x.xml
+++ b/grc/blocks/gr_probe_avg_mag_sqrd_x.xml
@@ -7,15 +7,10 @@
<block>
<name>Probe Avg Mag^2</name>
<key>gr_probe_avg_mag_sqrd_x</key>
- <import>from grc_gnuradio import blks2 as grc_blks2</import>
- <make>grc_blks2.probe_avg_mag_sqrd_$(type)(
- threshold=$threshold,
- alpha=$alpha,
- probe_rate=$probe_rate,
-)</make>
+ <import>from gnuradio import gr</import>
+ <make>gr.probe_avg_mag_sqrd_$(type)($threshold, $alpha)</make>
<callback>set_alpha($alpha)</callback>
<callback>set_threshold($threshold)</callback>
- <callback>set_probe_rate($probe_rate)</callback>
<param>
<name>Type</name>
<key>type</key>
@@ -43,18 +38,13 @@
<value>1</value>
<type>real</type>
</param>
- <param>
- <name>Probe Rate</name>
- <key>probe_rate</key>
- <value>10</value>
- <type>real</type>
- </param>
<sink>
<name>in</name>
<type>$type.input</type>
</sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
+ <doc>
+Available functions to probe: level()
+
+Use with the function probe block.
+ </doc>
</block>
diff --git a/grc/blocks/gr_probe_density_b.xml b/grc/blocks/gr_probe_density_b.xml
index 74d3b0a2b..3a91256aa 100644
--- a/grc/blocks/gr_probe_density_b.xml
+++ b/grc/blocks/gr_probe_density_b.xml
@@ -7,13 +7,9 @@
<block>
<name>Probe Density</name>
<key>gr_probe_density_b</key>
- <import>from grc_gnuradio import blks2 as grc_blks2</import>
- <make>grc_blks2.probe_density_b(
- alpha=$alpha,
- probe_rate=$probe_rate,
-)</make>
+ <import>from gnuradio import gr</import>
+ <make>gr.probe_density_b($alpha)</make>
<callback>set_alpha($alpha)</callback>
- <callback>set_probe_rate($probe_rate)</callback>
<param>
<name>Alpha</name>
<key>alpha</key>
@@ -30,8 +26,9 @@
<name>in</name>
<type>byte</type>
</sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
+ <doc>
+Available functions to probe: density()
+
+Use with the function probe block.
+ </doc>
</block>
diff --git a/grc/blocks/gr_probe_mpsk_snr_c.xml b/grc/blocks/gr_probe_mpsk_snr_c.xml
index 7f562d2f3..5687e867d 100644
--- a/grc/blocks/gr_probe_mpsk_snr_c.xml
+++ b/grc/blocks/gr_probe_mpsk_snr_c.xml
@@ -7,49 +7,22 @@
<block>
<name>Probe MPSK SNR</name>
<key>gr_probe_mpsk_snr_c</key>
- <import>from grc_gnuradio import blks2 as grc_blks2</import>
- <make>grc_blks2.probe_mpsk_snr_c(
- type='$type',
- alpha=$alpha,
- probe_rate=$probe_rate,
-)</make>
+ <import>from gnuradio import gr</import>
+ <make>gr.probe_mpsk_snr_c($alpha)</make>
<callback>set_alpha($alpha)</callback>
- <callback>set_probe_rate($probe_rate)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>SNR</name>
- <key>snr</key>
- </option>
- <option>
- <name>Signal Mean</name>
- <key>signal_mean</key>
- </option>
- <option>
- <name>Noise Variance</name>
- <key>noise_variance</key>
- </option>
- </param>
<param>
<name>Alpha</name>
<key>alpha</key>
<value>1</value>
<type>real</type>
</param>
- <param>
- <name>Probe Rate</name>
- <key>probe_rate</key>
- <value>10</value>
- <type>real</type>
- </param>
<sink>
<name>in</name>
<type>complex</type>
</sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
+ <doc>
+Available functions to probe: signal_mean(), noise_variance()
+
+Use with the function probe block.
+ </doc>
</block>
diff --git a/grc/blocks/gr_probe_signal_f.xml b/grc/blocks/gr_probe_signal_f.xml
new file mode 100644
index 000000000..5c38e816f
--- /dev/null
+++ b/grc/blocks/gr_probe_signal_f.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Probe Signal
+###################################################
+ -->
+<block>
+ <name>Probe Signal</name>
+ <key>gr_probe_signal_f</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.probe_signal_f()</make>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <doc>
+Available functions to probe: level()
+
+Use with the function probe block.
+ </doc>
+</block>
diff --git a/grc/blocks/options.xml b/grc/blocks/options.xml
index 4d0dd2899..b27ea900c 100644
--- a/grc/blocks/options.xml
+++ b/grc/blocks/options.xml
@@ -15,6 +15,10 @@
from grc_gnuradio import wxgui as grc_wxgui
import wx
#end if
+#if $generate_options() == 'qt_gui'
+from PyQt4 import Qt
+import sys
+#end if
#if $generate_options() != 'hb'
from optparse import OptionParser
from gnuradio.eng_option import eng_option
@@ -56,12 +60,15 @@ else: self.stop(); self.wait()</callback>
<key>generate_options</key>
<value>wx_gui</value>
<type>enum</type>
- <hide>#if $generate_options() == 'wx_gui' then 'part' else 'none'#</hide>
<option>
<name>WX GUI</name>
<key>wx_gui</key>
</option>
<option>
+ <name>QT GUI</name>
+ <key>qt_gui</key>
+ </option>
+ <option>
<name>No GUI</name>
<key>no_gui</key>
</option>
@@ -98,7 +105,7 @@ else: self.stop(); self.wait()</callback>
<value>True</value>
<type>bool</type>
<hide>
-#if $generate_options() == 'wx_gui'
+#if $generate_options() in ('qt_gui', 'wx_gui')
#if $run()
part
#else
diff --git a/grc/blocks/probe_function.xml b/grc/blocks/probe_function.xml
deleted file mode 100644
index ac0b3dcde..000000000
--- a/grc/blocks/probe_function.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Probe Function
-###################################################
- -->
-<block>
- <name>Probe Function</name>
- <key>probe_function</key>
- <import>from grc_gnuradio import blks2 as grc_blks2</import>
- <make>grc_blks2.probe_function(
- probe_callback=self.$(block_id()).$(function_name()),
- probe_rate=$probe_rate,
-)</make>
- <callback>set_probe_rate($probe_rate)</callback>
- <param>
- <name>Block ID</name>
- <key>block_id</key>
- <value>my_block_0</value>
- <type>string</type>
- </param>
- <param>
- <name>Function Name</name>
- <key>function_name</key>
- <value>get_number</value>
- <type>string</type>
- </param>
- <param>
- <name>Probe Rate</name>
- <key>probe_rate</key>
- <value>10</value>
- <type>real</type>
- </param>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
- <doc>
-Polls a function of an arbitrary block and writes the value to the output port. \
-The block id is the id of another block in the flow graph. \
-The function name is the name of a function in the said block. \
-The function should take no arguments and return a floating point or integer number.
- </doc>
-</block>
diff --git a/grc/blocks/variable_function_probe.xml b/grc/blocks/variable_function_probe.xml
new file mode 100644
index 000000000..269966c70
--- /dev/null
+++ b/grc/blocks/variable_function_probe.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Variable function probe
+###################################################
+ -->
+<block>
+ <name>Function Probe</name>
+ <key>variable_function_probe</key>
+ <import>import time</import>
+ <import>import threading</import>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make>#slurp
+def _$(id)_probe():
+ while True:
+ val = self.$(block_id()).$(function_name())($(function_args()))
+ try: self.set_$(id)(val)
+ except AttributeError, e: pass
+ time.sleep(1.0/($poll_rate))
+_$(id)_thread = threading.Thread(target=_$(id)_probe)
+_$(id)_thread.daemon = True
+_$(id)_thread.start()</make>
+ <callback>self.set_$(id)($value)</callback>
+ <param>
+ <name>Value</name>
+ <key>value</key>
+ <value>0</value>
+ <type>raw</type>
+ </param>
+ <param>
+ <name>Block ID</name>
+ <key>block_id</key>
+ <value>my_block_0</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Function Name</name>
+ <key>function_name</key>
+ <value>get_number</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Function Args</name>
+ <key>function_args</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $function_args() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Poll Rate (Hz)</name>
+ <key>poll_rate</key>
+ <value>10</value>
+ <type>real</type>
+ </param>
+ <doc>
+Periodically probe a function and set its value to this variable.
+
+Set the values for block ID, function name, and function args appropriately: \
+Block ID should be the ID of another block in this flow graph. \
+Function name should be the name of a class method on that block. \
+Function args are the parameters passed into that function. \
+For a function with no arguments, leave function args blank. \
+When passing a string for the function arguments, quote the string literal: '"arg"'.
+
+The values will used literally, and generated into the following form:
+self.block_id.function_name(function_args)
+
+To poll a stream for a level, use this with the probe signal block.
+ </doc>
+</block>
diff --git a/grc/grc_gnuradio/Makefile.am b/grc/grc_gnuradio/Makefile.am
index 9187a01e0..af1d86be9 100644
--- a/grc/grc_gnuradio/Makefile.am
+++ b/grc/grc_gnuradio/Makefile.am
@@ -31,13 +31,5 @@ blks2_python_PYTHON = \
blks2/__init__.py \
blks2/error_rate.py \
blks2/packet.py \
- blks2/probe.py \
blks2/selector.py \
- blks2/tcp.py \
- blks2/variable_sink.py
-
-wxgui_pythondir = $(grc_gnuradio_prefix)/wxgui
-wxgui_python_PYTHON = \
- wxgui/__init__.py \
- wxgui/panel.py \
- wxgui/top_block_gui.py
+ blks2/tcp.py
diff --git a/grc/grc_gnuradio/blks2/__init__.py b/grc/grc_gnuradio/blks2/__init__.py
index cb1196f25..fde76f256 100644
--- a/grc/grc_gnuradio/blks2/__init__.py
+++ b/grc/grc_gnuradio/blks2/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2008, 2009 Free Software Foundation, Inc.
+# Copyright 2008-2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,6 +23,4 @@ from packet import options, packet_encoder, packet_decoder, \
packet_mod_b, packet_mod_s, packet_mod_i, packet_mod_f, packet_mod_c, \
packet_demod_b, packet_demod_s, packet_demod_i, packet_demod_f, packet_demod_c
from error_rate import error_rate
-from probe import probe_function, probe_avg_mag_sqrd_c, probe_avg_mag_sqrd_f, probe_density_b, probe_mpsk_snr_c
-from variable_sink import variable_sink_b, variable_sink_s, variable_sink_i, variable_sink_f, variable_sink_c
from tcp import tcp_source, tcp_sink
diff --git a/grc/grc_gnuradio/blks2/probe.py b/grc/grc_gnuradio/blks2/probe.py
deleted file mode 100644
index 8db81f057..000000000
--- a/grc/grc_gnuradio/blks2/probe.py
+++ /dev/null
@@ -1,123 +0,0 @@
-#
-# Copyright 2008 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-
-from gnuradio import gr
-import threading
-import numpy
-import time
-
-#######################################################################################
-## Probe: Function
-#######################################################################################
-class probe_function(gr.hier_block2, threading.Thread):
- """
- The thread polls the function for values and writes to a message source.
- """
-
- def __init__(self, probe_callback, probe_rate):
- #init hier block
- gr.hier_block2.__init__(
- self, 'probe_function',
- gr.io_signature(0, 0, 0),
- gr.io_signature(1, 1, gr.sizeof_float),
- )
- self._probe_callback = probe_callback
- self.set_probe_rate(probe_rate)
- #create message source
- message_source = gr.message_source(gr.sizeof_float, 1)
- self._msgq = message_source.msgq()
- #connect
- self.connect(message_source, self)
- #setup thread
- threading.Thread.__init__(self)
- self.setDaemon(True)
- self.start()
-
- def run(self):
- """
- Infinite polling loop.
- """
- while True:
- time.sleep(1.0/self._probe_rate)
- arr = numpy.array(self._probe_callback(), numpy.float32)
- msg = gr.message_from_string(arr.tostring(), 0, gr.sizeof_float, 1)
- self._msgq.insert_tail(msg)
-
- def set_probe_rate(self, probe_rate):
- self._probe_rate = probe_rate
-
-class _probe_base(gr.hier_block2):
- def __init__(self, probe_block, probe_callback, probe_rate):
- #init hier block
- gr.hier_block2.__init__(
- self, 'probe',
- gr.io_signature(1, 1, probe_block.input_signature().sizeof_stream_items()[0]),
- gr.io_signature(1, 1, gr.sizeof_float),
- )
- probe_function_block = probe_function(probe_callback, probe_rate)
- #forward callbacks
- self.set_probe_rate = probe_function_block.set_probe_rate
- #connect
- self.connect(self, probe_block)
- self.connect(probe_function_block, self)
-
-#######################################################################################
-## Probe: Average Magnitude Squared
-#######################################################################################
-class _probe_avg_mag_sqrd_base(_probe_base):
- def __init__(self, threshold, alpha, probe_rate):
- #create block
- probe_block = self._probe_block_contructor[0](threshold, alpha)
- #forward callbacks
- self.set_alpha = probe_block.set_alpha
- self.set_threshold = probe_block.set_threshold
- #init
- _probe_base.__init__(self, probe_block, probe_block.level, probe_rate)
-
-class probe_avg_mag_sqrd_c(_probe_avg_mag_sqrd_base): _probe_block_contructor = (gr.probe_avg_mag_sqrd_c,)
-class probe_avg_mag_sqrd_f(_probe_avg_mag_sqrd_base): _probe_block_contructor = (gr.probe_avg_mag_sqrd_f,)
-
-#######################################################################################
-## Probe: Density
-#######################################################################################
-class probe_density_b(_probe_base):
- def __init__(self, alpha, probe_rate):
- #create block
- probe_block = gr.probe_density_b(alpha)
- #forward callbacks
- self.set_alpha = probe_block.set_alpha
- #init
- _probe_base.__init__(self, probe_block, probe_block.density, probe_rate)
-
-#######################################################################################
-## Probe: MPSK SNR
-#######################################################################################
-class probe_mpsk_snr_c(_probe_base):
- def __init__(self, type, alpha, probe_rate):
- """
- Type can be "snr", "signal_mean", or "noise_variance"
- """
- #create block
- probe_block = gr.probe_mpsk_snr_c(alpha)
- #forward callbacks
- self.set_alpha = probe_block.set_alpha
- #init
- _probe_base.__init__(self, probe_block, getattr(probe_block, type), probe_rate)
diff --git a/grc/grc_gnuradio/blks2/variable_sink.py b/grc/grc_gnuradio/blks2/variable_sink.py
deleted file mode 100644
index cad3b8b04..000000000
--- a/grc/grc_gnuradio/blks2/variable_sink.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# Copyright 2009 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-
-from gnuradio import gr
-import threading
-import numpy
-
-class _variable_sink_base(gr.hier_block2, threading.Thread):
- """
- The thread polls the message queue for values and writes to a callback.
- """
-
- def __init__(self, vlen, decim, callback):
- self._vlen = vlen
- self._callback = callback
- self._item_size = self._size*self._vlen
- #init hier block
- gr.hier_block2.__init__(
- self, 'variable_sink',
- gr.io_signature(1, 1, self._item_size),
- gr.io_signature(0, 0, 0),
- )
- #create blocks
- self._decimator = gr.keep_one_in_n(self._item_size, decim)
- self._msgq = gr.msg_queue(2)
- message_sink = gr.message_sink(self._item_size, self._msgq, False)
- #connect
- self.connect(self, self._decimator, message_sink)
- #setup thread
- threading.Thread.__init__(self)
- self.setDaemon(True)
- self.start()
-
- def set_decim(self, decim): self._decimator.set_n(decim)
-
- def run(self):
- while True: #truncate to item size, convert to array, callback
- msg = self._msgq.delete_head().to_string()[-self._item_size:]
- arr = map(self._cast, numpy.fromstring(msg, self._numpy))
- self._callback(self._vlen > 1 and arr or arr[0])
-
-class variable_sink_b(_variable_sink_base): _numpy, _size, _cast = numpy.int8, gr.sizeof_char, int
-class variable_sink_s(_variable_sink_base): _numpy, _size, _cast = numpy.int16, gr.sizeof_short, int
-class variable_sink_i(_variable_sink_base): _numpy, _size, _cast = numpy.int32, gr.sizeof_int, int
-class variable_sink_f(_variable_sink_base): _numpy, _size, _cast = numpy.float32, gr.sizeof_float, float
-class variable_sink_c(_variable_sink_base): _numpy, _size, _cast = numpy.complex64, gr.sizeof_gr_complex, complex
diff --git a/grc/python/Generator.py b/grc/python/Generator.py
index d53802bef..b669fa65a 100644
--- a/grc/python/Generator.py
+++ b/grc/python/Generator.py
@@ -1,5 +1,5 @@
"""
-Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2008-2011 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion is free software; you can redistribute it and/or
@@ -90,18 +90,20 @@ Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''')
imports = self._flow_graph.get_imports()
variables = self._flow_graph.get_variables()
parameters = self._flow_graph.get_parameters()
- #list of variables with controls
- controls = filter(lambda v: v.get_make(), variables)
#list of blocks not including variables and imports and parameters and disabled
- blocks = sorted(self._flow_graph.get_enabled_blocks(), lambda x, y: cmp(x.get_id(), y.get_id()))
- probes = filter(lambda b: b.get_key().startswith('probe_'), blocks) #ensure probes are last in the block list
- #get a list of notebooks and sort them according dependencies
- notebooks = expr_utils.sort_objects(
- filter(lambda b: b.get_key() == 'notebook', blocks),
- lambda n: n.get_id(), lambda n: n.get_param('notebook').get_value(),
+ def _get_block_sort_text(block):
+ code = block.get_make().replace(block.get_id(), ' ')
+ try: code += block.get_param('notebook').get_value() #older gui markup w/ wxgui
+ except: pass
+ try: code += block.get_param('gui_hint').get_value() #newer gui markup w/ qtgui
+ except: pass
+ return code
+ blocks = expr_utils.sort_objects(
+ self._flow_graph.get_enabled_blocks(),
+ lambda b: b.get_id(), _get_block_sort_text
)
#list of regular blocks (all blocks minus the special ones)
- blocks = filter(lambda b: b not in (imports + parameters + variables + probes + notebooks), blocks) + probes
+ blocks = filter(lambda b: b not in (imports + parameters), blocks)
#list of connections where each endpoint is enabled
connections = filter(lambda c: not c.is_msg(), self._flow_graph.get_enabled_connections())
messages = filter(lambda c: c.is_msg(), self._flow_graph.get_enabled_connections())
@@ -125,8 +127,6 @@ Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''')
'imports': imports,
'flow_graph': self._flow_graph,
'variables': variables,
- 'notebooks': notebooks,
- 'controls': controls,
'parameters': parameters,
'blocks': blocks,
'connections': connections,
diff --git a/grc/python/Param.py b/grc/python/Param.py
index 6dd008d1d..303ab3ed8 100644
--- a/grc/python/Param.py
+++ b/grc/python/Param.py
@@ -1,5 +1,5 @@
"""
-Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2008-2011 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion is free software; you can redistribute it and/or
@@ -99,7 +99,7 @@ class Param(_Param, _GUIParam):
'hex', 'string', 'bool',
'file_open', 'file_save',
'id', 'stream_id',
- 'grid_pos', 'notebook',
+ 'grid_pos', 'notebook', 'gui_hint',
'import',
)
@@ -354,6 +354,29 @@ class Param(_Param, _GUIParam):
except: raise Exception, 'Stream ID "%s" is not found.'%v
return v
#########################
+ # GUI Position/Hint
+ #########################
+ elif t == 'gui_hint':
+ if ':' in v: tab, pos = v.split(':')
+ elif '@' in v: tab, pos = v, ''
+ else: tab, pos = '', v
+
+ if '@' in tab: tab, index = tab.split('@')
+ else: index = '?'
+
+ widget_str = ({
+ (True, True): 'self.%(tab)s_grid_layout_%(index)s.addWidget(%(widget)s, %(pos)s)',
+ (True, False): 'self.%(tab)s_layout_%(index)s.addWidget(%(widget)s)',
+ (False, True): 'self.top_grid_layout.addWidget(%(widget)s, %(pos)s)',
+ (False, False): 'self.top_layout.addWidget(%(widget)s)',
+ }[bool(tab), bool(pos)])%{'tab': tab, 'index': index, 'widget': '%s', 'pos': pos}
+
+ def gui_hint(ws, w):
+ if 'layout' in w: ws = ws.replace('addWidget', 'addLayout')
+ return ws%w
+
+ return lambda w: gui_hint(widget_str, w)
+ #########################
# Grid Position Type
#########################
elif t == 'grid_pos':
diff --git a/grc/python/Platform.py b/grc/python/Platform.py
index 04db0b9b0..ec3f94096 100644
--- a/grc/python/Platform.py
+++ b/grc/python/Platform.py
@@ -1,5 +1,5 @@
"""
-Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion is free software; you can redistribute it and/or
diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl
index a1a9308aa..5aaa99793 100644
--- a/grc/python/flow_graph.tmpl
+++ b/grc/python/flow_graph.tmpl
@@ -5,8 +5,6 @@
##@param imports the import statements
##@param flow_graph the flow_graph
##@param variables the variable blocks
-##@param notebooks a list of notebook blocks
-##@param controls the variables with gui controls
##@param parameters the paramater blocks
##@param blocks the signal blocks
##@param connections the connections
@@ -59,6 +57,17 @@ class $(class_name)(grc_wxgui.top_block_gui):
_icon_path = "$icon.get_filename()"
self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))
#end if
+#elif $generate_options == 'qt_gui'
+class $(class_name)(gr.top_block, Qt.QWidget):
+
+ def __init__($param_str):
+ gr.top_block.__init__(self, "$title")
+ Qt.QWidget.__init__(self)
+ self.setWindowTitle("$title")
+ self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
+ self.top_layout = Qt.QVBoxLayout(self)
+ self.top_grid_layout = Qt.QGridLayout()
+ self.top_layout.addLayout(self.top_grid_layout)
#elif $generate_options == 'no_gui'
class $(class_name)(gr.top_block):
@@ -112,30 +121,6 @@ gr.io_signaturev($(len($io_sigs)), $(len($io_sigs)), [$(', '.join($size_strs))])
$indent($var.get_var_make())
#end for
########################################################
-##Create Notebooks
-########################################################
-#if $notebooks
-
- $DIVIDER
- # Notebooks
- $DIVIDER
-#end if
-#for $notebook in $notebooks
- $indent($notebook.get_make())
-#end for
-########################################################
-##Create Controls
-########################################################
-#if $controls
-
- $DIVIDER
- # Controls
- $DIVIDER
-#end if
-#for $ctrl in $controls
- $indent($ctrl.get_make())
-#end for
-########################################################
##Create Message Queues
########################################################
#if $messages
@@ -157,7 +142,11 @@ gr.io_signaturev($(len($io_sigs)), $(len($io_sigs)), [$(', '.join($size_strs))])
$DIVIDER
#end if
#for $blk in filter(lambda b: b.get_make(), $blocks)
+ #if $blk in $variables
+ $indent($blk.get_make())
+ #else
self.$blk.get_id() = $indent($blk.get_make())
+ #end if
#end for
########################################################
##Create Connections
@@ -196,6 +185,9 @@ self.$port.get_parent().get_id()#slurp
########################################################
#for $var in $parameters + $variables
#set $id = $var.get_id()
+ def get_$(id)(self):
+ return self.$id
+
def set_$(id)(self, $id):
self.$id = $id
#for $callback in $var_id2cbs[$id]
@@ -239,12 +231,21 @@ if __name__ == '__main__':
if gr.enable_realtime_scheduling() != gr.RT_OK:
print "Error: failed to enable realtime scheduling."
#end if
- tb = $(class_name)($(', '.join($params_eq_list)))
#if $generate_options == 'wx_gui'
+ tb = $(class_name)($(', '.join($params_eq_list)))
tb.Run($flow_graph.get_option('run'))
+ #elif $generate_options == 'qt_gui'
+ qapp = Qt.QApplication(sys.argv)
+ tb = $(class_name)($(', '.join($params_eq_list)))
+ #if $flow_graph.get_option('run')
+ tb.start()
+ #end if
+ tb.show()
+ qapp.exec_()
#elif $generate_options == 'no_gui'
#set $run_options = $flow_graph.get_option('run_options')
#if $run_options == 'prompt'
+ tb = $(class_name)($(', '.join($params_eq_list)))
tb.start()
raw_input('Press Enter to quit: ')
tb.stop()