diff options
author | Sebastian Koslowski <koslowski@kit.edu> | 2016-04-27 12:35:12 +0200 |
---|---|---|
committer | Sebastian Koslowski <koslowski@kit.edu> | 2016-04-27 16:47:08 +0200 |
commit | 031a9dc18326ce1f4328c8edf131cba5904c3b13 (patch) | |
tree | a0a350eb696802e82d8facb37dc132ff5c7a97a6 /grc/core/Block.py | |
parent | 26de50e62da7116754c0175c32c4179de2d13672 (diff) |
grc: auto-add callbacks for epy block params
Diffstat (limited to 'grc/core/Block.py')
-rw-r--r-- | grc/core/Block.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/grc/core/Block.py b/grc/core/Block.py index cb4eb0db61..106e4bc89a 100644 --- a/grc/core/Block.py +++ b/grc/core/Block.py @@ -418,8 +418,11 @@ class Block(Element): except Exception as e: self._epy_reload_error = ValueError(str(e)) try: # Load last working block io - blk_io = epy_block_io.BlockIO(*eval(param_blk.get_value())) - except: + blk_io_args = eval(param_blk.get_value()) + if len(blk_io_args) == 6: + blk_io_args += ([],) # add empty callbacks + blk_io = epy_block_io.BlockIO(*blk_io_args) + except Exception: return else: self._epy_reload_error = None # Clear previous errors @@ -432,7 +435,8 @@ class Block(Element): self._doc = blk_io.doc self._imports[0] = 'import ' + self.get_id() self._make = '{0}.{1}({2})'.format(self.get_id(), blk_io.cls, ', '.join( - '{0}=${0}'.format(key) for key, _ in blk_io.params)) + '{0}=${{ {0} }}'.format(key) for key, _ in blk_io.params)) + self._callbacks = ['{0} = ${{ {0} }}'.format(attr) for attr in blk_io.callbacks] params = {} for param in list(self._params): |