Exemplo n.º 1
0
def connectable(line, handle, element):
    connector = Connector(element, line)
    for port in element.ports():
        allow = connector.allow(handle, port)
        if allow:
            return True
    return False
Exemplo n.º 2
0
    def allow(self, line, handle, item, port=None):
        """Glue line's handle to an item.

        If port is not provided, then first port is used.
        """
        if port is None and len(item.ports()) > 0:
            port = item.ports()[0]

        adapter = Connector(item, line)
        return adapter.allow(handle, port)
Exemplo n.º 3
0
 def allow(self, sink):
     adapter = Connector(sink.item, self.item)
     return adapter and adapter.allow(self.handle, sink.port)
Exemplo n.º 4
0
def allow(line, handle, item, port=None) -> bool:
    if port is None and len(item.ports()) > 0:
        port = item.ports()[0]

    adapter = Connector(item, line)
    return adapter.allow(handle, port)
Exemplo n.º 5
0
def test_connection_is_allowed(diagram, block_item, proxy_port_item):
    connector = Connector(block_item, proxy_port_item)

    assert isinstance(connector, BlockProperyProxyPortConnector)
    assert connector.allow(proxy_port_item.handles()[0], block_item.ports()[0])