From 54024f1dddb6c98bdaffc444b793066726e9061a Mon Sep 17 00:00:00 2001 From: Tobias Manske Date: Sun, 6 Jan 2019 22:57:25 +0100 Subject: [PATCH] [modules/spaceapi] Reload on left mouse button Signed-off-by: Tobias Manske --- bumblebee/modules/spaceapi.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bumblebee/modules/spaceapi.py b/bumblebee/modules/spaceapi.py index 89fd341..d4caf69 100644 --- a/bumblebee/modules/spaceapi.py +++ b/bumblebee/modules/spaceapi.py @@ -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: It basically searches the format string for strings of the pattern %%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 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. @@ -59,6 +59,9 @@ class Module(bumblebee.engine.Module): 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._error = None @@ -112,6 +115,10 @@ class Module(bumblebee.engine.Module): except JSONDecodeError: self._error = "Not a JSON response" + # left_mouse_button handler + def __forceReload(self, event): + self._threadingCount += 300 + self._error = "RELOADING" # Author: Tobias Manske # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4