Ejemplo n.º 1
0
 def create_edge(self, src: CanvasNode, dst: CanvasNode) -> CanvasEdge:
     """
     create an edge between source node and destination node
     """
     edge = CanvasEdge(self.app, src)
     edge.complete(dst)
     return edge
Ejemplo n.º 2
0
 def complete_edge(
     self,
     src: CanvasNode,
     dst: CanvasNode,
     edge: CanvasEdge,
     link: Optional[Link] = None,
 ) -> None:
     linked_wireless = self.is_linked_wireless(src.id, dst.id)
     edge.complete(dst.id, linked_wireless)
     if link is None:
         link = self.core.create_link(edge, src, dst)
     edge.link = link
     if link.iface1:
         iface1 = link.iface1
         src.ifaces[iface1.id] = iface1
     if link.iface2:
         iface2 = link.iface2
         dst.ifaces[iface2.id] = iface2
     src.edges.add(edge)
     dst.edges.add(edge)
     edge.token = create_edge_token(edge.link)
     self.arc_common_edges(edge)
     edge.draw_labels()
     edge.check_options()
     self.edges[edge.token] = edge
     self.core.save_edge(edge, src, dst)
Ejemplo n.º 3
0
 def add_wired_edge(self, src: CanvasNode, dst: CanvasNode, link: Link) -> None:
     token = create_edge_token(link)
     if token in self.edges and link.options.unidirectional:
         edge = self.edges[token]
         edge.asymmetric_link = link
     elif token not in self.edges:
         edge = CanvasEdge(self.app, src, dst)
         edge.complete(dst, link)
Ejemplo n.º 4
0
 def create_edge(self, source: CanvasNode, dest: CanvasNode):
     """
     create an edge between source node and destination node
     """
     token = create_edge_token(source.id, dest.id)
     if token not in self.edges:
         pos = (source.core_node.position.x, source.core_node.position.y)
         edge = CanvasEdge(self, source.id, pos, pos)
         edge.complete(dest.id)
         self.edges[edge.token] = edge
         self.nodes[source.id].edges.add(edge)
         self.nodes[dest.id].edges.add(edge)
         self.core.create_link(edge, source, dest)
Ejemplo n.º 5
0
 def create_edge(self, source: CanvasNode, dest: CanvasNode):
     """
     create an edge between source node and destination node
     """
     if (source.id, dest.id) not in self.edges:
         pos0 = source.core_node.position
         x0 = pos0.x
         y0 = pos0.y
         edge = CanvasEdge(x0, y0, x0, y0, source.id, self)
         edge.complete(dest.id)
         self.edges[edge.token] = edge
         self.nodes[source.id].edges.add(edge)
         self.nodes[dest.id].edges.add(edge)
         self.core.create_link(edge, source, dest)
Ejemplo n.º 6
0
 def click_link(self, node: "CanvasNode") -> None:
     edge = CanvasEdge(self.app, self, node)
     edge.complete(node)