python bindings & gmainloop

Jakub Piotr Cłapa jpc at pld-linux.org
Wed Sep 14 16:01:00 PDT 2005


Sean Meiners wrote:
> Is there any way, at all, to use the python bindings without the gmainloop?  
> The reason I as is that I'm writing a couple of apps in pykde/qt and find 
> that entering the gmainloop prevents the python interpreter from servicing 
> any other threads (both python threads and QThreads).  I've worked around 
> this issue temporarily by creating a function that sleeps for a short time 
> and passing it to gobject.timeout_add.  This seems to give enough time back 
> to the interpreter to service other threads, but it just doesn't feel like 
> the right way to go about it (time-slicing is the kernel's job).  I would 
> much prefer to use a python thread (or the Qt event loop if necessary) to 
> service the dbus signal receivers. Is this currently possible?

AFAIK it is not possible because the current Python bindings are layered 
over the GLib ones (but I can be wrong).

Being shameless (sorry for that but I really think that having two 
implementations is BetterThanABadThing for an open and standarized 
protocol) I invite you to check my pure-Python (not really feature 
complete, but it should handle everything that can be sent over the 
socket - it just lacks much of the convenience API) implementation (see 
the list archives). Ping me via Jabber (JID same as mail) if you would 
want to give it a try because it's not really documented (but OTOH the 
source is quite heavily commented).

-- 
Regards,
Jakub Piotr Cłapa


More information about the dbus mailing list