set to selection mode when starting/stopping a session as well as joining for runtime/design states
This commit is contained in:
parent
2a29cd1fe5
commit
afdacf0c94
2 changed files with 20 additions and 7 deletions
|
@ -298,10 +298,11 @@ class CoreClient:
|
||||||
# update ui to represent current state
|
# update ui to represent current state
|
||||||
if self.is_runtime():
|
if self.is_runtime():
|
||||||
self.app.toolbar.runtime_frame.tkraise()
|
self.app.toolbar.runtime_frame.tkraise()
|
||||||
|
self.app.toolbar.click_runtime_selection()
|
||||||
else:
|
else:
|
||||||
self.app.toolbar.design_frame.tkraise()
|
self.app.toolbar.design_frame.tkraise()
|
||||||
self.app.statusbar.progress_bar.stop()
|
|
||||||
self.app.toolbar.click_selection()
|
self.app.toolbar.click_selection()
|
||||||
|
self.app.statusbar.progress_bar.stop()
|
||||||
|
|
||||||
def is_runtime(self):
|
def is_runtime(self):
|
||||||
return self.state == core_pb2.SessionState.RUNTIME
|
return self.state == core_pb2.SessionState.RUNTIME
|
||||||
|
|
|
@ -40,6 +40,9 @@ class Toolbar(ttk.Frame):
|
||||||
self.network_button = None
|
self.network_button = None
|
||||||
self.annotation_button = None
|
self.annotation_button = None
|
||||||
|
|
||||||
|
# runtime buttons
|
||||||
|
self.runtime_select_button = None
|
||||||
|
|
||||||
# frames
|
# frames
|
||||||
self.design_frame = None
|
self.design_frame = None
|
||||||
self.runtime_frame = None
|
self.runtime_frame = None
|
||||||
|
@ -89,6 +92,11 @@ class Toolbar(ttk.Frame):
|
||||||
self.annotation_button.state(["!pressed"])
|
self.annotation_button.state(["!pressed"])
|
||||||
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):
|
def draw_runtime_frame(self):
|
||||||
self.runtime_frame = ttk.Frame(self)
|
self.runtime_frame = ttk.Frame(self)
|
||||||
self.runtime_frame.grid(row=0, column=0, sticky="nsew")
|
self.runtime_frame.grid(row=0, column=0, sticky="nsew")
|
||||||
|
@ -100,10 +108,10 @@ class Toolbar(ttk.Frame):
|
||||||
self.click_stop,
|
self.click_stop,
|
||||||
"stop the session",
|
"stop the session",
|
||||||
)
|
)
|
||||||
self.create_button(
|
self.runtime_select_button = self.create_button(
|
||||||
self.runtime_frame,
|
self.runtime_frame,
|
||||||
icon(ImageEnum.SELECT),
|
icon(ImageEnum.SELECT),
|
||||||
self.click_selection,
|
self.click_runtime_selection,
|
||||||
"selection tool",
|
"selection tool",
|
||||||
)
|
)
|
||||||
# self.create_observe_button()
|
# self.create_observe_button()
|
||||||
|
@ -188,6 +196,11 @@ class Toolbar(ttk.Frame):
|
||||||
self.design_select(self.select_button)
|
self.design_select(self.select_button)
|
||||||
self.app.canvas.mode = GraphMode.SELECT
|
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):
|
def click_start(self):
|
||||||
"""
|
"""
|
||||||
Start session handler redraw buttons, send node and link messages to grpc
|
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 = threading.Thread(target=self.app.core.start_session)
|
||||||
thread.start()
|
thread.start()
|
||||||
self.runtime_frame.tkraise()
|
self.runtime_frame.tkraise()
|
||||||
|
self.click_runtime_selection()
|
||||||
|
|
||||||
def click_link(self):
|
def click_link(self):
|
||||||
logging.debug("Click LINK button")
|
logging.debug("Click LINK button")
|
||||||
|
@ -355,11 +369,9 @@ class Toolbar(ttk.Frame):
|
||||||
self.app.statusbar.progress_bar.start(5)
|
self.app.statusbar.progress_bar.start(5)
|
||||||
thread = threading.Thread(target=self.app.core.stop_session)
|
thread = threading.Thread(target=self.app.core.stop_session)
|
||||||
thread.start()
|
thread.start()
|
||||||
for cid in self.app.canvas.find_withtag("wireless"):
|
self.app.canvas.delete("wireless")
|
||||||
self.app.canvas.itemconfig(cid, state="hidden")
|
|
||||||
# self.app.canvas.delete("wireless")
|
|
||||||
|
|
||||||
self.design_frame.tkraise()
|
self.design_frame.tkraise()
|
||||||
|
self.click_selection()
|
||||||
|
|
||||||
def update_annotation(self, image, shape_type):
|
def update_annotation(self, image, shape_type):
|
||||||
logging.info("clicked annotation: ")
|
logging.info("clicked annotation: ")
|
||||||
|
|
Loading…
Add table
Reference in a new issue