GRC xml file: port declaration order

Hello list,

do message ports have to be declared after the other ports in the
corresponding GRC xml file? For visual purposes I tried to rearrange
them because I want the message ports to appear above the stream ports.
Unfortunately this leads to the effect that stream ports are counted
incorrectly in the generated python file. Port 0 has index 1 etc. and
thus the python file can’t be executed.

  • Johannes

On Tue, Mar 26, 2013 at 6:54 AM, Johannes D. [email protected]
wrote:

Hello list,

do message ports have to be declared after the other ports in the
corresponding GRC xml file? For visual purposes I tried to rearrange them
because I want the message ports to appear above the stream ports.
Unfortunately this leads to the effect that stream ports are counted
incorrectly in the generated python file. Port 0 has index 1 etc. and thus
the python file can’t be executed.

  • Johannes

I can confirm that this is a problem. I happened to have been working
on some message passing stuff myself, so I thought I’d try out what
you were doing.

Try this patch and let me know if that solves your problem and that
everything behaves like it should:

diff --git a/grc/python/Port.py b/grc/python/Port.py
index 0703d67…d4afa6c 100644
— a/grc/python/Port.py
+++ b/grc/python/Port.py
@@ -92,6 +92,7 @@ class Port(_Port, _GUIPort):
“”"
self._n = n
if n[‘type’] == ‘msg’: n[‘key’] = ‘msg’

  •            if n['type'] == 'message': n['key'] = n['name']
              if dir == 'source' and not n.find('key'):
                      n['key'] = str(block._source_count)
                      block._source_count += 1
    

Tom