[PATCH] add pulsing progress bars for gui. noop (no progress bar) for text

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 cmdline.py |    9 ++++++---
 gui.py     |   14 ++++++++++----
 text.py    |   12 ++++++++----
 3 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/cmdline.py b/cmdline.py
index c343eb9..972ce9c 100644
--- a/cmdline.py
+++ b/cmdline.py
@@ -38,6 +38,9 @@ class ProgressWindow:
     def pop(self):
         print ""
 
+    def pulse(self):
+        pass
+
     def set(self, amount):
         if amount == self.total:
             print _("Completed"),
@@ -45,7 +48,7 @@ class ProgressWindow:
     def refresh(self):
         pass
 
-    def __init__(self, title, text, total, updpct = 0.05):
+    def __init__(self, title, text, total, updpct = 0.05, pulse = False):
         self.total = total
         print text
         print _("In progress...   "),
@@ -61,8 +64,8 @@ class InstallInterface:
     def shutdown(self):
         pass
 
-    def progressWindow(self, title, text, total, updpct = 0.05):
-        return ProgressWindow(title, text, total, updpct)
+    def progressWindow(self, title, text, total, updpct = 0.05, pulse = False):
+        return ProgressWindow(title, text, total, updpct, pulse)
 
     def kickstartErrorWindow(self, text):
         s = _("The following error was found while parsing your "
diff --git a/gui.py b/gui.py
index 7e26536..4eb564b 100755
--- a/gui.py
+++ b/gui.py
@@ -511,7 +511,7 @@ class WaitWindow:
 
 class ProgressWindow:
     def __init__(self, title, text, total, updpct = 0.05, updsecs=10,
-                 parent = None):
+                 parent = None, pulse = False):
         if flags.rootpath or not runningMiniWm():
             self.window = gtk.Window()
             if parent:
@@ -543,6 +543,11 @@ class ProgressWindow:
     def refresh(self):
         processEvents()
 
+    def pulse(self):
+        self.progress.set_pulse_step(self.updpct)
+        self.progress.pulse()
+        processEvents()
+
     def set (self, amount):
         # only update widget if we've changed by 5% or our timeout has
         # expired
@@ -1037,11 +1042,12 @@ class InstallInterface:
         else:
             return WaitWindow (title, text)
 
-    def progressWindow (self, title, text, total, updpct = 0.05):
+    def progressWindow (self, title, text, total, updpct = 0.05, pulse = False):
         if self.icw:
-            return ProgressWindow (title, text, total, updpct, self.icw.window)
+            return ProgressWindow (title, text, total, updpct,
+                                   parent = self.icw.window, pulse = pulse)
         else:
-            return ProgressWindow (title, text, total, updpct)
+            return ProgressWindow (title, text, total, updpct, pulse = pulse)
 
     def packageProgressWindow (self, total, totalSize):
         self.ppw.setSizes (total, totalSize)
diff --git a/text.py b/text.py
index 9af171c..9e11e2b 100644
--- a/text.py
+++ b/text.py
@@ -115,6 +115,9 @@ class ProgressWindow:
         del self.scale
         self.scale = None
 
+    def pulse(self):
+        pass
+
     def set(self, amount):
         self.scale.set(int(float(amount) * self.multiplier))
         self.screen.refresh()
@@ -122,7 +125,7 @@ class ProgressWindow:
     def refresh(self):
         pass
 
-    def __init__(self, screen, title, text, total, updpct = 0.05):
+    def __init__(self, screen, title, text, total, updpct = 0.05, pulse = False):
         self.multiplier = 1
         if total == 1.0:
             self.multiplier = 100
@@ -136,7 +139,8 @@ class ProgressWindow:
 	g.add(t, 0, 0, (0, 0, 0, 1), anchorLeft=1)
 
         self.scale = Scale(int(width), int(float(total) * self.multiplier))
-        g.add(self.scale, 0, 1)
+        if not pulse:
+            g.add(self.scale, 0, 1)
                 
 	g.draw()
 	self.screen.refresh()
@@ -351,8 +355,8 @@ class InstallInterface:
 		pdb.post_mortem(tb)
 	    os._exit(1)
 
-    def progressWindow(self, title, text, total, updpct = 0.05):
-        return ProgressWindow(self.screen, title, text, total, updpct)
+    def progressWindow(self, title, text, total, updpct = 0.05, pulse = False):
+        return ProgressWindow(self.screen, title, text, total, updpct, pulse)
 
     def messageWindow(self, title, text, type="ok", default = None,
 		      custom_icon=None, custom_buttons=[]):
-- 
1.5.3.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux