Merged r11309:11357 from grc branch.
authorjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Mon, 6 Jul 2009 02:28:52 +0000 (02:28 +0000)
committerjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Mon, 6 Jul 2009 02:28:52 +0000 (02:28 +0000)
Adds notebook cabability to grc and its wxgui windows/controls.

git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11358 221aa14e-8319-0410-a670-987f0aec2ac5

30 files changed:
gr-wxgui/src/python/plotter/plotter_base.py
gr-wxgui/src/python/waterfallsink_gl.py
grc/base/Platform.py
grc/blocks/Makefile.am
grc/blocks/block_tree.xml
grc/blocks/notebook.xml [new file with mode: 0644]
grc/blocks/options.xml
grc/blocks/variable_check_box.xml
grc/blocks/variable_chooser.xml
grc/blocks/variable_slider.xml
grc/blocks/variable_static_text.xml
grc/blocks/variable_text_box.xml
grc/blocks/wxgui_constellationsink2.xml
grc/blocks/wxgui_fftsink2.xml
grc/blocks/wxgui_histosink2.xml
grc/blocks/wxgui_numbersink2.xml
grc/blocks/wxgui_scopesink2.xml
grc/blocks/wxgui_waterfallsink2.xml
grc/grc_gnuradio/Makefile.am
grc/grc_gnuradio/wxgui/__init__.py
grc/grc_gnuradio/wxgui/panel.py [new file with mode: 0644]
grc/grc_gnuradio/wxgui/top_block_gui.py
grc/gui/Param.py
grc/python/Block.py
grc/python/FlowGraph.py
grc/python/Generator.py
grc/python/Param.py
grc/python/expr_utils.py
grc/python/flow_graph.tmpl
grc/todo.txt

index 662365a37fd4c35c1f560625a48318ad2deb5b85..dede5a0ad51b8d5abbf231c02ef40634d66acd77 100644 (file)
@@ -168,4 +168,5 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex):
                """
                Force a paint event.
                """
+               if not self._gl_init_flag: return
                wx.PostEvent(self, wx.PaintEvent())
index 91c1c7eb5db2a90c3cbd1d16fd0e83985386be40..2d4c959f8a8f14baafb64409092c807513409ac4 100644 (file)
@@ -40,7 +40,6 @@ class _waterfall_sink_base(gr.hier_block2):
                self,
                parent,
                baseband_freq=0,
-               y_per_div=None, #ignore (old wrapper)
                ref_level=50,
                sample_rate=1,
                fft_size=512,
@@ -52,6 +51,7 @@ class _waterfall_sink_base(gr.hier_block2):
                ref_scale=2.0,
                dynamic_range=80,
                num_lines=256,
+               **kwargs #do not end with a comma
        ):
                #ensure avg alpha
                if avg_alpha is None: avg_alpha = 2.0/fft_rate
index 3050e5e475cde8e9bfe3fb2fb1d92544fc7118a3..02d6d2319257e969c1b8b4f151b02556698df6ab 100644 (file)
@@ -129,7 +129,9 @@ class Platform(_Element):
                                if block_key not in self.get_block_keys():
                                        print >> sys.stderr, 'Warning: Block key "%s" not found when loading category tree.'%(block_key)
                                        continue
-                               block_tree.add_block(parent, self.get_block(block_key))
+                               block = self.get_block(block_key)
+                               #if it exists, the block's category overrides the block tree
+                               if not block.get_category(): block_tree.add_block(parent, block)
                #load the block tree
                for block_tree_file in self._block_tree_files:
                        #recursivly add all blocks in the tree
index d6df9fca4383c14a0daca81f4b74a6f5c0be6a38..025c261f4fe420ca3cadddd8c5704591bce7e6ec 100644 (file)
@@ -185,6 +185,7 @@ dist_ourdata_DATA = \
        import.xml \
        low_pass_filter.xml \
        note.xml \
+       notebook.xml \
        options.xml \
        pad_sink.xml \
        pad_source.xml \
index 4f9b1cd2ec566ee14ecd9d122fae4f76d27a792c..9eda2fdcf80fa113638e63dcba8fc9d92c1bf627 100644 (file)
 
                <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
new file mode 100644 (file)
index 0000000..d41db9e
--- /dev/null
@@ -0,0 +1,69 @@
+<?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>
index 06ede76f07edc07ffdab0ed44a73d537d50c6237..18d6e2f0c99fc0818a5177950cc438672e6f55d0 100644 (file)
@@ -20,7 +20,8 @@ from gnuradio.eng_option import eng_option
 #end if
 </import>
        <make></make>
-       <callback>self.start($autostart)</callback>
+       <callback>if $run: self.start()
+else: self.stop(); self.wait()</callback>
        <param>
                <name>Title</name>
                <key>title</key>
@@ -76,12 +77,12 @@ from gnuradio.eng_option import eng_option
                <hide>#if $generate_options() == 'hb' then 'none' else 'all'#</hide>
        </param>
        <param>
-               <name>Autostart</name>
-               <key>autostart</key>
+               <name>Run</name>
+               <key>run</key>
                <value>True</value>
                <type>bool</type>
                <hide>#if $generate_options() == 'wx_gui'
-       #if str($autostart) == 'True'
+       #if str($run) == 'True'
 part#slurp
        #else
 none#slurp
@@ -90,11 +91,11 @@ none#slurp
 all#slurp
 #end if</hide>
                <option>
