Allow setting the time in the loop fix #64
This commit is contained in:
parent
1e76c44862
commit
6c7e657f81
6 changed files with 49 additions and 4 deletions
|
@ -171,6 +171,9 @@ class CentralCommand(object):
|
|||
|
||||
return status
|
||||
|
||||
def setLoopTime(self, secondsAgo: int):
|
||||
self.timer.setMark('start', time.time() - secondsAgo)
|
||||
|
||||
def commandHugvey(self, hv_id, msg):
|
||||
"""
|
||||
prepare command to be picked up by the sender
|
||||
|
|
|
@ -75,6 +75,8 @@ def getWebSocketHandler(central_command):
|
|||
self.msgChangeLightStatus(msg['hugvey'], bool(msg['light_status']))
|
||||
elif msg['action'] == 'play_msg':
|
||||
self.msgPlayMsg(msg['hugvey'], msg['msg_id'], msg['reloadStory'])
|
||||
elif msg['action'] == 'loop_time':
|
||||
self.msgSetLoopTime(msg['time'])
|
||||
else:
|
||||
# self.send({'alert': 'Unknown request: {}'.format(message)})
|
||||
logger.warn('Unknown request: {}'.format(message))
|
||||
|
@ -135,6 +137,20 @@ def getWebSocketHandler(central_command):
|
|||
def msgChangeLanguage(self, hv_id, lang_code):
|
||||
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'change_language', 'lang_code': lang_code})
|
||||
|
||||
def msgSetLoopTime(self, loop_time):
|
||||
parts = loop_time.split(":")
|
||||
if len(parts) == 2:
|
||||
h, m = parts
|
||||
s = 0
|
||||
elif len(parts) == 3:
|
||||
h, m, s = parts
|
||||
else:
|
||||
logger.critical(f"Invalid time to set: {loop_time}")
|
||||
return
|
||||
|
||||
seconds = int(h)*3600+int(m)*60+int(s)
|
||||
central_command.setLoopTime(seconds)
|
||||
|
||||
def msgChangeLightId(self, hv_id, lightId):
|
||||
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'change_light', 'light_id': lightId})
|
||||
|
||||
|
|
|
@ -370,3 +370,11 @@ body.showTimeline #toggleTimeline {
|
|||
font-weight: bold; }
|
||||
#variables .name::after {
|
||||
content: " - "; }
|
||||
|
||||
.loop_time {
|
||||
cursor: pointer; }
|
||||
|
||||
#time_update {
|
||||
display: none; }
|
||||
#time_update.visible {
|
||||
display: block; }
|
||||
|
|
|
@ -16,10 +16,12 @@
|
|||
<div id="interface" class='showStatus'>
|
||||
<div id='status'>
|
||||
<div id='overview'>
|
||||
<dl>
|
||||
<dt>Timer</dt>
|
||||
<dd>{{loop_timer}} (up: {{uptime}})</dd>
|
||||
</dl>
|
||||
<span class="loop_time" onclick="document.getElementById('time_update').classList.toggle('visible')">{{loop_timer}}</span> (up: {{uptime}})
|
||||
<div id='time_update'>
|
||||
<input type="time" step="1" 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">
|
||||
</div>
|
||||
|
||||
|
||||
<ul id='languages'>
|
||||
<li v-for="lang in languages" :title="lang.file"
|
||||
|
|
|
@ -148,6 +148,11 @@ class Panopticon {
|
|||
this.send({ action: 'selection', selected_id: hv_id });
|
||||
}
|
||||
|
||||
change_loop_time(newTime) {
|
||||
console.log('update', newTime);
|
||||
this.send({ action: 'loop_time', time: newTime });
|
||||
}
|
||||
|
||||
updateSelectedHugvey() {
|
||||
let hv = null;
|
||||
|
||||
|
|
|
@ -598,3 +598,14 @@ img.icon{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.loop_time{
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
#time_update{
|
||||
display:none;
|
||||
&.visible{
|
||||
display:block;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue