diff options
Diffstat (limited to 'interfaces/endpoint.py')
-rwxr-xr-x | interfaces/endpoint.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/interfaces/endpoint.py b/interfaces/endpoint.py index 2fbf792..2d77b66 100755 --- a/interfaces/endpoint.py +++ b/interfaces/endpoint.py @@ -65,10 +65,17 @@ class EndPoint(object): return self.state != self.STATE_DISCONNECTED
def connect(self):
+ state = self.state
try:
self.connection.connect()
self.state = self.STATE_CONNECTED
component.handle(Debug("Connected"))
+ if state == self.STATE_DISCONNECTED:
+ # This is the first connection
+ # Otherwise the state should be STATE_CONNECTING
+ # Initialize with the default layer
+ self.queue.put ( ("default", None) )
+
except Exception as e:
print(e)
self.state = self.STATE_DISCONNECTED
@@ -90,7 +97,6 @@ class EndPoint(object): # If we do not have any entry from the macropad, just return
return
- print("recv", received)
layout = str(received, "utf-8").strip()
desktop = component.queryUtility(desktopEvent.IDesktop)
if desktop is not None:
@@ -100,7 +106,7 @@ class EndPoint(object): self.queue.put((layout, title))
def send(self, data: list[dict[str, str]]):
- """ Send the data to the macropad. The data must be the representation
+ """ Send the data to the endpoint. The data must be the representation
of a json element.
"""
if self.state != self.STATE_CONNECTED:
|