commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r9013 - in grc/trunk: notes src/grc/elements src/grc_g


From: jblum
Subject: [Commit-gnuradio] r9013 - in grc/trunk: notes src/grc/elements src/grc_gnuradio
Date: Thu, 24 Jul 2008 19:12:34 -0600 (MDT)

Author: jblum
Date: 2008-07-24 19:12:34 -0600 (Thu, 24 Jul 2008)
New Revision: 9013

Modified:
   grc/trunk/notes/todo.txt
   grc/trunk/src/grc/elements/FlowGraph.py
   grc/trunk/src/grc_gnuradio/FlowGraph.py
   grc/trunk/src/grc_gnuradio/Generator.py
   grc/trunk/src/grc_gnuradio/Platform.py
Log:
disabled support, cleanup hier tmp

Modified: grc/trunk/notes/todo.txt
===================================================================
--- grc/trunk/notes/todo.txt    2008-07-25 00:24:25 UTC (rev 9012)
+++ grc/trunk/notes/todo.txt    2008-07-25 01:12:34 UTC (rev 9013)
@@ -1,5 +1,4 @@
 ############ Blocks to Add: ####################
--hier block
 -optparse block
 -ofdm wrappers
 -controlled step block
@@ -21,6 +20,9 @@
 -hide io type params
 
 ############ Problems: ####################
+-library path for hier blocks
+-auto generate hier code
+-add hier code to python path
 
 ############ Suggestions: ####################
 -simple usrp

Modified: grc/trunk/src/grc/elements/FlowGraph.py
===================================================================
--- grc/trunk/src/grc/elements/FlowGraph.py     2008-07-25 00:24:25 UTC (rev 
9012)
+++ grc/trunk/src/grc/elements/FlowGraph.py     2008-07-25 01:12:34 UTC (rev 
9013)
@@ -79,6 +79,20 @@
                self._elements = element_list
                return self._elements
 
+       def get_enabled_blocks(self):
+               """!
+               Get a list of all blocks that are enabled.
+               @return a list of blocks
+               """
+               return filter(lambda b: b.get_enabled(), self.get_blocks())
+
+       def get_enabled_connections(self):
+               """!
+               Get a list of all connections that are enabled.
+               @return a list of connections
+               """
+               return filter(lambda c: c.get_enabled(), self.get_connections())
+
        def get_new_block(self, key):
                """!
                Get a new block of the specified key.

Modified: grc/trunk/src/grc_gnuradio/FlowGraph.py
===================================================================
--- grc/trunk/src/grc_gnuradio/FlowGraph.py     2008-07-25 00:24:25 UTC (rev 
9012)
+++ grc/trunk/src/grc_gnuradio/FlowGraph.py     2008-07-25 01:12:34 UTC (rev 
9013)
@@ -34,7 +34,7 @@
                @param pad_key a string of pad_source or pad_sink
                @return a dict with: type, nports, vlen, size
                """
-               pads = filter(lambda b: b.get_key() == pad_key, 
self.get_blocks())
+               pads = filter(lambda b: b.get_key() == pad_key, 
self.get_enabled_blocks())
                if not pads: return {
                        'nports': '0',
                        'type': '',
@@ -71,7 +71,7 @@
                Get a set of all import statments in this flow graph namespace.
                @return a set of import statements
                """
-               imports = sum([block.get_imports() for block in 
self.get_blocks()], [])
+               imports = sum([block.get_imports() for block in 
self.get_enabled_blocks()], [])
                imports = sorted(set(imports))
                return imports
 
@@ -81,7 +81,7 @@
                Exclude paramterized variables.
                @return a sorted list of variable blocks in order of dependency 
(indep -> dep)
                """
-               variables = filter(lambda b: b.get_key() in ('variable', 
'variable_slider', 'variable_chooser', 'variable_text_box'), self.get_blocks())
+               variables = filter(lambda b: b.get_key() in ('variable', 
'variable_slider', 'variable_chooser', 'variable_text_box'), 
self.get_enabled_blocks())
                #map var id to variable block
                id2var = dict([(var.get_id(), var) for var in variables])
                #map var id to variable code
@@ -97,7 +97,7 @@
                Get a list of all paramterized variables in this flow graph 
namespace.
                @return a list of paramterized variables
                """
-               parameters = filter(lambda b: b.get_key() == 'parameter', 
self.get_blocks())
+               parameters = filter(lambda b: b.get_key() == 'parameter', 
self.get_enabled_blocks())
                return parameters
 
        def evaluate(self, expr):

Modified: grc/trunk/src/grc_gnuradio/Generator.py
===================================================================
--- grc/trunk/src/grc_gnuradio/Generator.py     2008-07-25 00:24:25 UTC (rev 
9012)
+++ grc/trunk/src/grc_gnuradio/Generator.py     2008-07-25 01:12:34 UTC (rev 
9013)
@@ -80,11 +80,11 @@
                imports = self._flow_graph.get_imports()
                variables = self._flow_graph.get_variables()
                parameters = self._flow_graph.get_parameters()
-               #list of blocks not including variables and imports, not 
including disabled blocks
-               blocks = sorted(self._flow_graph.get_blocks(), lambda x, y: 
cmp(x.get_id(), y.get_id()))
-               blocks = filter(lambda b: b not in (imports + parameters + 
variables) and b.get_enabled(), blocks)
+               #list of blocks not including variables and imports and 
parameters and disabled
+               blocks = sorted(self._flow_graph.get_enabled_blocks(), lambda 
x, y: cmp(x.get_id(), y.get_id()))
+               blocks = filter(lambda b: b not in (imports + parameters + 
variables), blocks)
                #list of connections where each endpoint is enabled
-               connections = filter(lambda c: c.get_enabled(), 
self._flow_graph.get_connections())
+               connections = self._flow_graph.get_enabled_connections()
                #list of callbacks
                callbacks = sum([block.get_callbacks() for block in 
self._flow_graph.get_blocks()], [])
                #list of variable names

Modified: grc/trunk/src/grc_gnuradio/Platform.py
===================================================================
--- grc/trunk/src/grc_gnuradio/Platform.py      2008-07-25 00:24:25 UTC (rev 
9012)
+++ grc/trunk/src/grc_gnuradio/Platform.py      2008-07-25 01:12:34 UTC (rev 
9013)
@@ -45,6 +45,7 @@
                @param block_paths_internal_only a list of blocks internal to 
this platform
                @param block_paths_external a list of blocks to load in 
addition to the above blocks
                """
+               temp_files = list()
                #handle internal/only
                if block_paths_internal_only: 
                        block_paths = map(lambda b: os.path.join(BLOCK_PATH, 
b), ['options.xml'] + block_paths_internal_only)
@@ -54,9 +55,10 @@
                        from utils import convert_hier
                        def _load_block(file_path):
                                try:
-                                       output_file_path = file_path+'.hier'
+                                       output_file_path = file_path+'.tmp'
                                        convert_hier.convert_hier(file_path, 
output_file_path)
                                        block_paths.append(output_file_path)
+                                       temp_files.append(output_file_path)
                                except: print 'Error converting: %s'%file_path
                        for block_path_external in block_paths_external:
                                if os.path.isfile(block_path_external): 
_load_block(block_path_external)
@@ -75,6 +77,8 @@
                        default_flow_graph=DEFAULT_FLOW_GRAPH,
                        generator=Generator,
                )
+               #remove temp files
+               map(os.remove, temp_files)
 
        ##############################################
        # Constructors





reply via email to

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