From cc0347336103d78465f03605f6d2daa90606e7a6 Mon Sep 17 00:00:00 2001 From: Ruben van de Ven Date: Mon, 8 Apr 2019 12:48:59 +0200 Subject: [PATCH] Show breadcrumbs again on selected Hugvey in interface --- hugvey/central_command.py | 8 ++++---- hugvey/client.py | 2 +- hugvey/panopticon.py | 10 +++++----- www/js/hugvey_console.js | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hugvey/central_command.py b/hugvey/central_command.py index 7358900..ab5707c 100644 --- a/hugvey/central_command.py +++ b/hugvey/central_command.py @@ -100,7 +100,7 @@ class CentralCommand(object): self.languages[lang['code']] = json.load(fp) - def getHugveyStatus(self, hv_id): + def getHugveyStatus(self, hv_id, isSelected = False): status = {'id': hv_id} if not hv_id in self.hugveys: status['status'] = 'off' @@ -115,13 +115,13 @@ class CentralCommand(object): status['language'] = hv.language_code status['msg'] = hv.story.currentMessage.id if hv.story.currentMessage else None status['finished'] = hv.story.isFinished() - status['history'] = {} + status['history'] = {} if isSelected is False else hv.story.getLogSummary() # status['history'] = hv.story.getLogSummary() # disabled as it is a bit slow. We now have eventLog status['counts'] = {t: len(a) for t, a in status['history'].items() if t != 'directions' } return status - def getStatusSummary(self): + def getStatusSummary(self, selected_id = None): status = { 'uptime': time.time() - self.start_time, 'languages': self.config['languages'], @@ -130,7 +130,7 @@ class CentralCommand(object): } for hv_id in self.hugvey_ids: - status['hugveys'].append(self.getHugveyStatus(hv_id)) + status['hugveys'].append(self.getHugveyStatus(hv_id, selected_id == hv_id)) return status diff --git a/hugvey/client.py b/hugvey/client.py index dca13b5..f8f59f7 100644 --- a/hugvey/client.py +++ b/hugvey/client.py @@ -201,7 +201,7 @@ class CommandHandler(object): self.playPopen = None if returnCode: - logger.warn("Had returncode on play: {}".format(returnCode)) + logger.critical("Had returncode on play: {}".format(returnCode)) else: logger.debug( "Finished playback. Return code: {}".format(returnCode)) diff --git a/hugvey/panopticon.py b/hugvey/panopticon.py index 4f34ae4..414b2df 100644 --- a/hugvey/panopticon.py +++ b/hugvey/panopticon.py @@ -51,7 +51,7 @@ def getWebSocketHandler(central_command): if msg['action'] == 'init': self.msgInit() elif msg['action'] == 'get_status': - self.msgStatus() + self.msgStatus(msg['selected_id']) elif msg['action'] == 'resume': self.msgResume(msg['hugvey']) elif msg['action'] == 'pause': @@ -80,14 +80,14 @@ def getWebSocketHandler(central_command): WebSocketHandler.connections.remove(self) logger.info("Client disconnected") - def getStatusMsg(self): - msg = central_command.getStatusSummary() + def getStatusMsg(self, selected_id = False): + msg = central_command.getStatusSummary(selected_id) msg['action'] = 'status' return msg - def msgStatus(self): - self.send(self.getStatusMsg()) + def msgStatus(self, selected_id = None): + self.send(self.getStatusMsg(selected_id)) def msgInit(self): msg = self.getStatusMsg() diff --git a/www/js/hugvey_console.js b/www/js/hugvey_console.js index ddee489..28bc1f0 100644 --- a/www/js/hugvey_console.js +++ b/www/js/hugvey_console.js @@ -233,7 +233,7 @@ class Panopticon { getStatus() { // console.log('get status', this, panopticon); - panopticon.send( { action: 'get_status' } ); + panopticon.send( { action: 'get_status', selected_id: panopticon.hugveys.selectedId } ); } init() {