diff options
author | Peter Jones <pjones@redhat.com> | 2009-04-29 15:13:32 -0400 |
---|---|---|
committer | Peter Jones <pjones@redhat.com> | 2009-04-29 15:43:55 -0400 |
commit | cd226ebd90caf06a079aeaca72b8c23616112ca8 (patch) | |
tree | 7dc27f23c61ce6604f786b18c926c2b78ba018ed /gui.py | |
parent | a4b62496aa4b74da89aa12452acaa4121b76d371 (diff) | |
download | anaconda-cd226ebd90caf06a079aeaca72b8c23616112ca8.tar.gz anaconda-cd226ebd90caf06a079aeaca72b8c23616112ca8.tar.xz anaconda-cd226ebd90caf06a079aeaca72b8c23616112ca8.zip |
Rate limit pulse() calls to ProgressWindow.
Make the pulsed progress windows only pulse but so quickly. The net
effect is that the filesystem creation progress window now slides back
and forth (albeit with a little much punctuation) rather than blindingly
oscillating at breakneck speed.
Diffstat (limited to 'gui.py')
-rwxr-xr-x | gui.py | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -487,7 +487,7 @@ class ProgressWindow: self.window.set_modal(True) self.window.set_title (title) self.window.set_position (gtk.WIN_POS_CENTER) - self.lastUpdate = int(time.time()) + self.lastUpdate = time.time() self.updsecs = updsecs box = gtk.VBox (False, 5) box.set_border_width (10) @@ -511,9 +511,18 @@ class ProgressWindow: processEvents() def pulse(self): + then = self.lastUpdate + now = time.time() + delta = now-then + if delta < 0.01: + return self.progress.set_pulse_step(self.updpct) - self.progress.pulse() - processEvents() + self.lastUpdate = now + # if we've had a largish gap, some smoothing does actually help. + while delta > 0: + self.progress.pulse() + processEvents() + delta -= 0.05 def set (self, amount): # only update widget if we've changed by 5% or our timeout has @@ -521,7 +530,7 @@ class ProgressWindow: curval = self.progress.get_fraction() newval = float (amount) / self.total then = self.lastUpdate - now = int(time.time()) + now = time.time() if newval < 0.998: if ((newval - curval) < self.updpct and (now-then) < self.updsecs): return |