commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r11380 - in gnuradio/trunk/grc: . blocks python


From: jblum
Subject: [Commit-gnuradio] r11380 - in gnuradio/trunk/grc: . blocks python
Date: Wed, 8 Jul 2009 13:50:21 -0600 (MDT)

Author: jblum
Date: 2009-07-08 13:50:21 -0600 (Wed, 08 Jul 2009)
New Revision: 11380

Modified:
   gnuradio/trunk/grc/blocks/parameter.xml
   gnuradio/trunk/grc/python/Param.py
   gnuradio/trunk/grc/python/flow_graph.tmpl
   gnuradio/trunk/grc/todo.txt
Log:
short id fix

Modified: gnuradio/trunk/grc/blocks/parameter.xml
===================================================================
--- gnuradio/trunk/grc/blocks/parameter.xml     2009-07-08 19:21:11 UTC (rev 
11379)
+++ gnuradio/trunk/grc/blocks/parameter.xml     2009-07-08 19:50:21 UTC (rev 
11380)
@@ -17,12 +17,6 @@
                <hide>#if $label() then 'none' else 'part'#</hide>
        </param>
        <param>
-               <name>Short ID</name>
-               <key>short_id</key>
-               <value></value>
-               <type>string</type>
-       </param>
-       <param>
                <name>Value</name>
                <key>value</key>
                <value>0</value>
@@ -33,44 +27,53 @@
                <key>type</key>
                <value></value>
                <type>enum</type>
-               <hide>$type.hide</hide>
+               <hide>#if $type() then 'none' else 'part'#</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>eng_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>
+       <param>
+               <name>Short ID</name>
+               <key>short_id</key>
+               <value></value>
+               <type>string</type>
+               <hide>#if not $type()
+all#slurp
+#elif $short_id()
+none#slurp
+#else
+part#slurp
+#end if</hide>
+       </param>
+       <check>len($short_id) in (0, 1)</check>
+       <check>$short_id == '' or $(short_id).isalpha()</check>
        <doc>
 This block represents a parameter to the flow graph. \
 A parameter can be used to pass command line arguments into a top block. \

Modified: gnuradio/trunk/grc/python/Param.py
===================================================================
--- gnuradio/trunk/grc/python/Param.py  2009-07-08 19:21:11 UTC (rev 11379)
+++ gnuradio/trunk/grc/python/Param.py  2009-07-08 19:50:21 UTC (rev 11380)
@@ -302,13 +302,6 @@
                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

Modified: gnuradio/trunk/grc/python/flow_graph.tmpl
===================================================================
--- gnuradio/trunk/grc/python/flow_graph.tmpl   2009-07-08 19:21:11 UTC (rev 
11379)
+++ gnuradio/trunk/grc/python/flow_graph.tmpl   2009-07-08 19:50:21 UTC (rev 
11380)
@@ -189,7 +189,11 @@
                #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

Modified: gnuradio/trunk/grc/todo.txt
===================================================================
--- gnuradio/trunk/grc/todo.txt 2009-07-08 19:21:11 UTC (rev 11379)
+++ gnuradio/trunk/grc/todo.txt 2009-07-08 19:50:21 UTC (rev 11380)
@@ -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





reply via email to

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