From ed6e9a484ddddbbadf19584f6606d2c9e36de823 Mon Sep 17 00:00:00 2001 From: Sebastian Koslowski <koslowski@kit.edu> Date: Sun, 7 Feb 2016 13:44:59 +0100 Subject: grc-refactor: fixes, type-testing-flags, FlowGraph.py, (more) --- grc/model/Connection.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'grc/model/Connection.py') diff --git a/grc/model/Connection.py b/grc/model/Connection.py index 7cef4ad2b7..a7b428dfe6 100644 --- a/grc/model/Connection.py +++ b/grc/model/Connection.py @@ -25,6 +25,8 @@ from .odict import odict class Connection(Element): + is_connection = True + def __init__(self, flow_graph, porta, portb): """ Make a new connection given the parent and 2 ports. @@ -42,9 +44,9 @@ class Connection(Element): source = sink = None # Separate the source and sink for port in (porta, portb): - if port.is_source(): + if port.is_source: source = port - if port.is_sink(): + else: sink = port if not source: raise ValueError('Connection could not isolate source') @@ -57,7 +59,7 @@ class Connection(Element): if not len(source.get_associated_ports()) == len(sink.get_associated_ports()): raise ValueError('port connections must have same cardinality') # Ensure that this connection (source -> sink) is unique - for connection in self.get_parent().get_connections(): + for connection in flow_graph.connections: if connection.get_source() is source and connection.get_sink() is sink: raise LookupError('This connection between source and sink is not unique.') self._source = source @@ -81,8 +83,6 @@ class Connection(Element): self.get_sink(), ) - def is_connection(self): return True - def is_msg(self): return self.get_source().get_type() == self.get_sink().get_type() == 'msg' -- cgit v1.2.3