commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r9571 - in gnuradio/trunk/grc: data/platforms/base dat


From: jblum
Subject: [Commit-gnuradio] r9571 - in gnuradio/trunk/grc: data/platforms/base data/platforms/python data/platforms/python/blocks src/platforms/base
Date: Sat, 13 Sep 2008 20:43:48 -0600 (MDT)

Author: jblum
Date: 2008-09-13 20:43:47 -0600 (Sat, 13 Sep 2008)
New Revision: 9571

Modified:
   gnuradio/trunk/grc/data/platforms/base/Makefile.am
   gnuradio/trunk/grc/data/platforms/python/Makefile.am
   gnuradio/trunk/grc/data/platforms/python/blocks/Makefile.am
   gnuradio/trunk/grc/src/platforms/base/Platform.py
Log:
support multiple blocks per wrapper, makefile for data dirs

Modified: gnuradio/trunk/grc/data/platforms/base/Makefile.am
===================================================================
--- gnuradio/trunk/grc/data/platforms/base/Makefile.am  2008-09-13 23:43:48 UTC 
(rev 9570)
+++ gnuradio/trunk/grc/data/platforms/base/Makefile.am  2008-09-14 02:43:47 UTC 
(rev 9571)
@@ -23,13 +23,11 @@
 
 ourdatadir = $(grc_base_data_dir)
 
-DATA_FILES = \
+ourdata_DATA = \
        block_tree.dtd \
        flow_graph.dtd \
        grc-icon-256.png \
        grc-icon-256.svg \
        grc-icon-32.png
 
-ourdata_DATA = $(DATA_FILES)
-
-EXTRA_DIST = $(DATA_FILES)
+EXTRA_DIST = $(ourdata_DATA)

Modified: gnuradio/trunk/grc/data/platforms/python/Makefile.am
===================================================================
--- gnuradio/trunk/grc/data/platforms/python/Makefile.am        2008-09-13 
23:43:48 UTC (rev 9570)
+++ gnuradio/trunk/grc/data/platforms/python/Makefile.am        2008-09-14 
02:43:47 UTC (rev 9571)
@@ -25,13 +25,11 @@
 
 ourdatadir = $(grc_python_data_dir)
 
-DATA_FILES = \
+ourdata_DATA = \
        block.dtd \
        block_tree.xml \
        default_flow_graph.grc.xml \
        flow_graph.tmpl
 
-ourdata_DATA = $(DATA_FILES)
+EXTRA_DIST = $(ourdata_DATA)
 
-EXTRA_DIST = $(DATA_FILES)
-

Modified: gnuradio/trunk/grc/data/platforms/python/blocks/Makefile.am
===================================================================
--- gnuradio/trunk/grc/data/platforms/python/blocks/Makefile.am 2008-09-13 
23:43:48 UTC (rev 9570)
+++ gnuradio/trunk/grc/data/platforms/python/blocks/Makefile.am 2008-09-14 
02:43:47 UTC (rev 9571)
@@ -23,7 +23,7 @@
 
 ourdatadir = $(grc_python_blocks_dir)
 
-DATA_FILES = \
+ourdata_DATA = \
        audio_sink.xml \
        audio_source.xml \
        band_pass_filter.xml \
@@ -205,6 +205,4 @@
        xmlrpc_client.xml \
        xmlrpc_server.xml
 
-ourdata_DATA = $(DATA_FILES)
-
-EXTRA_DIST = $(DATA_FILES)
+EXTRA_DIST = $(ourdata_DATA)

Modified: gnuradio/trunk/grc/src/platforms/base/Platform.py
===================================================================
--- gnuradio/trunk/grc/src/platforms/base/Platform.py   2008-09-13 23:43:48 UTC 
(rev 9570)
+++ gnuradio/trunk/grc/src/platforms/base/Platform.py   2008-09-14 02:43:47 UTC 
(rev 9571)
@@ -56,32 +56,32 @@
                self._blocks = dict()
                self._blocks_n = dict()
                for block_path in self._block_paths:
-                       if os.path.isfile(block_path): 
self._load_block(block_path)
+                       if os.path.isfile(block_path): 
self._load_blocks(block_path)
                        elif os.path.isdir(block_path):
                                for dirpath, dirnames, filenames in 
os.walk(block_path):
                                        for filename in filter(lambda f: 
f.endswith('.xml'), filenames):
-                                               
self._load_block(os.path.join(dirpath, filename))
+                                               
self._load_blocks(os.path.join(dirpath, filename))
 
        def get_prefs_block(self): return 
self.get_new_flow_graph().get_new_block('preferences')
 
-       def _load_block(self, f):
+       def _load_blocks(self, f):
                """
-               Load the block wrapper from the file path.
-               The block wrapper must pass validation, and have a unique block 
key.
+               Load the block wrappers from the file path.
+               The block wrapper must pass validation.
                If any of the checks fail, exit with error.
                @param f the file path
                """
                try: ParseXML.validate_dtd(f, self._block_dtd)
                except ParseXML.XMLSyntaxError, e: self._exit_with_error('Block 
definition "%s" failed: \n\t%s'%(f, e))
-               n = ParseXML.from_file(f)['block']
-               block = self.Block(self._flow_graph, n)
-               key = block.get_key()
-               #test against repeated keys
-               try: assert(key not in self.get_block_keys())
-               except AssertionError: self._exit_with_error('Key "%s" already 
exists in blocks'%key)
-               #store the block
-               self._blocks[key] = block
-               self._blocks_n[key] = n
+               for n in utils.listify(ParseXML.from_file(f), 'block'):
+                       block = self.Block(self._flow_graph, n)
+                       key = block.get_key()
+                       #test against repeated keys
+                       try: assert(key not in self.get_block_keys())
+                       except AssertionError: self._exit_with_error('Key "%s" 
already exists in blocks'%key)
+                       #store the block
+                       self._blocks[key] = block
+                       self._blocks_n[key] = n
 
        def load_block_tree(self, block_tree):
                """





reply via email to

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