PyQt: Can't show QFileDialog.getExistingDirectory in Python Thread, bug or not?

ulysses ulysses_dm at yahoo.com.cn
Tue Sep 16 00:09:47 EDT 2003


Hi,

I use QT nc,PyQt NC 3.8 in Win32 platform. python 2.3.
I need show getExistingDirectory in my program. I catch a question.

When I show a Dialog in a python function.it's ok. exp:

def showDirectory:
     dl=QFileDialog.getExistingDirectory('',None,
                                        'get directory',
                                         'choose directory',1)
     print str(dl)

When I call this function in a python thread. the whole program halted 
at once. It's seem a infinite loop. exp:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main function start.....
    thread = Thread(target = next, args = [params, frmMain, doneflag])
    thread.setDaemon(false)
    thread.start()


def next(params, d, doneflag):
    dow = Download ()
    d.dow = dow
    dow.download(params, d.chooseFile, d.updateStatus, d.finished, d.error,     
    doneflag, 100, d.newpath)
    if not d.fin:
        d.failed()

def onChooseFile(self, default, bucket, f, size, dir, saveas):
        if saveas != '':
            dl = saveas
        else:
            if dir:
                dl=QFileDialog.getExistingDirectory('',None,
                                        'get directory',
                                        'choose directory',1)
            else:
                dl = QFileDialog.getSaveFileName(tempShow, "*.*", 
                                         self, "FileDialog")

It's very cute I can use QFileDialog.getSaveFileName. Why I can't use
dl=QFileDialog.getExistingDirectory. 

It's a Qt small bug??? 

Ulysses




More information about the Python-list mailing list