diff options
author | Josh Blum | 2009-08-25 14:56:47 -0700 |
---|---|---|
committer | Josh Blum | 2009-08-25 14:56:47 -0700 |
commit | af5701409859af4b20a03bfd6b2cebf3559b1b3d (patch) | |
tree | 66d51b6a67c3ad48a3f33ff301b752a9d45b360a /grc/python/flow_graph.tmpl | |
parent | e6f9073f11e016fba2793c3a6d9c026399994e08 (diff) | |
download | gnuradio-af5701409859af4b20a03bfd6b2cebf3559b1b3d.tar.gz gnuradio-af5701409859af4b20a03bfd6b2cebf3559b1b3d.tar.bz2 gnuradio-af5701409859af4b20a03bfd6b2cebf3559b1b3d.zip |
Work on command line options for generated code.
Simplified eng_option eng_float to reuse str_to_num code.
Diffstat (limited to 'grc/python/flow_graph.tmpl')
-rw-r--r-- | grc/python/flow_graph.tmpl | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl index 32139636a..924a280c4 100644 --- a/grc/python/flow_graph.tmpl +++ b/grc/python/flow_graph.tmpl @@ -211,6 +211,20 @@ class $(class_name)(gr.hier_block2): ## For top block code, generate a main routine. ## Instantiate the top block and run as gui or cli. ######################################################## +#def make_default($type, $param) + #if $type == 'eng_float' +eng_notation.num_to_str($param.get_make())#slurp + #else +$param.get_make()#slurp + #end if +#end def +#def make_short_id($param) + #set $short_id = $param.get_param('short_id').get_evaluated() + #if $short_id + #set $short_id = '-' + $short_id + #end if +$short_id#slurp +#end def #if $generate_options != 'hb' if __name__ == '__main__': parser = OptionParser(option_class=eng_option, usage="%prog: [options]") @@ -219,12 +233,8 @@ if __name__ == '__main__': #set $type = $param.get_param('type').get_value() #if $type #silent $params_eq_list.append('%s=options.%s'%($param.get_id(), $param.get_id())) - #set $short_id = $param.get_param('short_id').get_evaluated() - #if $short_id - #set $short_id = '-' + $short_id - #end if - parser.add_option("$short_id", "--$param.get_id()", dest="$param.get_id()", type="$type", default=$param.get_make(), - help="Set $($param.get_param('label').evaluate() or $param.get_id()) [default=%default]") + parser.add_option("$make_short_id($param)", "--$param.get_id().replace('_', '-')", dest="$param.get_id()", type="$type", default=$make_default($type, $param), + help="Set $($param.get_param('label').get_evaluated() or $param.get_id()) [default=%default]") #end if #end for (options, args) = parser.parse_args() |