pygui enabled delete on link context menu, removed split/merge for now, set edge labels to bold to stand out until better solution
This commit is contained in:
parent
5a8984de10
commit
491f2a8e93
4 changed files with 8 additions and 7 deletions
|
@ -50,7 +50,9 @@ class Application(tk.Frame):
|
||||||
text_scale = self.app_scale if self.app_scale < 1 else math.sqrt(self.app_scale)
|
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)
|
themes.scale_fonts(self.fonts_size, self.app_scale)
|
||||||
self.icon_text_font = font.Font(family="TkIconFont", size=int(12 * text_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):
|
def setup_theme(self):
|
||||||
themes.load(self.style)
|
themes.load(self.style)
|
||||||
|
|
|
@ -377,15 +377,14 @@ class CanvasEdge(Edge):
|
||||||
context = tk.Menu(self.canvas)
|
context = tk.Menu(self.canvas)
|
||||||
themes.style_menu(context)
|
themes.style_menu(context)
|
||||||
context.add_command(label="Configure", command=self.configure)
|
context.add_command(label="Configure", command=self.configure)
|
||||||
context.add_command(label="Delete")
|
context.add_command(label="Delete", command=self.click_delete)
|
||||||
context.add_command(label="Split")
|
|
||||||
context.add_command(label="Merge")
|
|
||||||
if self.canvas.app.core.is_runtime():
|
if self.canvas.app.core.is_runtime():
|
||||||
context.entryconfigure(1, state="disabled")
|
context.entryconfigure(1, state="disabled")
|
||||||
context.entryconfigure(2, state="disabled")
|
|
||||||
context.entryconfigure(3, state="disabled")
|
|
||||||
context.post(event.x_root, event.y_root)
|
context.post(event.x_root, event.y_root)
|
||||||
|
|
||||||
|
def click_delete(self):
|
||||||
|
self.canvas.delete_edge(self)
|
||||||
|
|
||||||
def configure(self) -> None:
|
def configure(self) -> None:
|
||||||
dialog = LinkConfigurationDialog(self.canvas, self.canvas.app, self)
|
dialog = LinkConfigurationDialog(self.canvas, self.canvas.app, self)
|
||||||
dialog.show()
|
dialog.show()
|
||||||
|
|
|
@ -563,6 +563,7 @@ class CanvasGraph(tk.Canvas):
|
||||||
dst_wireless = NodeUtils.is_wireless_node(dst_node.core_node.type)
|
dst_wireless = NodeUtils.is_wireless_node(dst_node.core_node.type)
|
||||||
if dst_wireless:
|
if dst_wireless:
|
||||||
src_node.delete_antenna()
|
src_node.delete_antenna()
|
||||||
|
self.core.deleted_graph_edges([edge])
|
||||||
|
|
||||||
def zoom(self, event: tk.Event, factor: float = None):
|
def zoom(self, event: tk.Event, factor: float = None):
|
||||||
if not factor:
|
if not factor:
|
||||||
|
|
|
@ -258,7 +258,6 @@ class CanvasNode:
|
||||||
|
|
||||||
def click_unlink(self, edge: CanvasEdge) -> None:
|
def click_unlink(self, edge: CanvasEdge) -> None:
|
||||||
self.canvas.delete_edge(edge)
|
self.canvas.delete_edge(edge)
|
||||||
self.app.core.deleted_graph_edges([edge])
|
|
||||||
|
|
||||||
def canvas_delete(self) -> None:
|
def canvas_delete(self) -> None:
|
||||||
self.canvas.clear_selection()
|
self.canvas.clear_selection()
|
||||||
|
|
Loading…
Reference in a new issue