Running GUI and "GObject.mainloop.run()" together?

Ajay Garg ajaygargnsit at gmail.com
Mon Dec 24 00:26:20 PST 2012


Hi all.

This is another question that arises as part of my efforts to run a GUI
application, as well as a dbus-service within the same process.
(The other question being at
http://mail.python.org/pipermail/python-dev/2012-December/123287.html)

For a recap of the brief history, I have a parent process, that is
spawning  a child process via "subprocess".
Currently, the child-process is a GUI process; however, I intend to
"behave" it as a dbus-service as well.

Thus,

a)
I subclassed the child-process "main" class with  "dbus.service.Object";
however, I then got the error
"metaclass conflict: the metaclass of a derived class must be a
(non-strict)subclass of the metaclasses of all its bases
"


b)
I then used composition, wherein another  class, "RemoteListener" deriving
from "dbus.service.Object" was made an attribute of the "main" class. That
worked.
However, when  I do

               dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
               GObject.mainloop.run()

in the "RemoteListener"'s __init__ method, the GUI of the "main" class
fails to load (apparently, because the "mainloop.run()" causes the
singular, main-thread to go into busy-wait).


c)
I tried option b), but now instantiating "RemoteListener" in a separate
thread; however, no improvement :(




Is there a way to run GUI and a dbus-service together? Or is a dbus-service
pure "backend" process? :P

I will be grateful for any pointers; if you need me to test anything else,
please let me know, I will be more than willing :)




Regards,
Ajay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20121224/f6898884/attachment.html>


More information about the dbus mailing list