diff options
author | Sebastian Koslowski <koslowski@kit.edu> | 2017-01-05 20:51:35 +0100 |
---|---|---|
committer | Sebastian Koslowski <koslowski@kit.edu> | 2017-01-05 20:51:35 +0100 |
commit | 10e7e270773a258b0356bafc3a5bbc4853f38a4c (patch) | |
tree | 5e55f5358a39e8caf453448ddc724ed66b61f387 /grc/core | |
parent | 7f25c0120fc7bc6a6eeee87878cf387647d51614 (diff) | |
parent | 8d80d0adacc98b02392428ab5284d8417df9c776 (diff) |
Merge remote-tracking branch 'upstream/next' into gtk3
Diffstat (limited to 'grc/core')
-rw-r--r-- | grc/core/Block.py | 5 | ||||
-rw-r--r-- | grc/core/generator/Generator.py | 2 | ||||
-rw-r--r-- | grc/core/utils/epy_block_io.py | 8 |
3 files changed, 9 insertions, 6 deletions
diff --git a/grc/core/Block.py b/grc/core/Block.py index 9a1d72c2de..bca17d458a 100644 --- a/grc/core/Block.py +++ b/grc/core/Block.py @@ -719,10 +719,11 @@ class EPyBlock(Block): iter_ports = iter(ports) ports_new = [] port_current = next(iter_ports, None) - for key, port_type in port_specs: + for key, port_type, vlen in port_specs: reuse_port = ( port_current is not None and port_current.get_type() == port_type and + port_current.get_vlen() == vlen and (key.isdigit() or port_current.key == key) ) if reuse_port: @@ -733,6 +734,8 @@ class EPyBlock(Block): if port_type == 'message': n['name'] = key n['optional'] = '1' + if vlen > 1: + n['vlen'] = str(vlen) port = port_factory(self, direction=direction, **n) ports_new.append(port) # replace old port list with new one diff --git a/grc/core/generator/Generator.py b/grc/core/generator/Generator.py index 8b073293ce..7f0caea49d 100644 --- a/grc/core/generator/Generator.py +++ b/grc/core/generator/Generator.py @@ -245,7 +245,7 @@ class TopBlockGenerator(object): } # Build the template t = Template(open(FLOW_GRAPH_TEMPLATE, 'r').read(), namespace) - output.append((self.file_path, str(t))) + output.append((self.file_path, "\n".join(line.rstrip() for line in str(t).split("\n")))) return output diff --git a/grc/core/utils/epy_block_io.py b/grc/core/utils/epy_block_io.py index fc631203e3..823116adb9 100644 --- a/grc/core/utils/epy_block_io.py +++ b/grc/core/utils/epy_block_io.py @@ -22,14 +22,15 @@ BlockIO = collections.namedtuple('BlockIO', 'name cls params sinks sources doc c def _ports(sigs, msgs): ports = list() for i, dtype in enumerate(sigs): - port_type = TYPE_MAP.get(dtype.name, None) + port_type = TYPE_MAP.get(dtype.base.name, None) if not port_type: raise ValueError("Can't map {0!r} to GRC port type".format(dtype)) - ports.append((str(i), port_type)) + vlen = dtype.shape[0] if len(dtype.shape) > 0 else 1 + ports.append((str(i), port_type, vlen)) for msg_key in msgs: if msg_key == 'system': continue - ports.append((msg_key, 'message')) + ports.append((msg_key, 'message', 1)) return ports @@ -127,4 +128,3 @@ class blk(gr.sync_block): """ from pprint import pprint pprint(dict(extract(blk_code)._asdict())) - |