Fix #90 - Show future language in panopticon
This commit is contained in:
parent
cc1d33c831
commit
ecec82b617
4 changed files with 19 additions and 7 deletions
|
@ -137,6 +137,8 @@ class CentralCommand(object):
|
||||||
with open(lang_filename, 'r') as fp:
|
with open(lang_filename, 'r') as fp:
|
||||||
self.languages[lang['code']] = json.load(fp)
|
self.languages[lang['code']] = json.load(fp)
|
||||||
|
|
||||||
|
self.future_language = list(self.languages.keys())[0]
|
||||||
|
|
||||||
def loadLightMap(self):
|
def loadLightMap(self):
|
||||||
if os.path.exists(self.lightMapFile):
|
if os.path.exists(self.lightMapFile):
|
||||||
with open(self.lightMapFile) as fp:
|
with open(self.lightMapFile) as fp:
|
||||||
|
@ -241,7 +243,8 @@ class CentralCommand(object):
|
||||||
'hugveys': [],
|
'hugveys': [],
|
||||||
'logbookId': None,
|
'logbookId': None,
|
||||||
'logbook': [],
|
'logbook': [],
|
||||||
'starts_since_lang_change': self.getHugveyStartsSinceLanguageChange()
|
'starts_since_lang_change': self.getHugveyStartsSinceLanguageChange(),
|
||||||
|
'future_language': self.future_language,
|
||||||
}
|
}
|
||||||
|
|
||||||
#use this to test if any threads stay open
|
#use this to test if any threads stay open
|
||||||
|
@ -272,6 +275,16 @@ class CentralCommand(object):
|
||||||
nrOfStarts += 1
|
nrOfStarts += 1
|
||||||
return nrOfStarts
|
return nrOfStarts
|
||||||
|
|
||||||
|
def setFutureLanguage(self, lang_code):
|
||||||
|
"""
|
||||||
|
Set language for all future hugvey runs (so after a 'finish')
|
||||||
|
"""
|
||||||
|
self.timer.setMark('languageChange')
|
||||||
|
self.future_language = lang_code
|
||||||
|
for hv_id in self.hugveys:
|
||||||
|
if self.hugveys[hv_id].eventQueue:
|
||||||
|
self.hugveys[hv_id].eventQueue.put_nowait({'event': 'change_language_if_available', 'lang_code': lang_code})
|
||||||
|
|
||||||
def setLoopTime(self, secondsAgo: int):
|
def setLoopTime(self, secondsAgo: int):
|
||||||
self.timer.setMark('start', time.time() - secondsAgo)
|
self.timer.setMark('start', time.time() - secondsAgo)
|
||||||
|
|
||||||
|
|
|
@ -150,10 +150,7 @@ def getWebSocketHandler(central_command):
|
||||||
"""
|
"""
|
||||||
Set language for all future hugvey runs (so after a 'finish')
|
Set language for all future hugvey runs (so after a 'finish')
|
||||||
"""
|
"""
|
||||||
central_command.timer.setMark('languageChange')
|
central_command.setFutureLanguage(lang_code)
|
||||||
for hv_id in central_command.hugveys:
|
|
||||||
if central_command.hugveys[hv_id].eventQueue:
|
|
||||||
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'change_language_if_available', 'lang_code': lang_code})
|
|
||||||
|
|
||||||
def msgSetLoopTime(self, loop_time):
|
def msgSetLoopTime(self, loop_time):
|
||||||
parts = loop_time.split(":")
|
parts = loop_time.split(":")
|
||||||
|
|
|
@ -16,13 +16,13 @@
|
||||||
<div id="interface" class='showStatus'>
|
<div id="interface" class='showStatus'>
|
||||||
<div id='status'>
|
<div id='status'>
|
||||||
<div id='overview'>
|
<div id='overview'>
|
||||||
<span class="loop_time" onclick="document.getElementById('time_update').classList.toggle('visible')">{{loop_timer}}</span> (up: {{uptime}})
|
<span class="loop_time" title="uptime: {{uptime}}" onclick="document.getElementById('time_update').classList.toggle('visible')">{{loop_timer}}</span>
|
||||||
<div id='time_update'>
|
<div id='time_update'>
|
||||||
<input type="text" value="00:00:00" name="loop_time_value" id="loop_time_value" />
|
<input type="text" value="00:00:00" name="loop_time_value" id="loop_time_value" />
|
||||||
<input type="button" onclick="panopticon.change_loop_time(document.getElementById('loop_time_value').value)" value="set time">
|
<input type="button" onclick="panopticon.change_loop_time(document.getElementById('loop_time_value').value)" value="set time">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span title="Conversations started since last language change">{{starts_since_lang_change}}</span>
|
<span title="Conversations started since last language change">{{future_language}}: {{starts_since_lang_change}}</span>
|
||||||
|
|
||||||
|
|
||||||
<ul id='languages'>
|
<ul id='languages'>
|
||||||
|
|
|
@ -20,6 +20,7 @@ class Panopticon {
|
||||||
blockedHugveys: 0,
|
blockedHugveys: 0,
|
||||||
availableHugveys: 0,
|
availableHugveys: 0,
|
||||||
starts_since_lang_change: 0,
|
starts_since_lang_change: 0,
|
||||||
|
future_language: 0,
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
time_passed: function( hugvey, property ) {
|
time_passed: function( hugvey, property ) {
|
||||||
|
@ -185,6 +186,7 @@ class Panopticon {
|
||||||
this.hugveys.logbook = msg['logbook'];
|
this.hugveys.logbook = msg['logbook'];
|
||||||
this.hugveys.logbookId = msg['logbookId'];
|
this.hugveys.logbookId = msg['logbookId'];
|
||||||
this.hugveys.starts_since_lang_change = msg['starts_since_lang_change'];
|
this.hugveys.starts_since_lang_change = msg['starts_since_lang_change'];
|
||||||
|
this.hugveys.future_language = msg['future_language'];
|
||||||
if(this.hugveys.selectedId) {
|
if(this.hugveys.selectedId) {
|
||||||
this.updateSelectedHugvey();
|
this.updateSelectedHugvey();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue