Merge branch 'coretk' of https://github.com/coreemu/core into coretk

This commit is contained in:
Huy Pham 2019-12-16 14:58:03 -08:00
commit 6799b537de
4 changed files with 16 additions and 14 deletions

View file

@ -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:

View file

@ -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()

View file

@ -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("<ButtonPress-3>", lambda e: self.scan_mark(e.x, e.y))
self.bind("<B3-Motion>", 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()
@ -594,8 +601,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):
"""

View file

@ -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()