diff options
author | Sebastian Koslowski <koslowski@kit.edu> | 2016-01-29 11:16:57 +0100 |
---|---|---|
committer | Sebastian Koslowski <koslowski@kit.edu> | 2016-02-01 17:39:45 +0100 |
commit | 6947f3afb9ec020d534d3e05b85cb574a41f7232 (patch) | |
tree | cb15282380000522363c9f6f83444b14264c10c6 /grc/python/Block.py | |
parent | 11973c64437683cc99c48eae9eb4db8234f1ac42 (diff) |
grc: better message port handling for embedded python blocks
Diffstat (limited to 'grc/python/Block.py')
-rw-r--r-- | grc/python/Block.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/grc/python/Block.py b/grc/python/Block.py index 239352de1f..f5c994dc05 100644 --- a/grc/python/Block.py +++ b/grc/python/Block.py @@ -272,7 +272,7 @@ class Block(_Block, _GUIBlock): self._make = '{}({})'.format(blk_io.cls, ', '.join( '{0}=${0}'.format(key) for key, _ in blk_io.params)) - params = dict() + params = {} for param in list(self._params): if hasattr(param, '__epy_param__'): params[param.get_key()] = param @@ -293,7 +293,7 @@ class Block(_Block, _GUIBlock): def update_ports(label, ports, port_specs, direction): ports_to_remove = list(ports) iter_ports = iter(ports) - ports_new = list() + ports_new = [] port_current = next(iter_ports, None) for key, port_type in port_specs: reuse_port = ( @@ -306,6 +306,9 @@ class Block(_Block, _GUIBlock): port, port_current = port_current, next(iter_ports, None) else: n = odict(dict(name=label + str(key), type=port_type, key=key)) + if port_type == 'message': + n['name'] = key + n['optional'] = '1' port = platform.Port(block=self, n=n, dir=direction) ports_new.append(port) # replace old port list with new one |