FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 11-28-2007, 10:05 PM
Jeremy Katz
 
Default add pulsing progress bars for gui. noop (no progress bar) for text

---
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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 04:29 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org