Merge branch 'coretk' into coretk-color
This commit is contained in:
commit
3ceb5cde3e
6 changed files with 58 additions and 24 deletions
|
@ -84,7 +84,8 @@ class CoreClient:
|
|||
self.service_configs = {}
|
||||
self.file_configs = {}
|
||||
self.mobility_players = {}
|
||||
self.throughput = False
|
||||
self.handling_throughputs = None
|
||||
self.handling_events = None
|
||||
|
||||
def reset(self):
|
||||
# helpers
|
||||
|
@ -101,6 +102,13 @@ class CoreClient:
|
|||
self.service_configs.clear()
|
||||
self.file_configs.clear()
|
||||
self.mobility_players.clear()
|
||||
# clear streams
|
||||
if self.handling_throughputs:
|
||||
self.handling_throughputs.cancel()
|
||||
self.handling_throughputs = None
|
||||
if self.handling_events:
|
||||
self.handling_events.cancel()
|
||||
self.handling_events = None
|
||||
|
||||
def set_observer(self, value):
|
||||
self.observer = value
|
||||
|
@ -176,11 +184,22 @@ class CoreClient:
|
|||
canvas_node = self.canvas_nodes[node_id]
|
||||
canvas_node.move(x, y)
|
||||
|
||||
def enable_throughputs(self):
|
||||
self.handling_throughputs = self.client.throughputs(
|
||||
self.session_id, self.handle_throughputs
|
||||
)
|
||||
|
||||
def cancel_throughputs(self):
|
||||
self.handling_throughputs.cancel()
|
||||
self.handling_throughputs = None
|
||||
|
||||
def handle_throughputs(self, event):
|
||||
if self.throughput:
|
||||
self.app.canvas.throughput_draw.process_grpc_throughput_event(
|
||||
event.interface_throughputs
|
||||
)
|
||||
if event.session_id != self.session_id:
|
||||
return
|
||||
logging.info("handling throughputs event: %s", event)
|
||||
self.app.canvas.throughput_draw.process_grpc_throughput_event(
|
||||
event.interface_throughputs
|
||||
)
|
||||
|
||||
def handle_exception_event(self, event):
|
||||
logging.info("exception event: %s", event)
|
||||
|
@ -199,8 +218,9 @@ class CoreClient:
|
|||
response = self.client.get_session(self.session_id)
|
||||
session = response.session
|
||||
self.state = session.state
|
||||
self.client.events(self.session_id, self.handle_events)
|
||||
self.client.throughputs(self.handle_throughputs)
|
||||
self.handling_events = self.client.events(
|
||||
self.session_id, self.handle_events
|
||||
)
|
||||
|
||||
# get location
|
||||
if query_location:
|
||||
|
|
|
@ -151,8 +151,7 @@ class MenuAction:
|
|||
dialog.show()
|
||||
|
||||
def throughput(self):
|
||||
throughput = self.app.core.throughput
|
||||
if throughput:
|
||||
self.app.core.throughput = False
|
||||
if not self.app.core.handling_throughputs:
|
||||
self.app.core.enable_throughputs()
|
||||
else:
|
||||
self.app.core.throughput = True
|
||||
self.app.core.cancel_throughputs()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue