aboutsummaryrefslogtreecommitdiff
path: root/tools/EventClients/lib
diff options
context:
space:
mode:
authorVasyl Gello <vasek.gello@gmail.com>2020-11-16 00:44:46 +0200
committerVasyl Gello <vasek.gello@gmail.com>2020-11-16 00:44:46 +0200
commitde0329a45682d86f6ada399f01289d03098f7c55 (patch)
tree148c50ba68fdcb9716de6ab90c22792be2a2ee73 /tools/EventClients/lib
parente0c690577c9bdc7f59f0c3fc35c0509d3fd9279e (diff)
Port zeroconf.py to Python 3
Diffstat (limited to 'tools/EventClients/lib')
-rw-r--r--tools/EventClients/lib/python/zeroconf.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/EventClients/lib/python/zeroconf.py b/tools/EventClients/lib/python/zeroconf.py
index 811dbe338e..ee2af14e8f 100644
--- a/tools/EventClients/lib/python/zeroconf.py
+++ b/tools/EventClients/lib/python/zeroconf.py
@@ -26,12 +26,13 @@ __version__ = "0.1"
try:
import time
- import dbus, gobject, avahi
+ import dbus, avahi
from dbus import DBusException
from dbus.mainloop.glib import DBusGMainLoop
+ from gi.repository import GLib
except Exception as e:
print("Zeroconf support disabled. To enable, install the following Python modules:")
- print(" dbus, gobject, avahi")
+ print(" dbus, gi, avahi")
pass
SERVICE_FOUND = 1
@@ -78,10 +79,10 @@ class Browser:
def run(self):
"""
- Run the gobject event loop
+ Run the GLib event loop
"""
# Don't use loop.run() because Python's GIL will block all threads
- loop = gobject.MainLoop()
+ loop = GLib.MainLoop()
context = loop.get_context()
while not self._stop:
if context.pending():
@@ -91,7 +92,7 @@ class Browser:
def stop(self):
"""
- Stop the gobject event loop
+ Stop the GLib event loop
"""
self._stop = True