[PyQt] QThread and QDir::entryList() not getting along in Python?

Adeodato Simó dato at net.com.org.es
Tue Jan 1 23:04:21 GMT 2008


Hello.

My application reads possibly huge tree in the filesystem (music
collection), readding directory contents to build up a tree view.

I was doing this by readding one directory at a time with a 0ms QTimer,
but recently I found out/suffered that when that directory is over a
slow network link, the UI responsiveness suffers a bit. So I thought of
doing it with a thread.

However, I'm having trouble, since I cannot get my Python code to work
fine, the main thread seems to be blocked by the thread reading the
contents.

I attach two sample progras, one in C++ and another in Python. When
reading /mnt/mp3/artists through a slow network link in C++, the main
thread works normally (wakes up every second), but in Python it suffers
stagnation.

Why does this happen, and how can I address it?

-- 
Adeodato Simó                                     dato at net.com.org.es
Debian Developer                                  adeodato at debian.org
 
Bethany, I'm not the kind of guy that girls take home to their mothers.
I tend to, you know, hit on them.
                -- Denny Crane
-------------- next part --------------
A non-text attachment was scrubbed...
Name: threaded_io.py
Type: text/x-python
Size: 738 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20080101/e5df7972/threaded_io.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: threaded_io.cpp
Type: text/x-c++src
Size: 1130 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20080101/e5df7972/threaded_io.bin


More information about the PyQt mailing list