summaryrefslogtreecommitdiff
path: root/grc
diff options
context:
space:
mode:
authorJosh Blum2011-02-27 23:18:11 -0800
committerJosh Blum2011-03-01 17:02:06 -0800
commit47f621a14c9a6e3696155dd5a223da40bcb7721c (patch)
tree03ff5e5875416340e3dcef010f176f9872b365d2 /grc
parentf0537a7da4571bd6aaab273a0588eaef04121648 (diff)
downloadgnuradio-47f621a14c9a6e3696155dd5a223da40bcb7721c.tar.gz
gnuradio-47f621a14c9a6e3696155dd5a223da40bcb7721c.tar.bz2
gnuradio-47f621a14c9a6e3696155dd5a223da40bcb7721c.zip
grc: work on generator for gui flowgraphs to simplify generation
generator does not differentiate between notebooks and controls, they are all block, but block are now sorted by variables present in the make also adjusted categories listed in the wx and qt widget related blocks
Diffstat (limited to 'grc')
-rw-r--r--grc/blocks/Makefile.am3
-rw-r--r--grc/blocks/block_tree.xml17
-rw-r--r--grc/blocks/notebook.xml69
-rw-r--r--grc/python/Generator.py28
-rw-r--r--grc/python/Param.py2
-rw-r--r--grc/python/flow_graph.tmpl30
6 files changed, 20 insertions, 129 deletions
diff --git a/grc/blocks/Makefile.am b/grc/blocks/Makefile.am
index 40353a1fa..d9ec0896e 100644
--- a/grc/blocks/Makefile.am
+++ b/grc/blocks/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2008-2010 Free Software Foundation, Inc.
+# Copyright 2008-2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -197,7 +197,6 @@ dist_ourdata_DATA = \
import.xml \
low_pass_filter.xml \
note.xml \
- notebook.xml \
options.xml \
pad_sink.xml \
pad_source.xml \
diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml
index 782d6ca9b..50c463f55 100644
--- a/grc/blocks/block_tree.xml
+++ b/grc/blocks/block_tree.xml
@@ -39,17 +39,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>
- <block>qtgui_sink_x</block>
- </cat>
- <cat>
<name>Operators</name>
<block>gr_add_xx</block>
<block>gr_sub_xx</block>
@@ -139,7 +128,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>
@@ -263,7 +252,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>
@@ -311,7 +300,5 @@
<block>xmlrpc_server</block>
<block>xmlrpc_client</block>
-
- <block>notebook</block>
</cat>
</cat>
diff --git a/grc/blocks/notebook.xml b/grc/blocks/notebook.xml
deleted file mode 100644
index d41db9e2d..000000000
--- a/grc/blocks/notebook.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##WX GUI Notebook
-###################################################
- -->
-<block>
- <name>Notebook</name>
- <key>notebook</key>
- <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)
-#for $label in $labels()
-self.$(id).AddPage(grc_wxgui.Panel(self.$(id)), "$label")
-#end for
-#if not $grid_pos()
-$(parent).Add(self.$(id))
-#else
-$(parent).GridAdd(self.$(id), $(', '.join(map(str, $grid_pos()))))
-#end if</make>
- <param>
- <name>Tab Orientation</name>
- <key>style</key>
- <value>wx.NB_TOP</value>
- <type>enum</type>
- <option>
- <name>Top</name>
- <key>wx.NB_TOP</key>
- </option>
- <option>
- <name>Right</name>
- <key>wx.NB_RIGHT</key>
- </option>
- <option>
- <name>Bottom</name>
- <key>wx.NB_BOTTOM</key>
- </option>
- <option>
- <name>Left</name>
- <key>wx.NB_LEFT</key>
- </option>
- </param>
- <param>
- <name>Labels</name>
- <key>labels</key>
- <value>['tab1', 'tab2', 'tab3']</value>
- <type>raw</type>
- </param>
- <param>
- <name>Grid Position</name>
- <key>grid_pos</key>
- <value></value>
- <type>grid_pos</type>
- </param>
- <param>
- <name>Notebook</name>
- <key>notebook</key>
- <value></value>
- <type>notebook</type>
- </param>
- <check>isinstance($labels, (list, tuple))</check>
- <check>all(map(lambda x: isinstance(x, str), $labels))</check>
- <check>len($labels) &gt; 0</check>
- <doc>
-Use the Grid Position (row, column, row span, column span) to position the graphical element in the window.
-
-Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page.
- </doc>
-</block>
diff --git a/grc/python/Generator.py b/grc/python/Generator.py
index 7d08b914b..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,22 +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(),
- )
- notebooks += expr_utils.sort_objects(
- filter(lambda b: b.get_key() == 'qtgui_tab_widget', blocks),
- lambda n: n.get_id(), lambda n: n.get_param('gui_hint').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())
@@ -129,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 27258faab..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
diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl
index 88049a9ef..8757b5204 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
@@ -121,30 +119,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
@@ -166,7 +140,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