commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r11234 - in gnuradio/branches/developers/jblum/grc/grc


From: jblum
Subject: [Commit-gnuradio] r11234 - in gnuradio/branches/developers/jblum/grc/grc: blocks grc_gnuradio/wxgui python
Date: Thu, 18 Jun 2009 16:34:58 -0600 (MDT)

Author: jblum
Date: 2009-06-18 16:34:58 -0600 (Thu, 18 Jun 2009)
New Revision: 11234

Modified:
   gnuradio/branches/developers/jblum/grc/grc/blocks/options.xml
   
gnuradio/branches/developers/jblum/grc/grc/grc_gnuradio/wxgui/top_block_gui.py
   gnuradio/branches/developers/jblum/grc/grc/python/Param.py
   gnuradio/branches/developers/jblum/grc/grc/python/flow_graph.tmpl
Log:
Added gr.topblock methods to id blacklist.

Added param w/ callback to change the start/stop status of the flowgraph.
1) Ability to start the gui app without the flow graph running.
2) Ability to start/stop the flowgraph at runtime.



Modified: gnuradio/branches/developers/jblum/grc/grc/blocks/options.xml
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/blocks/options.xml       
2009-06-18 21:33:07 UTC (rev 11233)
+++ gnuradio/branches/developers/jblum/grc/grc/blocks/options.xml       
2009-06-18 22:34:58 UTC (rev 11234)
@@ -20,6 +20,7 @@
 #end if
 </import>
        <make></make>
+       <callback>self.start($autostart)</callback>
        <param>
                <name>Title</name>
                <key>title</key>
@@ -71,6 +72,29 @@
                <hide>#if $generate_options() == 'hb' then 'none' else 
'all'#</hide>
        </param>
        <param>
+               <name>Autostart</name>
+               <key>autostart</key>
+               <value>True</value>
+               <type>bool</type>
+               <hide>#if $generate_options() == 'wx_gui'
+       #if str($autostart) == 'True'
+part#slurp
+       #else
+none#slurp
+       #end if
+#else
+all#slurp
+#end if</hide>
+               <option>
+                       <name>Yes</name>
+                       <key>True</key>
+               </option>
+               <option>
+                       <name>No</name>
+                       <key>False</key>
+               </option>
+       </param>
+       <param>
                <name>Realtime Scheduling</name>
                <key>realtime_scheduling</key>
                <value></value>
@@ -106,6 +130,9 @@
 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.
+
 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....
 

Modified: 
gnuradio/branches/developers/jblum/grc/grc/grc_gnuradio/wxgui/top_block_gui.py
===================================================================
--- 
gnuradio/branches/developers/jblum/grc/grc/grc_gnuradio/wxgui/top_block_gui.py  
    2009-06-18 21:33:07 UTC (rev 11233)
+++ 
gnuradio/branches/developers/jblum/grc/grc/grc_gnuradio/wxgui/top_block_gui.py  
    2009-06-18 22:34:58 UTC (rev 11234)
@@ -72,7 +72,14 @@
                """
                self._wx_grid.Add(win, wx.GBPosition(row, col), 
wx.GBSpan(row_span, col_span), wx.EXPAND)
 
-       def Run(self):
+       def start(self, start=True):
+               if start:
+                       gr.top_block.start(self)
+               else:
+                       gr.top_block.stop(self)
+                       gr.top_block.wait(self)
+
+       def Run(self, autostart=True):
                """
                Setup the wx gui elements.
                Start the gr top block.
@@ -93,6 +100,6 @@
                self._wx_frame.Show()
                self._wx_app.SetTopWindow(self._wx_frame)
                #start flow graph
-               gr.top_block.start(self)
+               self.start(autostart)
                #blocking main loop
                self._wx_app.MainLoop()

Modified: gnuradio/branches/developers/jblum/grc/grc/python/Param.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/python/Param.py  2009-06-18 
21:33:07 UTC (rev 11233)
+++ gnuradio/branches/developers/jblum/grc/grc/python/Param.py  2009-06-18 
22:34:58 UTC (rev 11234)
@@ -27,6 +27,7 @@
 import gtk
 from gnuradio import eng_notation
 import re
+from gnuradio import gr
 
 _show_id_matcher = re.compile('^(variable\w*|parameter|options)$')
 
@@ -68,7 +69,8 @@
 
 #blacklist certain ids, its not complete, but should help
 import __builtin__
-ID_BLACKLIST = ['options', 'gr', 'blks2', 'wxgui', 'wx', 'math', 'forms', 
'firdes'] + dir(__builtin__)
+ID_BLACKLIST = ['options', 'gr', 'blks2', 'wxgui', 'wx', 'math', 'forms', 
'firdes'] + \
+       filter(lambda x: not x.startswith('_'), dir(gr.top_block())) + 
dir(__builtin__)
 #define types, native python + numpy
 VECTOR_TYPES = (tuple, list, set, numpy.ndarray)
 COMPLEX_TYPES = [complex, numpy.complex, numpy.complex64, numpy.complex128]

Modified: gnuradio/branches/developers/jblum/grc/grc/python/flow_graph.tmpl
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/python/flow_graph.tmpl   
2009-06-18 21:33:07 UTC (rev 11233)
+++ gnuradio/branches/developers/jblum/grc/grc/python/flow_graph.tmpl   
2009-06-18 22:34:58 UTC (rev 11234)
@@ -197,7 +197,7 @@
        #end if
        tb = $(class_name)(options)
        #if $generate_options == 'wx_gui'
-       tb.Run()
+       tb.Run($flow_graph.get_option('autostart'))
        #elif $generate_options == 'no_gui'
        tb.start()
        raw_input('Press Enter to quit: ')





reply via email to

[Prev in Thread] Current Thread [Next in Thread]