pygui: hide related wireless edges when hiding nodes, update to handle hiding wireless edges that are re-added when moving

This commit is contained in:
Blake Harnden 2021-02-17 16:03:01 -08:00
parent 7871a678ca
commit 422a1a500e
2 changed files with 11 additions and 1 deletions

View file

@ -498,9 +498,12 @@ class CanvasWirelessEdge(Edge):
self.width: float = WIRELESS_WIDTH
color = link.color if link.color else WIRELESS_COLOR
self.color: str = color
self.draw(self.manager.show_wireless.state())
state = self.manager.show_wireless.state()
self.draw(state)
if link.label:
self.middle_label_text(link.label)
if self.src.hidden or self.dst.hidden:
self.hide()
self.set_binding()
def set_binding(self) -> None:

View file

@ -435,6 +435,9 @@ class CanvasNode:
for edge in self.edges:
if not edge.hidden:
edge.hide()
for edge in self.wireless_edges:
if not edge.hidden:
edge.hide()
def show(self) -> None:
self.hidden = False
@ -447,6 +450,10 @@ class CanvasNode:
other_node = edge.other_node(self)
if edge.hidden and not other_node.hidden:
edge.show()
for edge in self.wireless_edges:
other_node = edge.other_node(self)
if edge.hidden and not other_node.hidden:
edge.show()
def set_label(self, state: str) -> None:
self.canvas.itemconfig(self.text_id, state=state)