-                       <name>Yes</name>
+                       <name>Autostart</name>
                        <key>True</key>
                </option>
                <option>
-                       <name>No</name>
+                       <name>Off</name>
                        <key>False</key>
                </option>
        </param>
@@ -135,7 +136,7 @@ The generate options controls the type of code generated. \
 Non-graphical flow graphs should avoid using graphical sinks or graphical variable controls.
 
 In a graphical application, \
-autostart can be controlled by a variable to start and stop the flowgraph at runtime.
+run can be controlled by a variable to start and stop the flowgraph at runtime.
 
 The id of this block determines the name of the generated file and the name of the class. \
 For example, an id of my_block will generate the file my_block.py and class my_block(gr....
index 7054ca1eb253da18cd27ae06989a5c620ef00137..a703703c766ec018c3ad39534c5691d0fb35940b 100644 (file)
        <key>variable_check_box</key>
        <import>from gnuradio.wxgui import forms</import>
        <var_make>self.$(id) = $(id) = $value</var_make>
-       <make>self._$(id)_check_box = forms.check_box(
-       parent=self.GetWin(),
+       <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+#set $win = 'self._%s_check_box'%$id
+$win = forms.check_box(
+       parent=$(parent).GetWin(),
        value=self.$id,
        callback=self.set_$(id),
        #if $label()
        true=$true,
        false=$false,
 )
-#set $grid_pos = $grid_pos()
-#if not grid_pos
-self.Add(self._$(id)_check_box)
+#if not $grid_pos()
+$(parent).Add($win)
 #else
-self.GridAdd(self._$(id)_check_box, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3])
+$(parent).GridAdd($win, $(', '.join(map(str, $grid_pos()))))
 #end if</make>
        <callback>self.set_$(id)($value)</callback>
        <callback>self._$(id)_check_box.set_value($id)</callback>
@@ -61,6 +62,12 @@ self.GridAdd(self._$(id)_check_box, $grid_pos[0], $grid_pos[1], $grid_pos[2], $g
                <value></value>
                <type>grid_pos</type>
        </param>
+       <param>
+               <name>Notebook</name>
+               <key>notebook</key>
+               <value></value>
+               <type>notebook</type>
+       </param>
        <check>$value in ($true, $false)</check>
        <doc>
 This block creates a variable with a check box form. \
@@ -71,5 +78,7 @@ the default being True and False. \
 Override True and False to use alternative states.
 
 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>
index 2bf199872a56cb78e35a9203172a73e3ce86d174..ee41f26db98e750f20a613df20dd531fe1fcdbab 100644 (file)
        <key>variable_chooser</key>
        <import>from gnuradio.wxgui import forms</import>
        <var_make>self.$(id) = $(id) = $value</var_make>
-       <make>self._$(id)_chooser = forms.$(type)(
-       parent=self.GetWin(),
+       <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+#set $win = 'self._%s_chooser'%$id
+$win = forms.$(type)(
+       parent=$(parent).GetWin(),
        value=self.$id,
        callback=self.set_$(id),
        #if $label()
        style=$style,
 #end if
 )
-#set $grid_pos = $grid_pos()
-#if not grid_pos
-self.Add(self._$(id)_chooser)
+#if not $grid_pos()
+$(parent).Add($win)
 #else
-self.GridAdd(self._$(id)_chooser, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3])
+$(parent).GridAdd($win, $(', '.join(map(str, $grid_pos()))))
 #end if</make>
        <callback>self.set_$(id)($value)</callback>
        <callback>self._$(id)_chooser.set_value($id)</callback>
@@ -98,6 +99,12 @@ self.GridAdd(self._$(id)_chooser, $grid_pos[0], $grid_pos[1], $grid_pos[2], $gri
                <value></value>
                <type>grid_pos</type>
        </param>
+       <param>
+               <name>Notebook</name>
+               <key>notebook</key>
+               <value></value>
+               <type>notebook</type>
+       </param>
        <check>$value in $choices</check>
        <check>not $labels or len($labels) == len($choices)</check>
        <doc>
@@ -109,5 +116,7 @@ The choices must be a list of possible values. \
 Leave labels empty to use the choices as the labels.
 
 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>
index 875ae74afca2aff3fc9e977a12cb58db702f0c61..c13d208569f4dc3d50d96314f4298d895b834c24 100644 (file)
        <key>variable_slider</key>
        <import>from gnuradio.wxgui import forms</import>
        <var_make>self.$(id) = $(id) = $value</var_make>
-       <make>_$(id)_sizer = wx.BoxSizer(wx.VERTICAL)
+       <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+#set $win = '_%s_sizer'%$id
+$win = wx.BoxSizer(wx.VERTICAL)
 self._$(id)_text_box = forms.text_box(
-       parent=self.GetWin(),
-       sizer=_$(id)_sizer,
+       parent=$(parent).GetWin(),
+       sizer=$win,
        value=self.$id,
        callback=self.set_$(id),
        #if $label()
@@ -25,8 +27,8 @@ self._$(id)_text_box = forms.text_box(
        proportion=0,
 )
 self._$(id)_slider = forms.slider(
-       parent=self.GetWin(),
-       sizer=_$(id)_sizer,
+       parent=$(parent).GetWin(),
+       sizer=$win,
        value=self.$id,
        callback=self.set_$(id),
        minimum=$min,
@@ -36,11 +38,10 @@ self._$(id)_slider = forms.slider(
        cast=$(converver.slider_cast),
        proportion=1,
 )
-#set $grid_pos = $grid_pos()
-#if not grid_pos
-self.Add(_$(id)_sizer)
+#if not $grid_pos()
+$(parent).Add($win)
 #else
-self.GridAdd(_$(id)_sizer, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3])
+$(parent).GridAdd($win, $(', '.join(map(str, $grid_pos()))))
 #end if</make>
        <callback>self.set_$(id)($value)</callback>
        <callback>self._$(id)_slider.set_value($id)</callback>
@@ -114,6 +115,12 @@ self.GridAdd(_$(id)_sizer, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3
                <value></value>
                <type>grid_pos</type>
        </param>
+       <param>
+               <name>Notebook</name>
+               <key>notebook</key>
+               <value></value>
+               <type>notebook</type>
+       </param>
        <check>$min &lt;= $value &lt;= $max</check>
        <check>$min &lt; $max</check>
        <check>0 &lt; $num_steps &lt;= 1000</check>
@@ -125,5 +132,7 @@ The value must be between the minimum and the maximum. \
 The number of steps must be between 0 and 1000.
 
 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>
index 4be80a9bb8ca8efe86f2bc4b37e69f17a028d1bf..c866b998dcc966db095e5632896c594923cac1f1 100644 (file)
        <key>variable_static_text</key>
        <import>from gnuradio.wxgui import forms</import>
        <var_make>self.$(id) = $(id) = $value</var_make>
-       <make>self._$(id)_static_text = forms.static_text(
-       parent=self.GetWin(),
+       <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+#set $win = 'self._%s_static_text'%$id
+$win = forms.static_text(
+       parent=$(parent).GetWin(),
        value=self.$id,
        callback=self.set_$(id),
        #if $label()
        converter=forms.$(converver)(),
        #end if
 )
-#set $grid_pos = $grid_pos()
-#if not grid_pos
-self.Add(self._$(id)_static_text)
+#if not $grid_pos()
+$(parent).Add($win)
 #else
-self.GridAdd(self._$(id)_static_text, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3])
+$(parent).GridAdd($win, $(', '.join(map(str, $grid_pos()))))
 #end if</make>
        <callback>self.set_$(id)($value)</callback>
        <callback>self._$(id)_static_text.set_value($id)</callback>
@@ -77,6 +78,12 @@ self.GridAdd(self._$(id)_static_text, $grid_pos[0], $grid_pos[1], $grid_pos[2],
                <value></value>
                <type>grid_pos</type>
        </param>
+       <param>
+               <name>Notebook</name>
+               <key>notebook</key>
+               <value></value>
+               <type>notebook</type>
+       </param>
        <doc>
 This block creates a variable with a static text form. \
 Leave the label blank to use the variable id as the label.
@@ -84,5 +91,7 @@ Leave the label blank to use the variable id as the label.
 Format should be a function/lambda that converts a value into a string or None for the default formatter.
 
 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>
index 65d491ba0bebd346050bc496ddc757ab32787f36..1b4b4355e914a11a691d7e6a588b498067bd1452 100644 (file)
        <key>variable_text_box</key>
        <import>from gnuradio.wxgui import forms</import>
        <var_make>self.$(id) = $(id) = $value</var_make>
-       <make>self._$(id)_text_box = forms.text_box(
-       parent=self.GetWin(),
+       <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+#set $win = 'self._%s_text_box'%$id
+$win = forms.text_box(
+       parent=$(parent).GetWin(),
        value=self.$id,
        callback=self.set_$(id),
        #if $label()
        converter=forms.$(converver)(),
        #end if
 )
-#set $grid_pos = $grid_pos()
-#if not grid_pos
-self.Add(self._$(id)_text_box)
+#if not $grid_pos()
+$(parent).Add($win)
 #else
-self.GridAdd(self._$(id)_text_box, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3])
+$(parent).GridAdd($win, $(', '.join(map(str, $grid_pos()))))
 #end if</make>
        <callback>self.set_$(id)($value)</callback>
        <callback>self._$(id)_text_box.set_value($id)</callback>
@@ -81,6 +82,12 @@ self.GridAdd(self._$(id)_text_box, $grid_pos[0], $grid_pos[1], $grid_pos[2], $gr
                <value></value>
                <type>grid_pos</type>
        </param>
+       <param>
+               <name>Notebook</name>
+               <key>notebook</key>
+               <value></value>
+               <type>notebook</type>
+       </param>
        <doc>
 This block creates a variable with a text box. \
 Leave the label blank to use the variable id as the label.
@@ -88,5 +95,7 @@ Leave the label blank to use the variable id as the label.
 Format should be a function/lambda that converts a value into a string or None for the default formatter.
 
 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>
index 471c9f4a89470585062e18ed931e56902c2c3921..5969d8405322138bc227aeda083bb52c964bc976 100644 (file)
@@ -8,8 +8,9 @@
        <name>Constellation Sink</name>
        <key>wxgui_constellationsink2</key>
        <import>from gnuradio.wxgui import constsink_gl</import>
-       <make>constsink_gl.const_sink_c(
-       self.GetWin(),
+       <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+constsink_gl.const_sink_c(
+       $(parent).GetWin(),
        title=$title,
        sample_rate=$samp_rate,
        frame_rate=$frame_rate,
        symbol_rate=$symbol_rate,
        omega_limit=$omega_limit,
 )
-#set $grid_pos = $grid_pos()
-#if not grid_pos
-self.Add(self.$(id).win)
+#if not $grid_pos()
+$(parent).Add(self.$(id).win)
 #else
-self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3])
+$(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
 #end if</make>
        <callback>set_sample_rate($samp_rate)</callback>
        <param>
@@ -108,11 +108,19 @@ self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos
                <value></value>
                <type>grid_pos</type>
        </param>
+       <param>
+               <name>Notebook</name>
+               <key>notebook</key>
+               <value></value>
+               <type>notebook</type>
+       </param>
        <sink>
                <name>in</name>
                <type>complex</type>
        </sink>
        <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>
index d7763cb2504116ec2b897e51b6cd00223793ef21..faeca37e3217bea7f8db5860e29ad5117693c1c5 100644 (file)
@@ -8,8 +8,9 @@
        <name>FFT Sink</name>
        <key>wxgui_fftsink2</key>
        <import>from gnuradio.wxgui import fftsink2</import>
-       <make>fftsink2.$(type.fcn)(
-       self.GetWin(),
+       <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+fftsink2.$(type.fcn)(
+       $(parent).GetWin(),
        baseband_freq=$baseband_freq,
        y_per_div=$y_per_div,
        y_divs=$y_divs,
        title=$title,
        peak_hold=$peak_hold,
 )
-#set $grid_pos = $grid_pos()
-#if not grid_pos
-self.Add(self.$(id).win)
+#if not $grid_pos()
+$(parent).Add(self.$(id).win)
 #else
-self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3])
+$(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
 #end if</make>
        <callback>set_baseband_freq($baseband_freq)</callback>
        <callback>set_sample_rate($samp_rate)</callback>
@@ -157,6 +157,12 @@ self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos
                <value></value>
                <type>grid_pos</type>
        </param>
+       <param>
+               <name>Notebook</name>
+               <key>notebook</key>
+               <value></value>
+               <type>notebook</type>
+       </param>
        <sink>
                <name>in</name>
                <type>$type</type>
@@ -165,5 +171,7 @@ self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos
 Set Average Alpha to 0 for automatic setting.
 
 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>
index 4de57b1c4f47c010eae6b2d2d482de332d1695f7..454a4932cfab4aefbd5d00e93c674ec08537a492 100644 (file)
@@ -8,17 +8,17 @@
        <name>Histo Sink</name>
        <key>wxgui_histosink2</key>
        <import>from gnuradio.wxgui import histosink_gl</import>
-       <make>histosink_gl.histo_sink_f(
-       self.GetWin(),
+       <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+histosink_gl.histo_sink_f(
+       $(parent).GetWin(),
        title=$title,
        num_bins=$num_bins,
        frame_size=$frame_size,
 )
-#set $grid_pos = $grid_pos()
-#if not grid_pos
-self.Add(self.$(id).win)
+#if not $grid_pos()
+$(parent).Add(self.$(id).win)
 #else
-self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3])
+$(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
 #end if</make>
        <callback>set_num_bins($num_bins)</callback>
        <callback>set_frame_size($frame_size)</callback>
@@ -46,11 +46,19 @@ self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos
                <value></value>
                <type>grid_pos</type>
        </param>
+       <param>
+               <name>Notebook</name>
+               <key>notebook</key>
+               <value></value>
+               <type>notebook</type>
+       </param>
        <sink>
                <name>in</name>
                <type>float</type>
        </sink>
        <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>
index 7cc90b6970b9329ebf65828c8a68e5ad76ac5f8e..cc66cdcb088e75d2d7fc820e2cf3dddd8f3f3b2d 100644 (file)
@@ -8,8 +8,9 @@
        <name>Number Sink</name>
        <key>wxgui_numbersink2</key>
        <import>from gnuradio.wxgui import numbersink2</import>
-       <make>numbersink2.$(type.fcn)(
-       self.GetWin(),
+       <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+numbersink2.$(type.fcn)(
+       $(parent).GetWin(),
        unit=$units,
        minval=$min_value,
        maxval=$max_value,
        peak_hold=$peak_hold,
        show_gauge=$show_gauge,
 )
-#set $grid_pos = $grid_pos()
-#if not grid_pos
-self.Add(self.$(id).win)
+#if not $grid_pos()
+$(parent).Add(self.$(id).win)
 #else
-self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3])
+$(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
 #end if</make>
        <param>
                <name>Type</name>
@@ -157,6 +157,12 @@ self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos
                <value></value>
                <type>grid_pos</type>
        </param>
+       <param>
+               <name>Notebook</name>
+               <key>notebook</key>
+               <value></value>
+               <type>notebook</type>
+       </param>
        <sink>
                <name>in</name>
                <type>$type</type>
@@ -166,6 +172,8 @@ Set Average Alpha to 0 for automatic setting.
 
 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.
+
 Incoming numbers are multiplied by the factor, and then added-to by the reference level.
        </doc>
 </block>
index 78c39f80d8f80fb1511a08368e0d5fbcf6e05165..503d529727662578e219011abf2117c6c8e574aa 100644 (file)
@@ -9,8 +9,9 @@
        <key>wxgui_scopesink2</key>
        <import>from gnuradio.wxgui import scopesink2</import>
        <import>from gnuradio import gr</import>
-       <make>scopesink2.$(type.fcn)(
-       self.GetWin(),
+       <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+scopesink2.$(type.fcn)(
+       $(parent).GetWin(),
        title=$title,
        sample_rate=$samp_rate,
        v_scale=$v_scale,
        xy_mode=$xy_mode,
        num_inputs=$num_inputs,
 )
-#set $grid_pos = $grid_pos()
-#if not grid_pos
-self.Add(self.$(id).win)
+#if not $grid_pos()
+$(parent).Add(self.$(id).win)
 #else
-self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3])
+$(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
 #end if</make>
        <callback>set_sample_rate($samp_rate)</callback>
        <param>
@@ -108,6 +108,12 @@ self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos
                <value></value>
                <type>grid_pos</type>
        </param>
+       <param>
+               <name>Notebook</name>
+               <key>notebook</key>
+               <value></value>
+               <type>notebook</type>
+       </param>
        <check>not $xy_mode or '$type' == 'complex' or $num_inputs != 1</check>
        <sink>
                <name>in</name>
@@ -122,5 +128,7 @@ Set the T Scale to 0 for automatic setting.
 XY Mode allows the scope to initialize as an XY plotter.
 
 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>
index 6d76ee86751531307be765587ec66c6e992cf771..c7d53f9f2164752c0007f34519d86797f3ff94a8 100644 (file)
@@ -8,8 +8,9 @@
        <name>Waterfall Sink</name>
        <key>wxgui_waterfallsink2</key>
        <import>from gnuradio.wxgui import waterfallsink2</import>
-       <make>waterfallsink2.$(type.fcn)(
-       self.GetWin(),
+       <make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
+waterfallsink2.$(type.fcn)(
+       $(parent).GetWin(),
        baseband_freq=$baseband_freq,
        y_per_div=$y_per_div,
        ref_level=$ref_level,
        avg_alpha=#if $avg_alpha() then $avg_alpha else 'None'#,
        title=$title,
 )
-#set $grid_pos = $grid_pos()
-#if not grid_pos
-self.Add(self.$(id).win)
+#if not $grid_pos()
+$(parent).Add(self.$(id).win)
 #else
-self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3])
+$(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos()))))
 #end if</make>
        <callback>set_baseband_freq($baseband_freq)</callback>
        <callback>set_sample_rate($samp_rate)</callback>
@@ -114,6 +114,12 @@ self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos
                <value></value>
                <type>grid_pos</type>
        </param>
+       <param>
+               <name>Notebook</name>
+               <key>notebook</key>
+               <value></value>
+               <type>notebook</type>
+       </param>
        <sink>
                <name>in</name>
                <type>$type</type>
@@ -122,5 +128,7 @@ self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos
 Set Average Alpha to 0 for automatic setting.
 
 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>
index 9a15eb0ecead8bfbe178bb11059aa4997693e418..63bb72822dda62ef42f674f3ae32ea4dfb3cc05f 100644 (file)
@@ -23,11 +23,11 @@ include $(top_srcdir)/Makefile.common
 
 grc_gnuradio_prefix = $(pythondir)/grc_gnuradio
 
-rootpythondir = $(grc_gnuradio_prefix)
-rootpython_PYTHON = __init__.py
+root_pythondir = $(grc_gnuradio_prefix)
+root_python_PYTHON = __init__.py
 
-blks2pythondir = $(grc_gnuradio_prefix)/blks2
-blks2python_PYTHON = \
+blks2_pythondir = $(grc_gnuradio_prefix)/blks2
+blks2_python_PYTHON = \
        blks2/__init__.py \
        blks2/error_rate.py \
        blks2/packet.py \
@@ -36,14 +36,15 @@ blks2python_PYTHON = \
        blks2/tcp.py \
        blks2/variable_sink.py
 
-usrppythondir = $(grc_gnuradio_prefix)/usrp
-usrppython_PYTHON = \
+usrp_pythondir = $(grc_gnuradio_prefix)/usrp
+usrp_python_PYTHON = \
        usrp/__init__.py \
        usrp/common.py \
        usrp/dual_usrp.py \
        usrp/simple_usrp.py
 
-wxguipythondir = $(grc_gnuradio_prefix)/wxgui
-wxguipython_PYTHON = \
+wxgui_pythondir = $(grc_gnuradio_prefix)/wxgui
+wxgui_python_PYTHON = \
        wxgui/__init__.py \
+       wxgui/panel.py \
        wxgui/top_block_gui.py
index 94a0adb8a1a44a8a6a5e3e4854c7972682ee16ea..81427253b6a0285e8be92b6f4c34f3c79c3ac528 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2008 Free Software Foundation, Inc.
+# Copyright 2008, 2009 Free Software Foundation, Inc.
 #
 # This file is part of GNU Radio
 #
@@ -19,3 +19,4 @@
 #
 
 from top_block_gui import top_block_gui
+from panel import Panel
diff --git a/grc/grc_gnuradio/wxgui/panel.py b/grc/grc_gnuradio/wxgui/panel.py
new file mode 100644 (file)
index 0000000..e62133c
--- /dev/null
@@ -0,0 +1,49 @@
+# 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.
+#
+
+import wx
+
+class Panel(wx.Panel):
+       def __init__(self, parent, orient=wx.VERTICAL):
+               wx.Panel.__init__(self, parent)
+               self._box = wx.BoxSizer(orient)
+               self._grid = wx.GridBagSizer(5, 5)
+               self.Add(self._grid)
+               self.SetSizer(self._box)
+
+       def GetWin(self): return self
+
+       def Add(self, win):
+               """
+               Add a window to the wx vbox.
+               @param 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)
+               """
+               self._grid.Add(win, wx.GBPosition(row, col), wx.GBSpan(row_span, col_span), wx.EXPAND)
index 97bed04a572be936c23c4451b55865e0fb3de99e..998575897399c6d7db643dfb0a37d735c1644b45 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2008 Free Software Foundation, Inc.
+# Copyright 2008, 2009 Free Software Foundation, Inc.
 #
 # This file is part of GNU Radio
 #
 import wx
 import sys, os
 from gnuradio import gr
+import panel
 
 default_gui_size = (200, 100)
 
 class top_block_gui(gr.top_block):
        """gr top block with wx gui app and grid sizer."""
 
-       def __init__(self, title='', size=default_gui_size, icon=None):
+       def __init__(self, title='', size=default_gui_size):
                """
                Initialize the gr top block.
                Create the wx gui elements.
@@ -38,68 +39,37 @@ class top_block_gui(gr.top_block):
                #initialize
                gr.top_block.__init__(self)
                self._size = size
-               #set the icon
-               if icon and os.path.isfile(icon): self._icon = icon
-               else: self._icon = None
                #create gui elements
-               self._wx_app = wx.App()
-               self._wx_frame = wx.Frame(None , -1, title)
-               self._wx_grid = wx.GridBagSizer(5, 5)
-               self._wx_vbox = wx.BoxSizer(wx.VERTICAL)
+               self._app = wx.App()
+               self._frame = wx.Frame(None, title=title)
+               self._panel = panel.Panel(self._frame)
+               self.Add = self._panel.Add
+               self.GridAdd = self._panel.GridAdd
+               self.GetWin = self._panel.GetWin
 
-       def GetWin(self):
-               """
-               Get the window for wx elements to fit within.
-               @return the wx frame
-               """
-               return self._wx_frame
-
-       def Add(self, win):
-               """
-               Add a window to the wx vbox.
-               @param win the wx window
-               """
-               self._wx_vbox.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)
-               """
-               self._wx_grid.Add(win, wx.GBPosition(row, col), wx.GBSpan(row_span, col_span), wx.EXPAND)
-
-       def start(self, start=True):
-               if start:
-                       gr.top_block.start(self)
-               else:
-                       gr.top_block.stop(self)
-                       gr.top_block.wait(self)
+       def SetIcon(self, *args, **kwargs): self._frame.SetIcon(*args, **kwargs)
 
-       def Run(self, autostart=True):
+       def Run(self, start=True):
                """
                Setup the wx gui elements.
                Start the gr top block.
                Block with the wx main loop.
                """
-               #set wx app icon
-               if self._icon: self._wx_frame.SetIcon(wx.Icon(self._icon, wx.BITMAP_TYPE_ANY))
                #set minimal window size
-               self._wx_frame.SetSizeHints(*self._size)
+               self._frame.SetSizeHints(*self._size)
                #create callback for quit
                def _quit(event):
-                       gr.top_block.stop(self)
-                       self._wx_frame.Destroy()
+                       self.stop(); self.wait()
+                       self._frame.Destroy()
                #setup app
-               self._wx_vbox.Add(self._wx_grid, 0, wx.EXPAND)
-               self._wx_frame.Bind(wx.EVT_CLOSE, _quit)
-               self._wx_frame.SetSizerAndFit(self._wx_vbox)
-               self._wx_frame.Show()
-               self._wx_app.SetTopWindow(self._wx_frame)
+               self._frame.Bind(wx.EVT_CLOSE, _quit)
+               self._sizer = wx.BoxSizer(wx.VERTICAL)
+               self._sizer.Add(self._panel, 0, wx.EXPAND)
+               self._frame.SetSizerAndFit(self._sizer)
+               self._frame.SetAutoLayout(True)
+               self._frame.Show(True)
+               self._app.SetTopWindow(self._frame)
                #start flow graph
-               self.start(autostart)
+               if start: self.start()
                #blocking main loop
-               self._wx_app.MainLoop()
+               self._app.MainLoop()
index 3029569b467e077ae4b5221a4f74db60ebf0552b..a11fd906591c02870701c8599a2b090bec9f2bea 100644 (file)
@@ -25,8 +25,7 @@ import gtk
 
 PARAM_MARKUP_TMPL="""\
 #set $foreground = $param.is_valid() and 'black' or 'red'
-#set $value = not $param.is_valid() and 'error' or repr($param)
-<span foreground="$foreground" font_desc="Sans 7.5"><b>$encode($param.get_name()): </b>$encode($value)</span>"""
+<span foreground="$foreground" font_desc="Sans 7.5"><b>$encode($param.get_name()): </b>$encode(repr($param))</span>"""
 
 PARAM_LABEL_MARKUP_TMPL="""\
 #set $foreground = $param.is_valid() and 'black' or 'red'
index 6d75957779ade30a7c38b254acb8e8b60465f287..957fee18ef123aea408a7c5762c41a3121f22011 100644 (file)
@@ -130,7 +130,7 @@ class Block(_Block):
                return '\n'.join([doc, extract_docs.extract(self.get_key())]).strip('\n')
 
        def get_category(self):
-               #category = extract_category.extract(self.get_key())
+               category = extract_category.extract(self.get_key())
                #if category: return category
                return _Block.get_category(self)
 
@@ -154,6 +154,6 @@ class Block(_Block):
                """
                def make_callback(callback):
                        callback = self.resolve_dependencies(callback)
-                       if callback.startswith('self.'): return callback
+                       if 'self.' in callback: return callback
                        return 'self.%s.%s'%(self.get_id(), callback)
                return map(make_callback, self._callbacks)
index 47089a305e1b202542580b28ad775bf00be53fe1..8cad8be492216d46c86884750f0badfb9e6b83fa 100644 (file)
@@ -99,16 +99,7 @@ class FlowGraph(_FlowGraph):
                @return a sorted list of variable blocks in order of dependency (indep -> dep)
                """
                variables = filter(lambda b: _variable_matcher.match(b.get_key()), self.get_enabled_blocks())
-               #map var id to variable block
-               id2var = dict([(var.get_id(), var) for var in variables])
-               #map var id to variable code
-               #variable code is a concatenation of all param code (without the id param)
-               id2expr = dict([(var.get_id(), var.get_var_make()) for var in variables])
-               #sort according to dependency
-               sorted_ids = expr_utils.sort_variables(id2expr)
-               #create list of sorted variable blocks
-               variables = [id2var[id] for id in sorted_ids]
-               return variables
+               return expr_utils.sort_objects(variables, lambda v: v.get_id(), lambda v: v.get_var_make())
 
        def get_parameters(self):
                """
index cde7dc3d448a7692fe540fa099f5fbf69958a11b..33be4a72615e8c6a053e6a87f8de76dd8a75029f 100644 (file)
@@ -90,7 +90,13 @@ Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''')
                #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
-               blocks = filter(lambda b: b not in (imports + parameters + variables + probes), blocks) + probes
+               #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(),
+               )
+               #list of regular blocks (all blocks minus the special ones)
+               blocks = filter(lambda b: b not in (imports + parameters + variables + probes + notebooks), blocks) + probes
                #list of connections where each endpoint is enabled
                connections = self._flow_graph.get_enabled_connections()
                #list of variable names
@@ -113,6 +119,7 @@ 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,
index 8b5efc97f2e8ccf5a5901cf5b99ea3898cef963e..f971d0c3fb6330ca7b06d24f5863e777334d6399 100644 (file)
@@ -30,7 +30,7 @@ import re
 from gnuradio import gr
 
 _check_id_matcher = re.compile('^[a-z|A-Z]\w*$')
-_show_id_matcher = re.compile('^(variable\w*|parameter|options)$')
+_show_id_matcher = re.compile('^(variable\w*|parameter|options|notebook)$')
 
 class FileParam(EntryParam):
        """Provide an entry box for filename and a button to browse for a file."""
@@ -95,7 +95,8 @@ class Param(_Param):
                'hex', 'string', 'bool',
                'file_open', 'file_save',
                'id',
-               'grid_pos', 'import',
+               'grid_pos', 'notebook',
+               'import',
        ]
 
        def __repr__(self):
@@ -103,6 +104,7 @@ class Param(_Param):
                Get the repr (nice string format) for this param.
                @return the string representation
                """
+               if not self.is_valid(): return self.get_value()
                if self.get_value() in self.get_option_keys(): return self.get_option(self.get_value()).get_name()
                ##################################################
                # display logic for numbers
@@ -171,6 +173,7 @@ class Param(_Param):
                                'string': Constants.BYTE_VECTOR_COLOR_SPEC,
                                'id': Constants.ID_COLOR_SPEC,
                                'grid_pos': Constants.INT_VECTOR_COLOR_SPEC,
+                               'notebook': Constants.INT_VECTOR_COLOR_SPEC,
                                'raw': Constants.WILDCARD_COLOR_SPEC,
                        }[self.get_type()]
                except: return _Param.get_color(self)
@@ -201,7 +204,7 @@ class Param(_Param):
                                return 'part'
                        except: pass
                #hide empty grid positions
-               if self.get_key() == 'grid_pos' and not self.get_value(): return 'part'
+               if self.get_key() in ('grid_pos', 'notebook') and not self.get_value(): return 'part'
                return hide
 
        def validate(self):
@@ -331,17 +334,38 @@ class Param(_Param):
                        #check row span, col span
                        try: assert row_span > 0 and col_span > 0
                        except AssertionError: raise Exception, 'Row and column span must be greater than zero.'
+                       #get hostage cell parent
+                       try: my_parent = self.get_parent().get_param('notebook').evaluate()
+                       except: my_parent = ''
                        #calculate hostage cells
                        for r in range(row_span):
                                for c in range(col_span):
-                                       self._hostage_cells.append((row+r, col+c))
+                                       self._hostage_cells.append((my_parent, (row+r, col+c)))
                        #avoid collisions
                        params = filter(lambda p: p is not self, self.get_all_params('grid_pos'))
                        for param in params:
-                               for cell in param._hostage_cells:
-                                       if cell in self._hostage_cells: raise Exception, 'Another graphical element is using cell "%s".'%str(cell)
+                               for parent, cell in param._hostage_cells:
+                                       if (parent, cell) in self._hostage_cells:
+                                               raise Exception, 'Another graphical element is using parent "%s", cell "%s".'%(str(parent), str(cell))
                        return e
                #########################
+               # Notebook Page Type
+               #########################
+               elif t == 'notebook':
+                       if not v: return '' #allow for empty notebook
+                       #get a list of all notebooks
+                       notebook_blocks = filter(lambda b: b.get_key() == 'notebook', self.get_parent().get_parent().get_enabled_blocks())
+                       #check for notebook param syntax
+                       try: notebook_id, page_index = map(str.strip, v.split(','))
+                       except: raise Exception, 'Bad notebook page format.'
+                       #check that the notebook id is valid
+                       try: notebook_block = filter(lambda b: b.get_id() == notebook_id, notebook_blocks)[0]
+                       except: raise Exception, 'Notebook id "%s" is not an existing notebook id.'%notebook_id
+                       #check that page index exists
+                       try: assert int(page_index) in range(len(notebook_block.get_param('labels').get_evaluated()))
+                       except: raise Exception, 'Page index "%s" is not a valid index number.'%page_index
+                       return notebook_id, page_index
+               #########################
                # Import Type
                #########################
                elif t == 'import':
index 1bee2249704a6dc066bacc8cc2965ce6cdd61627..3c39f5d898792efd087aa32f665be2a92bcdd769 100644 (file)
@@ -133,5 +133,21 @@ def sort_variables(exprs):
                for var in indep_vars: var_graph.remove_node(var)
        return reversed(sorted_vars)
 
+def sort_objects(objects, get_id, get_expr):
+       """
+       Sort a list of objects according to their expressions.
+       @param objects the list of objects to sort
+       @param get_id the function to extract an id from the object
+       @param get_expr the function to extract an expression from the object
+       @return a list of sorted objects
+       """
+       id2obj = dict([(get_id(obj), obj) for obj in objects])
+       #map obj id to expression code
+       id2expr = dict([(get_id(obj), get_expr(obj)) for obj in objects])
+       #sort according to dependency
+       sorted_ids = sort_variables(id2expr)
+       #return list of sorted objects
+       return [id2obj[id] for id in sorted_ids]
+
 if __name__ == '__main__':
        for i in sort_variables({'x':'1', 'y':'x+1', 'a':'x+y', 'b':'y+1', 'c':'a+b+x+y'}): print i
index 742ceb94472ac1df29956372c6cc14627777b44b..a94e45e8edd3f8b266fa120ef7d6104e0ec0c17d 100644 (file)
@@ -5,6 +5,7 @@
 ##@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
@@ -52,13 +53,11 @@ $imp
 class $(class_name)(grc_wxgui.top_block_gui):
 
        def __init__($param_str):
-               grc_wxgui.top_block_gui.__init__(
-                       self,
-                       title="$title",
+               grc_wxgui.top_block_gui.__init__(self, title="$title")
        #if $icon
-                       icon="$icon.get_filename()",
+               _icon_path = "$icon.get_filename()"
+               self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))
        #end if
-               )
 #elif $generate_options == 'no_gui'
 class $(class_name)(gr.top_block):
 
