set to selection mode when starting/stopping a session as well as joining for runtime/design states

This commit is contained in:
Blake Harnden 2019-12-09 13:19:45 -08:00
parent 2a29cd1fe5
commit afdacf0c94
2 changed files with 20 additions and 7 deletions

View file

@ -298,10 +298,11 @@ class CoreClient:
# update ui to represent current state
if self.is_runtime():
self.app.toolbar.runtime_frame.tkraise()
self.app.toolbar.click_runtime_selection()
else:
self.app.toolbar.design_frame.tkraise()
self.app.statusbar.progress_bar.stop()
self.app.toolbar.click_selection()
self.app.statusbar.progress_bar.stop()
def is_runtime(self):
return self.state == core_pb2.SessionState.RUNTIME

View file

@ -40,6 +40,9 @@ class Toolbar(ttk.Frame):
self.network_button = None
self.annotation_button = None
# runtime buttons
self.runtime_select_button = None
# frames
self.design_frame = None
self.runtime_frame = None
@ -89,6 +92,11 @@ class Toolbar(ttk.Frame):
self.annotation_button.state(["!pressed"])
button.state(["pressed"])
def runtime_select(self, button):
logging.info("selecting runtime button: %s", button)
self.runtime_select_button.state(["!pressed"])
button.state(["pressed"])
def draw_runtime_frame(self):
self.runtime_frame = ttk.Frame(self)
self.runtime_frame.grid(row=0, column=0, sticky="nsew")
@ -100,10 +108,10 @@ class Toolbar(ttk.Frame):
self.click_stop,
"stop the session",
)
self.create_button(
self.runtime_select_button = self.create_button(
self.runtime_frame,
icon(ImageEnum.SELECT),
self.click_selection,
self.click_runtime_selection,
"selection tool",
)
# self.create_observe_button()
@ -188,6 +196,11 @@ class Toolbar(ttk.Frame):
self.design_select(self.select_button)
self.app.canvas.mode = GraphMode.SELECT
def click_runtime_selection(self):
logging.debug("clicked selection tool")
self.runtime_select(self.runtime_select_button)
self.app.canvas.mode = GraphMode.SELECT
def click_start(self):
"""
Start session handler redraw buttons, send node and link messages to grpc
@ -200,6 +213,7 @@ class Toolbar(ttk.Frame):
thread = threading.Thread(target=self.app.core.start_session)
thread.start()
self.runtime_frame.tkraise()
self.click_runtime_selection()
def click_link(self):
logging.debug("Click LINK button")
@ -355,11 +369,9 @@ class Toolbar(ttk.Frame):
self.app.statusbar.progress_bar.start(5)
thread = threading.Thread(target=self.app.core.stop_session)
thread.start()
for cid in self.app.canvas.find_withtag("wireless"):
self.app.canvas.itemconfig(cid, state="hidden")
# self.app.canvas.delete("wireless")
self.app.canvas.delete("wireless")
self.design_frame.tkraise()
self.click_selection()
def update_annotation(self, image, shape_type):
logging.info("clicked annotation: ")