diff options
author | Sebastian Koslowski <koslowski@kit.edu> | 2016-02-07 13:44:59 +0100 |
---|---|---|
committer | Sebastian Koslowski <koslowski@kit.edu> | 2016-02-17 19:55:16 +0100 |
commit | ed6e9a484ddddbbadf19584f6606d2c9e36de823 (patch) | |
tree | bbad5da38afcfa2cfb29f4787dfe5d862565f5e4 /grc/model/Connection.py | |
parent | 62aadb3198ce82a6fb9d7e4a12bf7df1ee168100 (diff) |
grc-refactor: fixes, type-testing-flags, FlowGraph.py, (more)
Diffstat (limited to 'grc/model/Connection.py')
-rw-r--r-- | grc/model/Connection.py | 10 |
1 files changed, 5 insertions, 5 deletions
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' |