ws: fix issue that made buttons busy forever fixes #1087 (#1266)

* ws: fix issue that made buttons busy forever fixes #1087

* ws: reduce to high_idle due to touch not as responsive

* ws: make string translatable

* less animation steps for the spinner

the slower spinning gear icon is actually more pleasant to look
This commit is contained in:
Alfredo Monclus 2024-02-18 17:26:08 -03:00 committed by GitHub
parent 0fd8f90943
commit d9a361cacc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 5 deletions

View File

@ -111,13 +111,13 @@ class KlippyWebsocket(threading.Thread):
self.callback_table[response['id']][1],
self.callback_table[response['id']][2],
*self.callback_table[response['id']][3])
GLib.idle_add(self.callback_table[response['id']][0], *args)
GLib.idle_add(self.callback_table[response['id']][0], *args, priority=GLib.PRIORITY_HIGH_IDLE)
self.callback_table.pop(response['id'])
return
if "method" in response and "on_message" in self._callback:
args = response['method'], response['params'][0] if "params" in response else {}
GLib.idle_add(self._callback['on_message'], *args)
args = (response['method'], response['params'][0] if "params" in response else {})
GLib.idle_add(self._callback['on_message'], *args, priority=GLib.PRIORITY_HIGH_IDLE)
return
def send_method(self, method, params=None, callback=None, *args):
@ -146,7 +146,7 @@ class KlippyWebsocket(threading.Thread):
self._screen.reinit_count = 0
self.reconnect_count = 0
if "on_connect" in self._callback:
GLib.idle_add(self._callback['on_connect'])
GLib.idle_add(self._callback['on_connect'], priority=GLib.PRIORITY_HIGH_IDLE)
def on_close(self, *args):
# args: ws, status, message
@ -164,7 +164,9 @@ class KlippyWebsocket(threading.Thread):
self.closing = False
return
if "on_close" in self._callback:
GLib.idle_add(self._callback['on_close'], "Lost Connection to Moonraker")
GLib.idle_add(self._callback['on_close'],
_("Lost Connection to Moonraker"),
priority=GLib.PRIORITY_HIGH_IDLE)
logging.info("Moonraker Websocket Closed")
self.connected = False

View File

@ -247,6 +247,10 @@ undershoot.bottom {
background-image: none;
}
spinner {
animation-timing-function: steps(10);
}
separator {
margin: 1em 2em;
background-color: rgba(255, 255, 255, 0.5);