diff options
Diffstat (limited to 'win32.py')
-rw-r--r-- | win32.py | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -9,6 +9,7 @@ import win32gui import win32con
from zope import component
from interfaces.message import IMessage, Debug
+from consumer import Mapping
# This code tries to hook the Focus changes events with the callback method.
@@ -54,10 +55,9 @@ def setHook(WinEventProc, eventType): @interface.implementer(desktopEvent.IDesktop)
class Listener(object):
- def __init__(self, mapping: Dict[str, str], queue):
+ def __init__(self, mapping: Dict[str, str]):
self.WinEventProc = WinEventProcType(self.callback)
self.mapping = mapping
- self.queue = queue
def getForegroundWindowTitle(self) -> Optional[str]:
""" Get the window title name.
@@ -100,7 +100,7 @@ class Listener(object): if pattern == "default":
continue
if pattern in title:
- self.queue.put ( (code, None) )
+ component.handle(Mapping((code, None)))
return
# Get the default mapping to apply if there is any defined
# This only applies when the window raising the event is the main
@@ -114,7 +114,7 @@ class Listener(object): # called with the GIL held, but the GIL is released (the current
# Python thread state is NULL)
print("Mapping '%s' to default" % title)
- self.queue.put ( ("default", None) )
+ component.handle(Mapping((default, None)))
def start(self) -> None:
self.hookIDs = [setHook(self.WinEventProc, et) for et in eventTypes.keys()]
|