[avahi] Avahi interface for Python and Gtk+ 3 main loops
Andrei Macavei
andrei.macavei89 at gmail.com
Thu Jun 19 15:51:17 PDT 2014
Hi,
I am developing a client/server app in Python GTK+3 that uses avahi to
publish itself on the network while discovering other instances of the
same service.
I am forced to run two main loops which isn't right.
The Gtk widget MainWindow, that represents the main window of the
application, is using the main loop to wait for the user to interact
with it.
When I create the MainWindow object, I also start the avahi service
which publishes the current service and discovers other relevant network
services.
The browsing of services with avahi requires a main loop also, because
of the callback functions that are called when a new service is discovered.
As a results I cannot run two main loops and I get the reasonable error.
The traceback starts with the call of the main loop in the python file
representing the avahi service discover client:
RuntimeError: To make asynchronous calls, receive signals or export
objects, D-Bus connections must be attached to a main loop by passing
mainloop=... to the constructor or calling dbus.set_default_main_loop(...)
Here is the python code for all 3 classes involved:
1. MainWindow http://dpaste.com/2PGAGWG
2. ServicePublisher http://dpaste.com/12B8D62
3. ServiceDiscover http://dpaste.com/0GZ69HK
More information about the avahi
mailing list