From 491f2a8e9342b6abd049ee1809001aec4e122604 Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Fri, 1 May 2020 23:47:37 -0700 Subject: [PATCH] pygui enabled delete on link context menu, removed split/merge for now, set edge labels to bold to stand out until better solution --- daemon/core/gui/app.py | 4 +++- daemon/core/gui/graph/edges.py | 9 ++++----- daemon/core/gui/graph/graph.py | 1 + daemon/core/gui/graph/node.py | 1 - 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/daemon/core/gui/app.py b/daemon/core/gui/app.py index 0f40a594..13d10dd0 100644 --- a/daemon/core/gui/app.py +++ b/daemon/core/gui/app.py @@ -50,7 +50,9 @@ class Application(tk.Frame): text_scale = self.app_scale if self.app_scale < 1 else math.sqrt(self.app_scale) themes.scale_fonts(self.fonts_size, self.app_scale) self.icon_text_font = font.Font(family="TkIconFont", size=int(12 * text_scale)) - self.edge_font = font.Font(family="TkDefaultFont", size=int(8 * text_scale)) + self.edge_font = font.Font( + family="TkDefaultFont", size=int(8 * text_scale), weight=font.BOLD + ) def setup_theme(self): themes.load(self.style) diff --git a/daemon/core/gui/graph/edges.py b/daemon/core/gui/graph/edges.py index b70fe6b2..8aa63de4 100644 --- a/daemon/core/gui/graph/edges.py +++ b/daemon/core/gui/graph/edges.py @@ -377,15 +377,14 @@ class CanvasEdge(Edge): context = tk.Menu(self.canvas) themes.style_menu(context) context.add_command(label="Configure", command=self.configure) - context.add_command(label="Delete") - context.add_command(label="Split") - context.add_command(label="Merge") + context.add_command(label="Delete", command=self.click_delete) if self.canvas.app.core.is_runtime(): context.entryconfigure(1, state="disabled") - context.entryconfigure(2, state="disabled") - context.entryconfigure(3, state="disabled") context.post(event.x_root, event.y_root) + def click_delete(self): + self.canvas.delete_edge(self) + def configure(self) -> None: dialog = LinkConfigurationDialog(self.canvas, self.canvas.app, self) dialog.show() diff --git a/daemon/core/gui/graph/graph.py b/daemon/core/gui/graph/graph.py index 22d21b51..74040e64 100644 --- a/daemon/core/gui/graph/graph.py +++ b/daemon/core/gui/graph/graph.py @@ -563,6 +563,7 @@ class CanvasGraph(tk.Canvas): dst_wireless = NodeUtils.is_wireless_node(dst_node.core_node.type) if dst_wireless: src_node.delete_antenna() + self.core.deleted_graph_edges([edge]) def zoom(self, event: tk.Event, factor: float = None): if not factor: diff --git a/daemon/core/gui/graph/node.py b/daemon/core/gui/graph/node.py index 5b3aed10..cee0e822 100644 --- a/daemon/core/gui/graph/node.py +++ b/daemon/core/gui/graph/node.py @@ -258,7 +258,6 @@ class CanvasNode: def click_unlink(self, edge: CanvasEdge) -> None: self.canvas.delete_edge(edge) - self.app.core.deleted_graph_edges([edge]) def canvas_delete(self) -> None: self.canvas.clear_selection()