commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r10282 - in gnuradio/trunk/grc: . data/platforms/pytho


From: jblum
Subject: [Commit-gnuradio] r10282 - in gnuradio/trunk/grc: . data/platforms/python data/platforms/python/blocks
Date: Wed, 21 Jan 2009 17:32:49 -0700 (MST)

Author: jblum
Date: 2009-01-21 17:32:48 -0700 (Wed, 21 Jan 2009)
New Revision: 10282

Modified:
   gnuradio/trunk/grc/data/platforms/python/blocks/parameter.xml
   gnuradio/trunk/grc/data/platforms/python/flow_graph.tmpl
   gnuradio/trunk/grc/todo.txt
Log:
cmd line options with param block

Modified: gnuradio/trunk/grc/data/platforms/python/blocks/parameter.xml
===================================================================
--- gnuradio/trunk/grc/data/platforms/python/blocks/parameter.xml       
2009-01-21 22:43:57 UTC (rev 10281)
+++ gnuradio/trunk/grc/data/platforms/python/blocks/parameter.xml       
2009-01-22 00:32:48 UTC (rev 10282)
@@ -7,6 +7,7 @@
 <block>
        <name>Parameter</name>
        <key>parameter</key>
+       <import>from optparse import OptionParser</import>
        <make>$value</make>
        <param>
                <name>Label</name>
@@ -18,8 +19,51 @@
                <name>Value</name>
                <key>value</key>
                <value>0</value>
-               <type>raw</type>
+               <type>$type.type</type>
        </param>
+       <param>
+               <name>Type</name>
+               <key>type</key>
+               <value></value>
+               <type>enum</type>
+               <hide>$type.hide</hide>
+               <option>
+                       <name>None</name>
+                       <key></key>
+                       <opt>type:raw</opt>
+                       <opt>hide:part</opt>
+               </option>
+               <option>
+                       <name>Complex</name>
+                       <key>complex</key>
+                       <opt>type:complex</opt>
+                       <opt>hide:none</opt>
+               </option>
+               <option>
+                       <name>Float</name>
+                       <key>float</key>
+                       <opt>type:real</opt>
+                       <opt>hide:none</opt>
+               </option>
+               <option>
+                       <name>Int</name>
+                       <key>int</key>
+                       <opt>type:int</opt>
+                       <opt>hide:none</opt>
+               </option>
+               <option>
+                       <name>Long</name>
+                       <key>long</key>
+                       <opt>type:int</opt>
+                       <opt>hide:none</opt>
+               </option>
+               <option>
+                       <name>String</name>
+                       <key>string</key>
+                       <opt>type:string</opt>
+                       <opt>hide:none</opt>
+               </option>
+       </param>
        <doc>
 This block represents a parameter to the flow graph, \
 used when the flow graph is instantiated as a hier block.
@@ -27,5 +71,7 @@
 The paramater value cannot depend on any variables.
 
 Leave the label blank to use the parameter id as the label.
+
+When type is not None, this parameter also becomes a command line option of 
the form --[id] [value].
        </doc>
 </block>

Modified: gnuradio/trunk/grc/data/platforms/python/flow_graph.tmpl
===================================================================
--- gnuradio/trunk/grc/data/platforms/python/flow_graph.tmpl    2009-01-21 
22:43:57 UTC (rev 10281)
+++ gnuradio/trunk/grc/data/platforms/python/flow_graph.tmpl    2009-01-22 
00:32:48 UTC (rev 10282)
@@ -179,7 +179,16 @@
 ########################################################
 #if $generate_options != 'hb'
 if __name__ == '__main__':
-       tb = $(class_name)()
+       parser = OptionParser()
+       #set $args = list()
+       #for $param in $parameters
+               #if $param.get_param('type').get_value()
+       parser.add_option("--$param.get_id()", dest="$param.get_id()", 
type="$param.get_param('type').get_value()", default=$param.get_make())
+                       #silent $args.append('%s=options.%s'%($param.get_id(), 
$param.get_id()))
+               #end if
+       #end for
+       (options, args) = parser.parse_args()
+       tb = $(class_name)($(', '.join($args)))
        #if $generate_options == 'wx_gui'
        tb.Run()
        #elif $generate_options == 'no_gui'

Modified: gnuradio/trunk/grc/todo.txt
===================================================================
--- gnuradio/trunk/grc/todo.txt 2009-01-21 22:43:57 UTC (rev 10281)
+++ gnuradio/trunk/grc/todo.txt 2009-01-22 00:32:48 UTC (rev 10282)
@@ -1,7 +1,6 @@
 ##################################################
 # Blocks
 ##################################################
--optparse block
 -ofdm wrappers
 -controlled step block
 -simplify simple usrp





reply via email to

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