From 0417d966ab328b51c0cdfeb5d8920cbbcd69c9de Mon Sep 17 00:00:00 2001
From: Sebastian Koslowski <koslowski@kit.edu>
Date: Fri, 29 Jul 2016 15:42:31 +0200
Subject: grc: gtk3: fix generating virtual/bypassed connections

---
 grc/core/generator/FlowGraphProxy.py | 6 +++---
 grc/core/generator/Generator.py      | 6 +++---
 grc/gui/Connection.py                | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/grc/core/generator/FlowGraphProxy.py b/grc/core/generator/FlowGraphProxy.py
index 678be4433e..23ccf95c4b 100644
--- a/grc/core/generator/FlowGraphProxy.py
+++ b/grc/core/generator/FlowGraphProxy.py
@@ -20,13 +20,13 @@ from __future__ import absolute_import
 from six.moves import range
 
 
-class FlowGraphProxy(object):
+class FlowGraphProxy(object):  # TODO: move this in a refactored Generator
 
     def __init__(self, fg):
-        self._fg = fg
+        self.orignal_flowgraph = fg
 
     def __getattr__(self, item):
-        return getattr(self._fg, item)
+        return getattr(self.orignal_flowgraph, item)
 
     def get_hier_block_stream_io(self, direction):
         """
diff --git a/grc/core/generator/Generator.py b/grc/core/generator/Generator.py
index 7c9a1eca73..a3b0c8af43 100644
--- a/grc/core/generator/Generator.py
+++ b/grc/core/generator/Generator.py
@@ -171,11 +171,12 @@ class TopBlockGenerator(object):
         connections = [con for con in fg.get_enabled_connections() if cf(con)]
 
         # Get the virtual blocks and resolve their connections
+        connection_factory = fg.parent_platform.Connection
         virtual = [c for c in connections if c.source_block.is_virtual_source()]
         for connection in virtual:
             source = connection.source_port.resolve_virtual_source()
             sink = connection.sink_port
-            resolved = fg.parent.Connection(flow_graph=fg, porta=source, portb=sink)
+            resolved = connection_factory(fg.orignal_flowgraph, source, sink)
             connections.append(resolved)
             # Remove the virtual connection
             connections.remove(connection)
@@ -201,8 +202,7 @@ class TopBlockGenerator(object):
                 if not sink.enabled:
                     # Ignore disabled connections
                     continue
-                sink_port = sink.sink_port
-                connection = fg.parent.Connection(flow_graph=fg, porta=source_port, portb=sink_port)
+                connection = connection_factory(fg.orignal_flowgraph, source_port, sink.sink_port)
                 connections.append(connection)
                 # Remove this sink connection
                 connections.remove(sink)
diff --git a/grc/gui/Connection.py b/grc/gui/Connection.py
index 9b483383ac..1c00845356 100644
--- a/grc/gui/Connection.py
+++ b/grc/gui/Connection.py
@@ -37,9 +37,9 @@ class Connection(Element, _Connection):
     The arrow coloring exposes the enabled and valid states.
     """
 
-    def __init__(self, **kwargs):
+    def __init__(self, *args, **kwargs):
         Element.__init__(self)
-        _Connection.__init__(self, **kwargs)
+        _Connection.__init__(self, *args, **kwargs)
 
         self._color = self._color2 = self._arrow_color = None
 
-- 
cgit v1.2.3