diff --git a/hugvey/central_command.py b/hugvey/central_command.py index 0487b63..7308a23 100644 --- a/hugvey/central_command.py +++ b/hugvey/central_command.py @@ -502,7 +502,7 @@ class HugveyState(object): def isAvailable(self): if self.command.config['story']['loop']: - if self.status == self.STATE_RUNNING and self.story: + if (self.status == self.STATE_RUNNING or self.status == self.STATE_PAUSE) and self.story: if self.story.currentMessage: if self.story.currentMessage.id == self.story.startMessage.id: return True @@ -639,6 +639,9 @@ class HugveyState(object): if event['event'] == 'change_language': self.setLanguage(event['lang_code']) + if event['event'] == 'change_language_if_available': + if self.isAvailable() or self.status == self.STATE_BLOCKED: + self.setLanguage(event['lang_code']) if event['event'] == 'change_light': self.setLightId(event['light_id']) if event['event'] == 'change_light_status': diff --git a/hugvey/panopticon.py b/hugvey/panopticon.py index f8c72aa..0ef6549 100644 --- a/hugvey/panopticon.py +++ b/hugvey/panopticon.py @@ -69,6 +69,8 @@ def getWebSocketHandler(central_command): self.msgFinish(msg['hugvey']) elif msg['action'] == 'change_language': self.msgChangeLanguage(msg['hugvey'], msg['lang_code']) + elif msg['action'] == 'change_language_for_available': + self.msgChangeLanguageForAllAvailableHugveys(msg['lang_code']) elif msg['action'] == 'change_light': self.msgChangeLightId(msg['hugvey'], int(msg['light_id'])) elif msg['action'] == 'change_light_status': @@ -137,6 +139,10 @@ 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 msgChangeLanguageForAllAvailableHugveys(self, lang_code): + for hv_id in central_command.hugveys: + central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'change_language_if_available', 'lang_code': lang_code}) + def msgSetLoopTime(self, loop_time): parts = loop_time.split(":") if len(parts) == 2: diff --git a/www/css/styles.css b/www/css/styles.css index acc7ff0..9d225e8 100644 --- a/www/css/styles.css +++ b/www/css/styles.css @@ -1,3 +1,19 @@ +@-webkit-keyframes sk-scaleout { + 0% { + -webkit-transform: scale(0); } + 100% { + -webkit-transform: scale(1); + opacity: 0; } } + +@keyframes sk-scaleout { + 0% { + -webkit-transform: scale(0); + transform: scale(0); } + 100% { + -webkit-transform: scale(1); + transform: scale(1); + opacity: 0; } } + body { font-family: "Noto Sans", sans-serif; margin: 0; @@ -67,9 +83,23 @@ img.icon { height: 200px; border: solid 1px; box-sizing: border-box; - position: relative; } + position: relative; + padding: 5px; } #status > div#overview { - width: 100% / 3; } + width: calc(100% / 3 * 2); } + #status > div#overview #languages { + color: #ccc; + list-style: none; + padding: 0; } + #status > div#overview #languages .loading:after { + display: inline-block; + content: ''; + width: 15px; + height: 15px; + background-color: white; + border-radius: 100%; + -webkit-animation: sk-scaleout 1.0s infinite ease-in-out; + animation: sk-scaleout 1.0s infinite ease-in-out; } #status .counts dd, #status .counts dt { display: inline-block; width: 30px; diff --git a/www/index.html b/www/index.html index b99b951..debcf50 100644 --- a/www/index.html +++ b/www/index.html @@ -25,9 +25,12 @@