summaryrefslogtreecommitdiff
path: root/grc/base
diff options
context:
space:
mode:
authorJosh Blum2009-10-12 12:16:12 -0700
committerJosh Blum2009-10-12 12:16:12 -0700
commit5b74bb4d34f381fa8a8af1e1d96ea2d673a8be71 (patch)
treead6a9f64e3b610d008b0fb612772efd4162a82aa /grc/base
parent57e810d3f07909947a9fb2daeb507b439d5f4f50 (diff)
parent38d5389f3054164a2f04d6e4e8fe381aa5ee03fc (diff)
downloadgnuradio-5b74bb4d34f381fa8a8af1e1d96ea2d673a8be71.tar.gz
gnuradio-5b74bb4d34f381fa8a8af1e1d96ea2d673a8be71.tar.bz2
gnuradio-5b74bb4d34f381fa8a8af1e1d96ea2d673a8be71.zip
Merge commit '38d5389f3054164a2f04d6e4e8fe381aa5ee03fc' into vrt
Diffstat (limited to 'grc/base')
-rw-r--r--grc/base/Block.py24
-rw-r--r--grc/base/FlowGraph.py1
2 files changed, 17 insertions, 8 deletions
diff --git a/grc/base/Block.py b/grc/base/Block.py
index cb21c3958..b2015cc40 100644
--- a/grc/base/Block.py
+++ b/grc/base/Block.py
@@ -233,12 +233,22 @@ class Block(Element):
"""
Import this block's params from nested data.
Any param keys that do not exist will be ignored.
+ Since params can be dynamically created based another param,
+ call rewrite, and repeat the load until the params stick.
+ This call to rewrite will also create any dynamic ports
+ that are needed for the connections creation phase.
@param n the nested data odict
"""
- params_n = n.findall('param')
- for param_n in params_n:
- key = param_n.find('key')
- value = param_n.find('value')
- #the key must exist in this block's params
- if key in self.get_param_keys():
- self.get_param(key).set_value(value)
+ get_hash = lambda: hash(tuple(map(hash, self.get_params())))
+ my_hash = 0
+ while get_hash() != my_hash:
+ params_n = n.findall('param')
+ for param_n in params_n:
+ key = param_n.find('key')
+ value = param_n.find('value')
+ #the key must exist in this block's params
+ if key in self.get_param_keys():
+ self.get_param(key).set_value(value)
+ #store hash and call rewrite
+ my_hash = get_hash()
+ self.rewrite()
diff --git a/grc/base/FlowGraph.py b/grc/base/FlowGraph.py
index ce370ca24..7c51ef42a 100644
--- a/grc/base/FlowGraph.py
+++ b/grc/base/FlowGraph.py
@@ -184,7 +184,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