From 084aedf3d251846cdbc4afe59dd61bf02757e1e2 Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Mon, 16 Dec 2019 14:34:37 -0800 Subject: [PATCH 1/2] removed services button from node config dialog, limited to context menu for now --- coretk/coretk/dialogs/nodeconfig.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/coretk/coretk/dialogs/nodeconfig.py b/coretk/coretk/dialogs/nodeconfig.py index c71a1b34..cfec3b24 100644 --- a/coretk/coretk/dialogs/nodeconfig.py +++ b/coretk/coretk/dialogs/nodeconfig.py @@ -5,7 +5,6 @@ from tkinter import ttk from coretk import nodeutils from coretk.dialogs.dialog import Dialog -from coretk.dialogs.nodeservice import NodeService from coretk.images import Images from coretk.nodeutils import NodeUtils from coretk.themes import FRAME_PAD, PADX, PADY @@ -130,10 +129,6 @@ class NodeConfigDialog(Dialog): combobox.grid(row=row, column=1, sticky="ew") row += 1 - # services - button = ttk.Button(self.top, text="Services", command=self.click_services) - button.grid(sticky="ew", pady=PADY) - # interfaces if self.canvas_node.interfaces: self.draw_interfaces() @@ -193,10 +188,6 @@ class NodeConfigDialog(Dialog): button = ttk.Button(frame, text="Cancel", command=self.destroy) button.grid(row=0, column=1, sticky="ew") - def click_services(self): - dialog = NodeService(self, self.app, self.canvas_node) - dialog.show() - def click_icon(self): file_path = image_chooser(self) if file_path: From 0082d61517604fa3cbf45a4bb9b28af4616f1e8c Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Mon, 16 Dec 2019 14:55:54 -0800 Subject: [PATCH 2/2] updates to allow wlan config changes during runtime --- coretk/coretk/dialogs/wlanconfig.py | 5 ++++- coretk/coretk/graph/graph.py | 14 ++++++++++---- coretk/coretk/toolbar.py | 2 ++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/coretk/coretk/dialogs/wlanconfig.py b/coretk/coretk/dialogs/wlanconfig.py index aed411b8..20966d2b 100644 --- a/coretk/coretk/dialogs/wlanconfig.py +++ b/coretk/coretk/dialogs/wlanconfig.py @@ -58,6 +58,9 @@ class WlanConfigDialog(Dialog): :return: nothing """ - self.config_frame.parse_config() + config = self.config_frame.parse_config() self.app.core.wlan_configs[self.node.id] = self.config + if self.app.core.is_runtime(): + session_id = self.app.core.session_id + self.app.core.client.set_wlan_config(session_id, self.node.id, config) self.destroy() diff --git a/coretk/coretk/graph/graph.py b/coretk/coretk/graph/graph.py index a2d82dc4..acce0e28 100644 --- a/coretk/coretk/graph/graph.py +++ b/coretk/coretk/graph/graph.py @@ -87,6 +87,9 @@ class CanvasGraph(tk.Canvas): :param core.api.grpc.core_pb2.Session session: session to draw :return: nothing """ + # hide context + self.hide_context() + # delete any existing drawn items for tag in tags.COMPONENT_TAGS: self.delete(tag) @@ -122,6 +125,11 @@ class CanvasGraph(tk.Canvas): self.bind("", lambda e: self.scan_mark(e.x, e.y)) self.bind("", lambda e: self.scan_dragto(e.x, e.y, gain=1)) + def hide_context(self): + if self.context: + self.context.unpost() + self.context = None + def get_actual_coords(self, x, y): actual_x = (x - self.offset[0]) / self.ratio actual_y = (y - self.offset[1]) / self.ratio @@ -294,8 +302,7 @@ class CanvasGraph(tk.Canvas): return if self.context: - self.context.unpost() - self.context = None + self.hide_context() else: if self.mode == GraphMode.ANNOTATION: self.focus_set() @@ -592,8 +599,7 @@ class CanvasGraph(tk.Canvas): self.context = canvas_node.create_context() self.context.post(event.x_root, event.y_root) else: - self.context.unpost() - self.context = None + self.hide_context() def press_delete(self, event): """ diff --git a/coretk/coretk/toolbar.py b/coretk/coretk/toolbar.py index df183494..323c5d67 100644 --- a/coretk/coretk/toolbar.py +++ b/coretk/coretk/toolbar.py @@ -222,6 +222,7 @@ class Toolbar(ttk.Frame): :return: nothing """ + self.app.canvas.hide_context() self.app.statusbar.core_alarms.clear() self.app.statusbar.progress_bar.start(5) self.app.canvas.mode = GraphMode.SELECT @@ -385,6 +386,7 @@ class Toolbar(ttk.Frame): :return: nothing """ + self.app.canvas.hide_context() self.app.statusbar.progress_bar.start(5) thread = threading.Thread(target=self.app.core.stop_session) thread.start()