Show breadcrumbs again on selected Hugvey in interface
This commit is contained in:
parent
c4f55c01c7
commit
cc03473361
4 changed files with 11 additions and 11 deletions
|
@ -100,7 +100,7 @@ class CentralCommand(object):
|
||||||
self.languages[lang['code']] = json.load(fp)
|
self.languages[lang['code']] = json.load(fp)
|
||||||
|
|
||||||
|
|
||||||
def getHugveyStatus(self, hv_id):
|
def getHugveyStatus(self, hv_id, isSelected = False):
|
||||||
status = {'id': hv_id}
|
status = {'id': hv_id}
|
||||||
if not hv_id in self.hugveys:
|
if not hv_id in self.hugveys:
|
||||||
status['status'] = 'off'
|
status['status'] = 'off'
|
||||||
|
@ -115,13 +115,13 @@ class CentralCommand(object):
|
||||||
status['language'] = hv.language_code
|
status['language'] = hv.language_code
|
||||||
status['msg'] = hv.story.currentMessage.id if hv.story.currentMessage else None
|
status['msg'] = hv.story.currentMessage.id if hv.story.currentMessage else None
|
||||||
status['finished'] = hv.story.isFinished()
|
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['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' }
|
status['counts'] = {t: len(a) for t, a in status['history'].items() if t != 'directions' }
|
||||||
|
|
||||||
return status
|
return status
|
||||||
|
|
||||||
def getStatusSummary(self):
|
def getStatusSummary(self, selected_id = None):
|
||||||
status = {
|
status = {
|
||||||
'uptime': time.time() - self.start_time,
|
'uptime': time.time() - self.start_time,
|
||||||
'languages': self.config['languages'],
|
'languages': self.config['languages'],
|
||||||
|
@ -130,7 +130,7 @@ class CentralCommand(object):
|
||||||
}
|
}
|
||||||
|
|
||||||
for hv_id in self.hugvey_ids:
|
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
|
return status
|
||||||
|
|
||||||
|
|
|
@ -201,7 +201,7 @@ class CommandHandler(object):
|
||||||
self.playPopen = None
|
self.playPopen = None
|
||||||
|
|
||||||
if returnCode:
|
if returnCode:
|
||||||
logger.warn("Had returncode on play: {}".format(returnCode))
|
logger.critical("Had returncode on play: {}".format(returnCode))
|
||||||
else:
|
else:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Finished playback. Return code: {}".format(returnCode))
|
"Finished playback. Return code: {}".format(returnCode))
|
||||||
|
|
|
@ -51,7 +51,7 @@ def getWebSocketHandler(central_command):
|
||||||
if msg['action'] == 'init':
|
if msg['action'] == 'init':
|
||||||
self.msgInit()
|
self.msgInit()
|
||||||
elif msg['action'] == 'get_status':
|
elif msg['action'] == 'get_status':
|
||||||
self.msgStatus()
|
self.msgStatus(msg['selected_id'])
|
||||||
elif msg['action'] == 'resume':
|
elif msg['action'] == 'resume':
|
||||||
self.msgResume(msg['hugvey'])
|
self.msgResume(msg['hugvey'])
|
||||||
elif msg['action'] == 'pause':
|
elif msg['action'] == 'pause':
|
||||||
|
@ -80,14 +80,14 @@ def getWebSocketHandler(central_command):
|
||||||
WebSocketHandler.connections.remove(self)
|
WebSocketHandler.connections.remove(self)
|
||||||
logger.info("Client disconnected")
|
logger.info("Client disconnected")
|
||||||
|
|
||||||
def getStatusMsg(self):
|
def getStatusMsg(self, selected_id = False):
|
||||||
msg = central_command.getStatusSummary()
|
msg = central_command.getStatusSummary(selected_id)
|
||||||
msg['action'] = 'status'
|
msg['action'] = 'status'
|
||||||
|
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
def msgStatus(self):
|
def msgStatus(self, selected_id = None):
|
||||||
self.send(self.getStatusMsg())
|
self.send(self.getStatusMsg(selected_id))
|
||||||
|
|
||||||
def msgInit(self):
|
def msgInit(self):
|
||||||
msg = self.getStatusMsg()
|
msg = self.getStatusMsg()
|
||||||
|
|
|
@ -233,7 +233,7 @@ class Panopticon {
|
||||||
|
|
||||||
getStatus() {
|
getStatus() {
|
||||||
// console.log('get status', this, panopticon);
|
// console.log('get status', this, panopticon);
|
||||||
panopticon.send( { action: 'get_status' } );
|
panopticon.send( { action: 'get_status', selected_id: panopticon.hugveys.selectedId } );
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
|
Loading…
Reference in a new issue