[modules/spaceapi] Reload on left mouse button

Signed-off-by: Tobias Manske <tobias.manske@mailbox.org>
This commit is contained in:
Tobias Manske 2019-01-06 22:57:25 +01:00
parent e95652fc05
commit 54024f1ddd
No known key found for this signature in database
GPG key ID: 978D99F12D4E041F

View file

@ -26,7 +26,7 @@ def formatStringBuilder(s: str, json: dict) -> str:
This function seems to be in dire need of some explanation so here it is: This function seems to be in dire need of some explanation so here it is:
It basically searches the format string for strings of the pattern It basically searches the format string for strings of the pattern
%%ITEM.IN.TREE[%IFTRUE%IFFALSE]%%. For example to query the state of %%ITEM.IN.TREE[%IFTRUE%IFFALSE]%%. For example to query the state of
the space you'd write %%state.open%% as it's located in json[state][open] the hackspace you'd write %%state.open%% as it's located in json[state][open]
according to the API specificaion. As the output of true or false doesn't according to the API specificaion. As the output of true or false doesn't
look to great you can specify the text you want to have shown so you'd look to great you can specify the text you want to have shown so you'd
write %%state.open%Open%Closed%% to overwrite true/false with Open/Closed. write %%state.open%Open%Closed%% to overwrite true/false with Open/Closed.
@ -59,6 +59,9 @@ class Module(bumblebee.engine.Module):
engine, config, bumblebee.output.Widget(full_text=self.getState) engine, config, bumblebee.output.Widget(full_text=self.getState)
) )
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
cmd=self.__forceReload)
self._data = {} self._data = {}
self._error = None self._error = None
@ -112,6 +115,10 @@ class Module(bumblebee.engine.Module):
except JSONDecodeError: except JSONDecodeError:
self._error = "Not a JSON response" self._error = "Not a JSON response"
# left_mouse_button handler
def __forceReload(self, event):
self._threadingCount += 300
self._error = "RELOADING"
# Author: Tobias Manske <tobias@chaoswg.xyz> # Author: Tobias Manske <tobias@chaoswg.xyz>
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4