updated start proto to return exception strings, updated grpc start session to exist early when a failure is found, updated coretk ui to not switch ui to running when start fails and display error dialog
This commit is contained in:
parent
5639aeab75
commit
6d68034177
8 changed files with 70 additions and 36 deletions
|
@ -6,6 +6,7 @@ import logging
|
|||
import os
|
||||
import time
|
||||
from pathlib import Path
|
||||
from tkinter import messagebox
|
||||
|
||||
import grpc
|
||||
|
||||
|
@ -476,21 +477,31 @@ class CoreClient:
|
|||
file_configs,
|
||||
asymmetric_links,
|
||||
)
|
||||
self.set_metadata()
|
||||
process_time = time.perf_counter() - start
|
||||
logging.debug(
|
||||
"start session(%s), result: %s", self.session_id, response.result
|
||||
)
|
||||
self.app.statusbar.start_session_callback(process_time)
|
||||
process_time = time.perf_counter() - start
|
||||
|
||||
# display mobility players
|
||||
for node_id, config in self.mobility_configs.items():
|
||||
canvas_node = self.canvas_nodes[node_id]
|
||||
mobility_player = MobilityPlayer(
|
||||
self.app, self.app, canvas_node, config
|
||||
)
|
||||
mobility_player.show()
|
||||
self.mobility_players[node_id] = mobility_player
|
||||
# stop progress bar and update status
|
||||
self.app.statusbar.progress_bar.stop()
|
||||
message = f"Start ran for {process_time:.3f} seconds"
|
||||
self.app.statusbar.set_status(message)
|
||||
|
||||
if response.result:
|
||||
self.set_metadata()
|
||||
self.app.toolbar.set_runtime()
|
||||
|
||||
# display mobility players
|
||||
for node_id, config in self.mobility_configs.items():
|
||||
canvas_node = self.canvas_nodes[node_id]
|
||||
mobility_player = MobilityPlayer(
|
||||
self.app, self.app, canvas_node, config
|
||||
)
|
||||
mobility_player.show()
|
||||
self.mobility_players[node_id] = mobility_player
|
||||
else:
|
||||
message = "\n".join(response.exceptions)
|
||||
messagebox.showerror("Start Error", message)
|
||||
except grpc.RpcError as e:
|
||||
show_grpc_error(e)
|
||||
|
||||
|
|
|
@ -68,10 +68,9 @@ class StatusBar(ttk.Frame):
|
|||
dialog = AlertsDialog(self.app, self.app)
|
||||
dialog.show()
|
||||
|
||||
def start_session_callback(self, process_time):
|
||||
self.progress_bar.stop()
|
||||
self.statusvar.set(f"Session started in {process_time:.3f} seconds")
|
||||
def set_status(self, message):
|
||||
self.statusvar.set(message)
|
||||
|
||||
def stop_session_callback(self, cleanup_time):
|
||||
self.progress_bar.stop()
|
||||
self.statusvar.set(f"Stopped session in {cleanup_time:.3f} seconds")
|
||||
self.statusvar.set(f"Stopped in {cleanup_time:.3f} seconds")
|
||||
|
|
|
@ -236,11 +236,12 @@ 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
|
||||
thread = threading.Thread(target=self.app.core.start_session)
|
||||
thread.start()
|
||||
|
||||
def set_runtime(self):
|
||||
self.runtime_frame.tkraise()
|
||||
self.click_runtime_selection()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue