summaryrefslogtreecommitdiff
path: root/grc/base/FlowGraph.py
diff options
context:
space:
mode:
authorJosh Blum2009-08-26 13:29:28 -0700
committerJosh Blum2009-08-26 13:29:28 -0700
commitdc9e9db16047ec589a7b0488fac04c5bb682903c (patch)
tree1a97913e4f1ab6acd0627757f034ee6c9eb4672f /grc/base/FlowGraph.py
parent854bed10dfb61e9f9feab5259a75e809941089ab (diff)
downloadgnuradio-dc9e9db16047ec589a7b0488fac04c5bb682903c.tar.gz
gnuradio-dc9e9db16047ec589a7b0488fac04c5bb682903c.tar.bz2
gnuradio-dc9e9db16047ec589a7b0488fac04c5bb682903c.zip
added rewrite methods to element to separate from validation logic
Diffstat (limited to 'grc/base/FlowGraph.py')
-rw-r--r--grc/base/FlowGraph.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/grc/base/FlowGraph.py b/grc/base/FlowGraph.py
index fe493cce1..990baf029 100644
--- a/grc/base/FlowGraph.py
+++ b/grc/base/FlowGraph.py
@@ -147,6 +147,14 @@ 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.
@@ -198,7 +206,7 @@ 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.validate() #validate all blocks before connections are made (in case of nports)
+ 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
@@ -225,3 +233,4 @@ class FlowGraph(Element):
#build the connection
self.connect(source, sink)
except AssertionError: Messages.send_error_load('Connection between %s(%s) and %s(%s) could not be made.'%(source_block_id, source_key, sink_block_id, sink_key))
+ self.rewrite() #global rewrite