@@ -71,8 +70,7 @@ class $(class_name)(gr.hier_block2):
 
        def __init__($param_str):
                gr.hier_block2.__init__(
-                       self,
-                       "$title",
+                       self, "$title",
                        gr.io_signature($in_sig.nports, $in_sig.nports, $in_sig.size*$in_sig.vlen),
                        gr.io_signature($out_sig.nports, $out_sig.nports, $out_sig.size*$out_sig.vlen),
                )
@@ -92,8 +90,6 @@ class $(class_name)(gr.hier_block2):
 #end for
 ########################################################
 ##Create Variables
-##     Set the variable to a property of self.
-##     Write the first line of the variable make.
 ########################################################
 #if $variables
 
@@ -105,9 +101,19 @@ class $(class_name)(gr.hier_block2):
                $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
-##     Write the variable make (excluding first line).
-##     Indent each line with 2 tabs.
 ########################################################
 #if $controls
 
@@ -120,7 +126,6 @@ class $(class_name)(gr.hier_block2):
 #end for
 ########################################################
 ##Create Blocks
-##     Write the block make, and indent with 2 tabs.
 ########################################################
 #if $blocks
 
@@ -161,7 +166,6 @@ class $(class_name)(gr.hier_block2):
 ########################################################
 ##Create Callbacks
 ##     Write a set method for this variable that calls the callbacks
