inject block wrapper path
authorjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Thu, 6 Nov 2008 00:44:17 +0000 (00:44 +0000)
committerjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Thu, 6 Nov 2008 00:44:17 +0000 (00:44 +0000)
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9940 221aa14e-8319-0410-a670-987f0aec2ac5

grc/src/platforms/base/Block.py
grc/src/platforms/base/Platform.py

index fe24d56661b33298e317b9ca187ae608c4c81682..89a4c43835e4f131b42e92133fc3c275688f3d8f 100644 (file)
@@ -56,19 +56,16 @@ class Block(Element):
                @param n the nested odict
                @return block a new block
                """
+               #build the block
+               Element.__init__(self, flow_graph)
                #grab the data
-               name = n['name']
-               key = n['key']
-               category = utils.exists_or_else(n, 'category', '')
                params = utils.listify(n, 'param')
                sources = utils.listify(n, 'source')
                sinks = utils.listify(n, 'sink')
-               #build the block
-               Element.__init__(self, flow_graph)
-               #store the data
-               self._name = name
-               self._key = key
-               self._category = category
+               self._name = n['name']
+               self._key = n['key']
+               self._category = utils.exists_or_else(n, 'category', '')
+               self._block_wrapper_path = n['block_wrapper_path']
                #create the param objects
                self._params = odict()
                #add the id param
@@ -155,18 +152,13 @@ class Block(Element):
        def __str__(self): return 'Block - %s - %s(%s)'%(self.get_id(), self.get_name(), self.get_key())
 
        def get_id(self): return self.get_param('id').get_value()
-
        def is_block(self): return True
-
        def get_name(self): return self._name
-
        def get_key(self): return self._key
-
        def get_category(self): return self._category
-
        def get_doc(self): return ''
-
        def get_ports(self): return self.get_sources() + self.get_sinks()
+       def get_block_wrapper_path(self): return self._block_wrapper_path
 
        ##############################################
        # Access Params
index ee6cd3ba31ee04ec86fb76d5fb823891dec125a2..1a96594bbaa391db3cc9a49893851b424209731a 100644 (file)
@@ -74,6 +74,8 @@ class Platform(_Element):
                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))
                for n in utils.listify(ParseXML.from_file(f), 'block'):
+                       #inject block wrapper path
+                       n['block_wrapper_path'] = f
                        block = self.Block(self._flow_graph, n)
                        key = block.get_key()
                        #test against repeated keys