make maintainer-clean removes these, and we want a clean orig.tar.gz
[debian/gnuradio] / grc / base / FlowGraph.py
index 990baf02935b99b68ea50b99f51169c0c3aa8d79..b4ac8fc3a2bf6a489d027cd07d77c8dae7b48eec 100644 (file)
@@ -19,8 +19,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 
 from . import odict
 from Element import Element
-from Block import Block
-from Connection import Connection
 from .. gui import Messages
 
 class FlowGraph(Element):
@@ -68,6 +66,7 @@ class FlowGraph(Element):
        def get_block(self, id): return filter(lambda b: b.get_id() == id, self.get_blocks())[0]
        def get_blocks(self): return filter(lambda e: e.is_block(), self.get_elements())
        def get_connections(self): return filter(lambda e: e.is_connection(), self.get_elements())
+       def get_children(self): return self.get_elements()
        def get_elements(self):
                """
                Get a list of all the elements.
@@ -102,7 +101,6 @@ class FlowGraph(Element):
                @param key the block key
                @return the new block or None if not found
                """
-               self.flag()
                if key not in self.get_parent().get_block_keys(): return None
                block = self.get_parent().get_new_block(self, key)
                self.get_elements().append(block)
@@ -116,8 +114,7 @@ class FlowGraph(Element):
                @throw Exception bad connection
                @return the new connection
                """
-               self.flag()
-               connection = self.get_parent().Connection(self, porta, portb)
+               connection = self.get_parent().Connection(flow_graph=self, porta=porta, portb=portb)
                self.get_elements().append(connection)
                return connection
 
@@ -128,7 +125,6 @@ class FlowGraph(Element):
                If the element is a block, remove its connections.
                If the element is a connection, just remove the connection.
                """
-               self.flag()
                if element not in self.get_elements(): return
                #found a port, set to parent signal block
                if element.is_port():
@@ -147,26 +143,6 @@ class FlowGraph(Element):
                """
                raise NotImplementedError
 
-       def rewrite(self):
-               """
-               Rewrite critical structures.
-               Call rewrite on all sub elements.
-               """
-               Element.rewrite(self)
-               for elem in self.get_elements(): elem.rewrite()
-
-       def validate(self):
-               """
-               Validate the flow graph.
-               Validate only the blocks.
-               Connections will be validated within the blocks.
-               """
-               Element.validate(self)
-               for c in self.get_blocks():
-                       c.validate()
-                       if not c.is_valid():
-                               self.add_error_message('Element "%s" is not valid.'%c)
-
        ##############################################
        ## Import/Export Methods
        ##############################################
@@ -206,7 +182,6 @@ class FlowGraph(Element):
                        #only load the block when the block key was valid
                        if block: block.import_data(block_n)
                        else: Messages.send_error_load('Block key "%s" not found in %s'%(key, self.get_parent()))
-               self.rewrite() #rewrite all blocks before connections are made (ex: nports)
                #build the connections
                for connection_n in connections_n:
                        #try to make the connection