pygui: removed edges tracking interfaces, since the link associated with them already does
This commit is contained in:
parent
055029e5c5
commit
053cd1da65
5 changed files with 13 additions and 17 deletions
|
@ -910,10 +910,10 @@ class CoreClient:
|
|||
src_node = canvas_src_node.core_node
|
||||
dst_node = canvas_dst_node.core_node
|
||||
if NodeUtils.is_container_node(src_node.type):
|
||||
src_iface_id = edge.src_iface.id
|
||||
src_iface_id = edge.link.iface1.id
|
||||
self.iface_to_edge[(src_node.id, src_iface_id)] = edge
|
||||
if NodeUtils.is_container_node(dst_node.type):
|
||||
dst_iface_id = edge.dst_iface.id
|
||||
dst_iface_id = edge.link.iface2.id
|
||||
self.iface_to_edge[(dst_node.id, dst_iface_id)] = edge
|
||||
|
||||
def get_wlan_configs_proto(self) -> List[wlan_pb2.WlanConfig]:
|
||||
|
|
|
@ -285,8 +285,6 @@ class CanvasEdge(Edge):
|
|||
Create an instance of canvas edge object
|
||||
"""
|
||||
super().__init__(canvas, src)
|
||||
self.src_iface: Optional[Interface] = None
|
||||
self.dst_iface: Optional[Interface] = None
|
||||
self.text_src: Optional[int] = None
|
||||
self.text_dst: Optional[int] = None
|
||||
self.link: Optional[Link] = None
|
||||
|
|
|
@ -237,7 +237,7 @@ class CanvasGraph(tk.Canvas):
|
|||
src_pos = (node1.position.x, node1.position.y)
|
||||
dst_pos = (node2.position.x, node2.position.y)
|
||||
edge = CanvasEdge(self, src.id, src_pos, dst_pos)
|
||||
self.complete_edge(src, dst, edge)
|
||||
self.complete_edge(src, dst, edge, link)
|
||||
|
||||
def delete_wired_edge(self, src: CanvasNode, dst: CanvasNode, link: Link) -> None:
|
||||
token = create_edge_token(src.id, dst.id, link)
|
||||
|
@ -512,10 +512,10 @@ class CanvasGraph(tk.Canvas):
|
|||
edge.delete()
|
||||
# update node connected to edge being deleted
|
||||
other_id = edge.src
|
||||
other_iface = edge.src_iface
|
||||
other_iface = edge.link.iface1
|
||||
if edge.src == object_id:
|
||||
other_id = edge.dst
|
||||
other_iface = edge.dst_iface
|
||||
other_iface = edge.link.iface2
|
||||
other_node = self.nodes[other_id]
|
||||
other_node.edges.remove(edge)
|
||||
if other_iface:
|
||||
|
@ -537,12 +537,12 @@ class CanvasGraph(tk.Canvas):
|
|||
del self.edges[edge.token]
|
||||
src_node = self.nodes[edge.src]
|
||||
src_node.edges.discard(edge)
|
||||
if edge.src_iface:
|
||||
del src_node.ifaces[edge.src_iface.id]
|
||||
if edge.link.iface1:
|
||||
del src_node.ifaces[edge.link.iface1.id]
|
||||
dst_node = self.nodes[edge.dst]
|
||||
dst_node.edges.discard(edge)
|
||||
if edge.dst_iface:
|
||||
del dst_node.ifaces[edge.dst_iface.id]
|
||||
if edge.link.iface2:
|
||||
del dst_node.ifaces[edge.link.iface2.id]
|
||||
src_wireless = NodeUtils.is_wireless_node(src_node.core_node.type)
|
||||
if src_wireless:
|
||||
dst_node.delete_antenna()
|
||||
|
@ -907,11 +907,9 @@ class CanvasGraph(tk.Canvas):
|
|||
if link.iface1:
|
||||
iface1 = link.iface1
|
||||
src.ifaces[iface1.id] = iface1
|
||||
edge.src_iface = iface1
|
||||
if link.iface2:
|
||||
iface2 = link.iface2
|
||||
dst.ifaces[iface2.id] = iface2
|
||||
edge.dst_iface = iface2
|
||||
edge.set_link(link)
|
||||
edge.token = create_edge_token(src.id, dst.id, edge.link)
|
||||
self.arc_common_edges(edge)
|
||||
|
|
|
@ -322,10 +322,10 @@ class CanvasNode:
|
|||
for edge in self.edges:
|
||||
if self.id == edge.src:
|
||||
other_id = edge.dst
|
||||
edge_iface_id = edge.src_iface.id
|
||||
edge_iface_id = edge.link.iface1.id
|
||||
else:
|
||||
other_id = edge.src
|
||||
edge_iface_id = edge.dst_iface.id
|
||||
edge_iface_id = edge.link.iface2.id
|
||||
if edge_iface_id != iface_id:
|
||||
continue
|
||||
other_node = self.canvas.nodes[other_id]
|
||||
|
|
|
@ -196,10 +196,10 @@ class InterfaceManager:
|
|||
for edge in canvas_node.edges:
|
||||
src_node = canvas.nodes[edge.src]
|
||||
dst_node = canvas.nodes[edge.dst]
|
||||
iface = edge.src_iface
|
||||
iface = edge.link.iface1
|
||||
check_node = src_node
|
||||
if src_node == canvas_node:
|
||||
iface = edge.dst_iface
|
||||
iface = edge.link.iface2
|
||||
check_node = dst_node
|
||||
if check_node.core_node.id in visited:
|
||||
continue
|
||||
|
|
Loading…
Reference in a new issue