diff options
author | Tim O'Shea <tim.oshea753@gmail.com> | 2013-07-19 17:17:28 -0400 |
---|---|---|
committer | Tim O'Shea <tim.oshea753@gmail.com> | 2013-07-19 17:17:28 -0400 |
commit | 9c9b2545ccfc2502013fe60c1b5b718ba1430168 (patch) | |
tree | 0ba705d5814bc8dce6edb2e557d7488266f76dcb | |
parent | 436fec40cbc165b401d85c4626f97510f0c97cd0 (diff) |
grc: portability fix for older grc files that have missing affinity and minoutbuf keys
-rw-r--r-- | grc/base/Block.py | 6 | ||||
-rw-r--r-- | grc/python/flow_graph.tmpl | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/grc/base/Block.py b/grc/base/Block.py index a5f600ce6e..84cf187b80 100644 --- a/grc/base/Block.py +++ b/grc/base/Block.py @@ -196,6 +196,12 @@ class Block(Element): def get_param_keys(self): return _get_keys(self._params) def get_param(self, key): return _get_elem(self._params, key) def get_params(self): return self._params + def has_param(self, key): + try: + _get_elem(self._params, key); + return True; + except: + return False; ############################################## # Access Sinks diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl index bed979eacb..cf789233ec 100644 --- a/grc/python/flow_graph.tmpl +++ b/grc/python/flow_graph.tmpl @@ -161,10 +161,10 @@ gr.io_signaturev($(len($io_sigs)), $(len($io_sigs)), [$(', '.join($size_strs))]) $indent($blk.get_make()) #else self.$blk.get_id() = $indent($blk.get_make()) - #if $blk.get_param('affinity').get_value() + #if $blk.has_param('affinity') and $blk.get_param('affinity').get_value() (self.$blk.get_id()).set_processor_affinity($blk.get_param('affinity').get_value()) #end if - #if (len($blk.get_sources())>0) and (int($blk.get_param('minoutbuf').get_value()) > 0) + #if (len($blk.get_sources())>0) and $blk.has_param('affinity') and (int($blk.get_param('minoutbuf').get_value()) > 0) (self.$blk.get_id()).set_min_output_buffer($blk.get_param('minoutbuf').get_value()) #end if #end if |