pygui close mobility players when stopping session

This commit is contained in:
Blake Harnden 2020-05-03 21:55:34 -07:00
parent 4ec6ef25fe
commit 0e08242128
3 changed files with 8 additions and 4 deletions

View file

@ -111,13 +111,16 @@ class CoreClient:
self.links.clear() self.links.clear()
self.hooks.clear() self.hooks.clear()
self.emane_config = None self.emane_config = None
for mobility_player in self.mobility_players.values(): self.close_mobility_players()
mobility_player.handle_close()
self.mobility_players.clear() self.mobility_players.clear()
# clear streams # clear streams
self.cancel_throughputs() self.cancel_throughputs()
self.cancel_events() self.cancel_events()
def close_mobility_players(self):
for mobility_player in self.mobility_players.values():
mobility_player.close()
def set_observer(self, value: str): def set_observer(self, value: str):
self.observer = value self.observer = value

View file

@ -37,7 +37,7 @@ class MobilityPlayer:
self.dialog = MobilityPlayerDialog( self.dialog = MobilityPlayerDialog(
self.master, self.app, self.canvas_node, self.config self.master, self.app, self.canvas_node, self.config
) )
self.dialog.protocol("WM_DELETE_WINDOW", self.handle_close) self.dialog.protocol("WM_DELETE_WINDOW", self.close)
if self.state == MobilityAction.START: if self.state == MobilityAction.START:
self.set_play() self.set_play()
elif self.state == MobilityAction.PAUSE: elif self.state == MobilityAction.PAUSE:
@ -46,7 +46,7 @@ class MobilityPlayer:
self.set_stop() self.set_stop()
self.dialog.show() self.dialog.show()
def handle_close(self): def close(self):
if self.dialog: if self.dialog:
self.dialog.destroy() self.dialog.destroy()
self.dialog = None self.dialog = None

View file

@ -448,6 +448,7 @@ class Toolbar(ttk.Frame):
""" """
logging.info("clicked stop button") logging.info("clicked stop button")
self.app.menubar.change_menubar_item_state(is_runtime=False) self.app.menubar.change_menubar_item_state(is_runtime=False)
self.app.core.close_mobility_players()
task = ProgressTask( task = ProgressTask(
self.app, "Stop", self.app.core.stop_session, self.stop_callback self.app, "Stop", self.app.core.stop_session, self.stop_callback
) )