[PyQt] Asynchronous QSound.isAvailable()?

Sundance sundance at ierne.eu.org
Mon Mar 15 22:28:10 GMT 2010


Greetings all,

I'm having a problem I don't know how to address. Just plain completely at a 
loss.

The issue: on Linux, when the NAS sound server isn't installed (which is the 
case on most distros nowadays), QSound.isAvailable() blocks for several 
seconds before returning. Since it runs in the main thread, it blocks the UI 
as well.

I've tried to poll for sound availability in a different thread, and then 
another problem occurs:

QObject: Cannot create children for a parent that is in a different thread.
(Parent is Application(0x26ba030), parent's thread is QThread(0x279d510), 
current thread is EnginePollerThread(0x2b22040)

EnginePollerThread is the QThread subclass where I call QSound.isAvailable()

Apparently, whatever object the static method isAvailable() uses is parented 
to the main thread, and I'm at a loss as to how to reparent it, or otherwise 
make the warning go away.

I'm thus looking for a mean, any mean, to run QSound.isAvailable() 
asynchronously. Any pointer, anyone?

Thanks.

-- S.


More information about the PyQt mailing list