diff options
author | Sebastian Koslowski <koslowski@kit.edu> | 2015-07-17 17:41:42 +0200 |
---|---|---|
committer | Sebastian Koslowski <koslowski@kit.edu> | 2015-07-17 17:41:42 +0200 |
commit | e98dee4f0ec25e3062760f3aeb7642c490e9464a (patch) | |
tree | 8e482beff9b82e80c989b842f8c918b174516972 /grc/python/Port.py | |
parent | b82987acb6b1e4c368384753c43ad4d2a373659f (diff) |
grc: clean-up Block port counters
Diffstat (limited to 'grc/python/Port.py')
-rw-r--r-- | grc/python/Port.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/grc/python/Port.py b/grc/python/Port.py index 765e1d7423..249d7aed71 100644 --- a/grc/python/Port.py +++ b/grc/python/Port.py @@ -100,14 +100,11 @@ class Port(_Port, _GUIPort): elif n['domain'] == GR_MESSAGE_DOMAIN: n['key'] = n['name'] n['type'] = 'message' # for port color - if n['type'] == 'msg': n['key'] = 'msg' - if dir == 'source' and not n.find('key'): - n['key'] = str(block._source_count) - block._source_count += 1 - if dir == 'sink' and not n.find('key'): - n['key'] = str(block._sink_count) - block._sink_count += 1 - #build the port + if n['type'] == 'msg': + n['key'] = 'msg' + if not n.find('key'): + n['key'] = str(next(block.port_counters[dir == 'source'])) + # build the port _Port.__init__( self, block=block, |