loading xml set canvas state to select mode and display that on toolbar

This commit is contained in:
Huy Pham 2019-12-09 08:53:54 -08:00
parent 2add215704
commit 456e331870
4 changed files with 16 additions and 25 deletions

View file

@ -94,6 +94,7 @@ class CoreClient:
self.service_configs = {} self.service_configs = {}
self.file_configs = {} self.file_configs = {}
self.mobility_players = {} self.mobility_players = {}
self.throughput = False
def reset(self): def reset(self):
# helpers # helpers
@ -186,22 +187,11 @@ class CoreClient:
canvas_node.move(x, y, update=False) canvas_node.move(x, y, update=False)
def handle_throughputs(self, event): def handle_throughputs(self, event):
# interface_throughputs = event.interface_throughputs # print(event.interface_throughputs)
# # print(interface_throughputs) if self.throughput:
# # return self.app.canvas.throughput_draw.process_grpc_throughput_event(
# # for i in interface_throughputs: event.interface_throughputs
# # print("") )
# # # return
# print(event)
# throughputs_belong_to_session = []
# print(self.node_ids)
# for throughput in interface_throughputs:
# if throughput.node_id in self.node_ids:
# throughputs_belong_to_session.append(throughput)
# print(throughputs_belong_to_session)
self.app.canvas.throughput_draw.process_grpc_throughput_event(
event.interface_throughputs
)
def join_session(self, session_id, query_location=True): def join_session(self, session_id, query_location=True):
# update session and title # update session and title
@ -296,6 +286,7 @@ class CoreClient:
self.app.toolbar.runtime_frame.tkraise() self.app.toolbar.runtime_frame.tkraise()
else: else:
self.app.toolbar.design_frame.tkraise() self.app.toolbar.design_frame.tkraise()
self.app.toolbar.select_button.invoke()
self.app.statusbar.progress_bar.stop() self.app.statusbar.progress_bar.stop()
def is_runtime(self): def is_runtime(self):
@ -432,14 +423,6 @@ class CoreClient:
) )
process_time = time.perf_counter() - start process_time = time.perf_counter() - start
logging.debug("start session(%s), result: %s", self.session_id, response.result) logging.debug("start session(%s), result: %s", self.session_id, response.result)
# # print(self.client.get_node_service(self.session_id, 1, "DefaultRoute"))
# # print(self.client.set_service_defaults(self.session_id, {"router": ["DefaultRouter"]}))
# print(self.client.set_node_service(self.session_id, 1, "DefaultRoute", ["echo hello"], [], []))
#
# # print(self.client.get_service_defaults(self.session_id))
#
# # print(self.client.get_node_service(self.session_id, 1, "DefaultRoute"))
# # print(self.client.get_node_service_file(self.session_id, 1, "DefaultRoute", "defaultroute.sh"))
self.app.statusbar.start_session_callback(process_time) self.app.statusbar.start_session_callback(process_time)
# display mobility players # display mobility players

View file

@ -77,6 +77,7 @@ class CanvasGraph(tk.Canvas):
# set the private variables to default value # set the private variables to default value
self.mode = GraphMode.SELECT self.mode = GraphMode.SELECT
self.annotation_type = None
self.node_draw = None self.node_draw = None
self.selected = None self.selected = None
self.nodes.clear() self.nodes.clear()

View file

@ -156,3 +156,10 @@ class MenuAction:
def show_about(self): def show_about(self):
dialog = AboutDialog(self.app, self.app) dialog = AboutDialog(self.app, self.app)
dialog.show() dialog.show()
def throughput(self):
throughput = self.app.core.throughput
if throughput:
self.app.core.throughput = False
else:
self.app.core.throughput = True

View file

@ -422,7 +422,7 @@ class Menubar(tk.Menu):
menu = tk.Menu(self) menu = tk.Menu(self)
self.create_observer_widgets_menu(menu) self.create_observer_widgets_menu(menu)
self.create_adjacency_menu(menu) self.create_adjacency_menu(menu)
menu.add_command(label="Throughput", state=tk.DISABLED) menu.add_checkbutton(label="Throughput", command=self.menuaction.throughput)
menu.add_separator() menu.add_separator()
menu.add_command(label="Configure Adjacency...", state=tk.DISABLED) menu.add_command(label="Configure Adjacency...", state=tk.DISABLED)
menu.add_command(label="Configure Throughput...", state=tk.DISABLED) menu.add_command(label="Configure Throughput...", state=tk.DISABLED)