aboutsummaryrefslogtreecommitdiff
path: root/interfaces
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2025-05-06 19:33:30 +0200
committerSébastien Dailly <sebastien@dailly.me>2025-05-06 19:33:30 +0200
commit4bf1c1ffe795a1d28a543a20cc3771a30a090b89 (patch)
tree09e1bb81744be02fd3a8422f9002ec3139f54100 /interfaces
parent0d037fd1170ecc30cea677f563dfb50dff7360c6 (diff)
Added a dedicated thread for handling events sent to the endpoint
Diffstat (limited to 'interfaces')
-rw-r--r--interfaces/configuration.py14
-rwxr-xr-xinterfaces/endpoint.py5
2 files changed, 17 insertions, 2 deletions
diff --git a/interfaces/configuration.py b/interfaces/configuration.py
new file mode 100644
index 0000000..9449f41
--- /dev/null
+++ b/interfaces/configuration.py
@@ -0,0 +1,14 @@
+from zope import interface
+from zope.interface import Attribute
+
+from typing import Dict
+
+class IConfiguration(interface.Interface):
+
+ def get(self, key : str, default) -> Dict:
+ """ Load the mapping for a given key
+ """
+
+ def __setitem__(self, key : str, value : Dict) -> None:
+ """ Set a value
+ """
diff --git a/interfaces/endpoint.py b/interfaces/endpoint.py
index 2d77b66..4da7c57 100755
--- a/interfaces/endpoint.py
+++ b/interfaces/endpoint.py
@@ -47,6 +47,7 @@ from zope import component
import json
from interfaces.message import IMessage, Debug
+from consumer import Mapping
@component.adapter(IConnection)
@interface.implementer(IEndpoint)
@@ -74,7 +75,7 @@ class EndPoint(object):
# This is the first connection
# Otherwise the state should be STATE_CONNECTING
# Initialize with the default layer
- self.queue.put ( ("default", None) )
+ component.handle(Mapping(("default", None)))
except Exception as e:
print(e)
@@ -103,7 +104,7 @@ class EndPoint(object):
title = desktop.getForegroundWindowTitle()
else:
title = None
- self.queue.put((layout, title))
+ component.handle(Mapping((layout, title)))
def send(self, data: list[dict[str, str]]):
""" Send the data to the endpoint. The data must be the representation