summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2009-04-29 15:13:32 -0400
committerPeter Jones <pjones@redhat.com>2009-04-29 15:43:55 -0400
commitcd226ebd90caf06a079aeaca72b8c23616112ca8 (patch)
tree7dc27f23c61ce6604f786b18c926c2b78ba018ed
parenta4b62496aa4b74da89aa12452acaa4121b76d371 (diff)
downloadanaconda-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.
-rwxr-xr-xgui.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/gui.py b/gui.py
index 2c5fa9a8d..ad71dc1fc 100755
--- a/gui.py
+++ b/gui.py
@@ -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