aboutsummaryrefslogtreecommitdiff
path: root/macropad.pyw
diff options
context:
space:
mode:
Diffstat (limited to 'macropad.pyw')
-rwxr-xr-xmacropad.pyw9
1 files changed, 6 insertions, 3 deletions
diff --git a/macropad.pyw b/macropad.pyw
index 55bb1cf..87dfd40 100755
--- a/macropad.pyw
+++ b/macropad.pyw
@@ -191,8 +191,9 @@ class Application(object):
return
self.last_layout = data
+ conn = component.queryUtility(interfaces.endpoint.IEndpoint)
if isinstance(data, dict):
- component.queryUtility(interfaces.endpoint.IEndpoint).send(data)
+ conn.send(data)
return
elif isinstance(data, str):
if not path.exists(data):
@@ -203,7 +204,7 @@ class Application(object):
j = json.loads(json_data)
content = json.dumps(j)
- component.queryUtility(interfaces.endpoint.IEndpoint).send(j)
+ conn.send(j)
def associate(self, layout: str, name: str):
mapping[name] = layout
@@ -218,8 +219,10 @@ class Application(object):
component.handle(Debug("Reconnecting…"))
conn.state = conn.STATE_CONNECTING
- self.window.after(5000, conn.connect)
+ self.window.after(1000, conn.connect)
else:
+ # Check if we have something to read from the server, and by
+ # the by if the server is still active.
conn.fetch()
except Exception as e:
component.handle(Debug( str(e) ))