commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: jblum
Subject: [Commit-gnuradio] r11232 - in gnuradio/branches/developers/jblum/grc/grc: base blocks python
Date: Thu, 18 Jun 2009 12:02:08 -0600 (MDT)

Author: jblum
Date: 2009-06-18 12:02:07 -0600 (Thu, 18 Jun 2009)
New Revision: 11232

Modified:
   gnuradio/branches/developers/jblum/grc/grc/base/Platform.py
   gnuradio/branches/developers/jblum/grc/grc/blocks/blks2_logpwrfft_x.xml
   gnuradio/branches/developers/jblum/grc/grc/python/Param.py
Log:
Fixed bug in loading new/blank flowgraph.
Added bool type.
Added callback/switched type on averaging in log power fft.



Modified: gnuradio/branches/developers/jblum/grc/grc/base/Platform.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/base/Platform.py 2009-06-18 
12:12:56 UTC (rev 11231)
+++ gnuradio/branches/developers/jblum/grc/grc/base/Platform.py 2009-06-18 
18:02:07 UTC (rev 11232)
@@ -93,7 +93,7 @@
                @return nested data
                @throws exception if the validation fails
                """
-               file_path = flow_graph_file or self._default_flow_graph
+               flow_graph_file = flow_graph_file or self._default_flow_graph
                open(flow_graph_file, 'r') #test open
                ParseXML.validate_dtd(flow_graph_file, FLOW_GRAPH_DTD)
                return ParseXML.from_file(flow_graph_file)

Modified: 
gnuradio/branches/developers/jblum/grc/grc/blocks/blks2_logpwrfft_x.xml
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/blocks/blks2_logpwrfft_x.xml     
2009-06-18 12:12:56 UTC (rev 11231)
+++ gnuradio/branches/developers/jblum/grc/grc/blocks/blks2_logpwrfft_x.xml     
2009-06-18 18:02:07 UTC (rev 11232)
@@ -18,6 +18,7 @@
 )</make>
        <callback>set_sample_rate($sample_rate)</callback>
        <callback>set_avg_alpha($avg_alpha)</callback>
+       <callback>set_average($average)</callback>
        <param>
                <name>Input Type</name>
                <key>type</key>
@@ -58,16 +59,10 @@
                <type>real</type>
        </param>
        <param>
-               <name>Average Alpha</name>
-               <key>avg_alpha</key>
-               <value>1.0</value>
-               <type>real</type>
-       </param>
-       <param>
                <name>Average</name>
                <key>average</key>
                <value>False</value>
-               <type>enum</type>
+               <type>bool</type>
                <option>
                        <name>On</name>
                        <key>True</key>
@@ -77,6 +72,12 @@
                        <key>False</key>
                </option>
        </param>
+       <param>
+               <name>Average Alpha</name>
+               <key>avg_alpha</key>
+               <value>1.0</value>
+               <type>real</type>
+       </param>
        <sink>
                <name>in</name>
                <type>$type</type>

Modified: gnuradio/branches/developers/jblum/grc/grc/python/Param.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/python/Param.py  2009-06-18 
12:12:56 UTC (rev 11231)
+++ gnuradio/branches/developers/jblum/grc/grc/python/Param.py  2009-06-18 
18:02:07 UTC (rev 11232)
@@ -89,7 +89,7 @@
        TYPES = _Param.TYPES + [
                'complex', 'real', 'int',
                'complex_vector', 'real_vector', 'int_vector',
-               'hex', 'string',
+               'hex', 'string', 'bool',
                'file_open', 'file_save',
                'id',
                'grid_pos', 'import',
@@ -163,6 +163,7 @@
                                'real_vector': 
Constants.FLOAT_VECTOR_COLOR_SPEC,
                                'int_vector': Constants.INT_VECTOR_COLOR_SPEC,
                                #special
+                               'bool': Constants.INT_COLOR_SPEC,
                                'hex': Constants.INT_COLOR_SPEC,
                                'string': Constants.BYTE_VECTOR_COLOR_SPEC,
                                'id': Constants.ID_COLOR_SPEC,
@@ -224,7 +225,7 @@
                #########################
                # Numeric Types
                #########################
-               elif t in ('raw', 'complex', 'real', 'int', 'complex_vector', 
'real_vector', 'int_vector', 'hex'):
+               elif t in ('raw', 'complex', 'real', 'int', 'complex_vector', 
'real_vector', 'int_vector', 'hex', 'bool'):
                        #raise exception if python cannot evaluate this value
                        try: e = self.get_parent().get_parent().evaluate(v)
                        except Exception, e:
@@ -286,8 +287,13 @@
                                        self._add_error_message('Expression 
"%s" is invalid for type integer vector.'%str(e))
                                        raise Exception
                                return e
-                       elif t == 'hex':
-                               return hex(e)
+                       elif t == 'hex': return hex(e)
+                       elif t == 'bool':
+                               try: assert e in (True, False)
+                               except AssertionError:
+                                       self._add_error_message('Expression 
"%s" is invalid for type bool.'%str(e))
+                                       raise Exception
+                               return bool(e)
                        else: raise TypeError, 'Type "%s" not handled'%t
                #########################
                # String Types





reply via email to

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