[PySide] wait for QFileDialog to close
Janwillem van Dijk
jwevandijk at xs4all.nl
Thu Dec 12 10:50:08 CET 2013
On 12/12/2013 01:02 AM, Matthew Woehlke wrote:
> On 2013-12-11 18:37, Sean Fisk wrote:
>> I just tried it on CentOS with PySide 1.2.1. The progress bar does indeed
>> work. However, I do see some visual glitches: the layout doesn’t readjust
>> if the window is resized; the button sometimes disappears halfway or fully;
>> the button can’t be clicked.
> This sounds like your environment is coincidentally performing some
> update operations synchronously that usually are deferred. This probably
> explains why you see different behavior depending on the platform. I've
> seen similar artifacts before, e.g. code in projects I work on (not
> written by me :P) that shows a 'please wait' dialog before going off and
> blocking the GUI thread for some time that "work" (i.e. show up) on some
> machines and not on others.
> There are probably a number of factors affecting this; OS is an obvious
> one, but widget style could also come into play and I wouldn't be
> surprised if even system load can have an effect. IOW, I wouldn't get
> too hung up on why it sometimes works, and just write it up as being
> unreliable (i.e. something to avoid or work around).
> p.s. You really should never, ever block the GUI thread for more than
> ~250ms ;-). Threads (or QtConcurrent) are good for "slow" tasks, or else
> make sure you are allowing the event loop to run (i.e. processEvents)
> every now and then.
Thanks for this tip: Missed the processEvents possibility which feels
rather stupid becaus used something equivalent for years in Pascal
(Delphi). I inserted processEvents for every 10th file and the gui stays
alive all the time.
More information about the PySide