From eefb51c0c0fac68d16544e492aebd883528607e1 Mon Sep 17 00:00:00 2001 From: jblum Date: Wed, 8 Jul 2009 19:50:21 +0000 Subject: [PATCH] short id fix git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11380 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/blocks/parameter.xml | 29 ++++++++++++++++------------- grc/python/Param.py | 7 ------- grc/python/flow_graph.tmpl | 6 +++++- grc/todo.txt | 1 + 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/grc/blocks/parameter.xml b/grc/blocks/parameter.xml index 682f626e..5d08c4b3 100644 --- a/grc/blocks/parameter.xml +++ b/grc/blocks/parameter.xml @@ -16,12 +16,6 @@ string #if $label() then 'none' else 'part'# - - Short ID - short_id - - string - Value value @@ -33,44 +27,53 @@ type enum - $type.hide + #if $type() then 'none' else 'part'# + + Short ID + short_id + + string + #if not $type() +all#slurp +#elif $short_id() +none#slurp +#else +part#slurp +#end if + + len($short_id) in (0, 1) + $short_id == '' or $(short_id).isalpha() This block represents a parameter to the flow graph. \ A parameter can be used to pass command line arguments into a top block. \ diff --git a/grc/python/Param.py b/grc/python/Param.py index 15ccd323..f971d0c3 100644 --- a/grc/python/Param.py +++ b/grc/python/Param.py @@ -302,13 +302,6 @@ class Param(_Param): elif t in ('string', 'file_open', 'file_save'): #do not check if file/directory exists, that is a runtime issue e = eval_string(v) - str_e = str(e) - if t == 'string' and self.get_name() == 'Short ID' and len(str_e) > 0: - try: - assert len(str_e) == 1 - ord_e = ord(str_e) - assert ord_e >= ord('a') and ord_e <= ord('z') or ord_e >= ord('A') and ord_e <= ord('Z') - except AssertionError: raise Exception, 'Short ID "%s" must be a single letter'%v return str(e) ######################### # Unique ID Type diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl index bc89fb1b..b537c43e 100644 --- a/grc/python/flow_graph.tmpl +++ b/grc/python/flow_graph.tmpl @@ -189,7 +189,11 @@ 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())) - parser.add_option("-$param.get_param('short_id').get_value()", "--$param.get_id()", dest="$param.get_id()", type="$type", default=$param.get_make(), + #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]") #end if #end for diff --git a/grc/todo.txt b/grc/todo.txt index de43d367..f715dd1d 100644 --- a/grc/todo.txt +++ b/grc/todo.txt @@ -69,6 +69,7 @@ * will not update for non-enum params * needs to account for added or removed params * example with grid params need update after notebook change +* use .strip() on the hide property so we can do away with #slurp(s) in the templates ################################################## # Future -- 2.30.2