-##     and sets the direct variable dependencies.
 ########################################################
 #for $var in $parameters + $variables
        #set $id = $var.get_id()
@@ -196,7 +200,7 @@ if __name__ == '__main__':
        #end if
        tb = $(class_name)($(', '.join($params_eq_list)))
        #if $generate_options == 'wx_gui'
-       tb.Run($flow_graph.get_option('autostart'))
+       tb.Run($flow_graph.get_option('run'))
        #elif $generate_options == 'no_gui'
        tb.start()
        raw_input('Press Enter to quit: ')
index 3f47a1bfcbc60b8ab9e0ef2ac4da533568767784..de43d3677c4ac4e5c4a44bef0fec9305addb6e77 100644 (file)
@@ -22,6 +22,8 @@
   * gr_ofdm_insert_preamble
   * gr_ofdm_mapper_bcv
   * gr_ofdm_sampler
+* size params for the graphical sinks
+* callbacks for set average on fft, waterfall, number sinks
 
 ##################################################
 # Features
@@ -40,8 +42,6 @@
 * configuration option for adding block paths
 * orientations for ports (top, right, bottom, left)
   * source defaults to right, sink defaults to left
-* grid params take a notebook argument
-  * add a wx notebook block
 * separation of variables and gui controls
 * speedup w/ background layer and animation layer
 * multiple doxygen directories (doc_dir becomes doc_path)
@@ -68,6 +68,7 @@
 * params dialog needs to dynamically update for all params
   * will not update for non-enum params
   * needs to account for added or removed params
+  * example with grid params need update after notebook change
 
 ##################################################
 # Future