pygui changes to avoid deleting session and open xml race conditions, fix to reset canvas view options when creating a new session

This commit is contained in:
Blake Harnden 2020-05-01 14:13:44 -07:00
parent 1f1b1c7b65
commit f7281459ed
4 changed files with 12 additions and 8 deletions

View file

@ -128,5 +128,4 @@ class CoreEmu:
result = True
else:
logging.error("session to delete did not exist: %s", _id)
return result

View file

@ -614,7 +614,7 @@ class CoreClient:
Open core xml
"""
try:
response = self.client.open_xml(file_path)
response = self._client.open_xml(file_path)
logging.info("open xml file %s, response: %s", file_path, response)
self.join_session(response.session_id)
except grpc.RpcError as e:

View file

@ -133,6 +133,15 @@ class CanvasGraph(tk.Canvas):
# hide context
self.hide_context()
# reset view options to default state
self.show_node_labels.set(True)
self.show_link_labels.set(True)
self.show_grid.set(True)
self.show_annotations.set(True)
self.show_interface_names.set(False)
self.show_ip4s.set(True)
self.show_ip6s.set(True)
# delete any existing drawn items
for tag in tags.COMPONENT_TAGS:
self.delete(tag)

View file

@ -387,12 +387,8 @@ class Menubar(tk.Menu):
if self.core.is_runtime():
result = messagebox.askyesnocancel("Exit", "Stop the running session?")
if result:
callback = None
if quit_app:
callback = self.app.quit
task = BackgroundTask(self.app, self.core.delete_session, callback)
task.start()
elif quit_app:
self.core.delete_session()
if quit_app:
self.app.quit()
def click_new(self) -> None: