[PySide] wait for QFileDialog to close
Janwillem van Dijk
jwevandijk at xs4all.nl
Tue Dec 10 21:56:54 CET 2013
Here is the snippet: It reads the filenames in a folder and determines
new names for photo's based on the exif info.
I apreciate that threading might be a solution but the problem seems too
simple for that. Can you give an example on how to use the signal concept?
self.outFolder = QFileDialog.getExistingDirectory(
caption='Destination folder', dir=self.defOutFolder)
self.outFiles = 
self.outFolder = self.outFolder.replace('\\', '/')
for i, fname in enumerate(self.inFiles):
self.progressBar.setValue(i + 1)
newpath, newfname = rename_photo(self.inFolder, fname)
newpath = path.join(self.outFolder, newpath)
self.outFiles.append([fname, newpath, newfname])
s = fname + ' --> ' + self.outFolder + '\n'
s += path.join(newpath, newfname).replace(self.outFolder, '')
On 10/12/13 21:35, Sean Fisk wrote:
> Hi Janwillem,
> Are you running the “lengthy part that processes a files list” within
> the GUI thread? If so, you will probably see your GUI hang while this
> is happening (you won’t be able to click or do anything). In this
> case, you should consider running the processing in a different thread
> using QThread
> or QThreadPool
> Can you post the relevant part of the code?
> Sean Fisk
> On Tue, Dec 10, 2013 at 3:17 PM, Janwillem van Dijk
> <jwevandijk at xs4all.nl <mailto:jwevandijk at xs4all.nl>> wrote:
> Hi, I have a PySide script that uses
> QFileDialog.getExistingDirectory(). After clicking the Open button
> the script proceeds with a lengthy part that processes a files
> list and writes to a QPlainTextEdit. Unfortunately the QFileDialog
> widget does only disappear after this processing is finished,
> hiding the QPlainTextEdit.
> How can I make that the QFileDialog widget is gone before the
> processing starts?
> Cheers, Janwillem
> PySide mailing list
> PySide at qt-project.org <mailto:PySide at qt-project.org>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PySide