[PySide] a couple of QProgressDialog questions
Frank Rueter | OHUfx
frank at ohufx.com
Tue Sep 3 08:31:09 CEST 2013
Hi everybody,
after almost a year of having to neglect PySide I'm finally making some
time for it again, only to feel like I almost forgot everything I
learned :-D
I'm trying to do something fairly common and wanted to sanity check my
approach, so here is my sandbox script to figure out how to use
QProgressDialog:
http://pastebin.com/4kVhPiUx
It all works as expected except for the fact that when I hit cancel, the
progress stops (as expected), and the second time I hit the cancel
button the dialog closes. Seems wrong, and I'm sure I should be doing it
better, so that the progress stops and the dialog closes at the same
time. This behaviour seems to be the same even if setAutoClose() is set
to True.
Should manually close the window when wasCanceled() is true, or set the
progress' value to it's maximum to let auroClose take over? Or is there
a better way?
My second question is:
What is the best approach to connect a QProgressDialog to another thread
that is running a command line application?
I'm guessing I should write a wrapper around the external application
(using QEvent or QProcess?), grabbing it's stdout, parsing it to get the
actual progress value, then connecting that to the QProgressDialog widget.
Is that the way to do it?
Ultimately I would like a simple Dialog, that has both a progress bar
and a text widget, to show the application's stdout as well as the
overall progress.
Am I on the right track or are there easier/better ways?
Cheers,
frank
More information about the PySide
mailing list