From a4e0154373510695741f840298f4ea7c2cbb217a Mon Sep 17 00:00:00 2001
From: Sebastian Koslowski <koslowski@kit.edu>
Date: Mon, 8 Dec 2014 22:36:47 +0100
Subject: grc: port connections by domain, block name in generated code

---
 grc/python/Generator.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'grc/python/Generator.py')

diff --git a/grc/python/Generator.py b/grc/python/Generator.py
index a1f8457d37..7512cfb633 100644
--- a/grc/python/Generator.py
+++ b/grc/python/Generator.py
@@ -164,8 +164,12 @@ class TopBlockGenerator(object):
         )
         # list of regular blocks (all blocks minus the special ones)
         blocks = filter(lambda b: b not in (imports + parameters), blocks)
-        # list of connections where each endpoint is enabled
+        # list of connections where each endpoint is enabled (sorted by domains, block names)
         connections = filter(lambda c: not (c.is_bus() or c.is_msg()), self._flow_graph.get_enabled_connections())
+        connections.sort(key=lambda c: (
+            c.get_source().get_domain(), c.get_sink().get_domain(),
+            c.get_source().get_parent().get_id(), c.get_sink().get_parent().get_id()
+        ))
         connection_templates = self._flow_graph.get_parent().get_connection_templates()
         msgs = filter(lambda c: c.is_msg(), self._flow_graph.get_enabled_connections())
         # list of variable names
-- 
cgit v1.2.3