[PyKDE] Qt progress example with minor glitch

Boudewijn Rempt boud at valdyas.org
Fri Aug 30 15:09:00 BST 2002


On Friday 30 August 2002 14:39, Hans-Peter Jansen wrote:
>
> sure, that the AnimatedThingy is stopped properly on cancel?
> I left a print statement in _drawqix method as an indicator.

No, the timer continues -- but I have never got the BadWindow
message, and the dialog does disappear.

> if yes:
>     would you do me a favour and comment out line 220/221:
>             if not self.default_label:
>                 self.pb.killTimers()
>     and check, if self.pb is stopped properly.
>     This codepath is taken in timerDriven/customLabel mode only (default).
>

When I comment this out, it looks as if the timer restarts itself.

> The whole topic lead me to the question, how such custom dialogs
> are deconstructed properly?
>

Okay, I took a good long look at it. The first problem is in the
show() method of the animated label -- this gets called when cancel
is pressed. For the moment, don't ask me why, but it is, and it restarts
your timer.

Furthermore, when the dialog is deleted, the timers appear to
be still running. Apparently, killTimers() doesn't descend into
the dialog's children. So I kept a ref to the animated label and
called killTimers() on it at the right place. See attached script.
It kills that timer dead.

As for the proper way to approach this problem -- I'm not sure. I think
I would subclass QProgressDialog and have that handle the killing of the
timer of the animated label.


-- 
Boudewijn Rempt | http://www.valdyas.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: progress.py
Type: text/x-python
Size: 9384 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20020830/95f12e9b/progress.py


More information about the PyQt mailing list