mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-27 02:16:12 +01:00
Fix ZeroDivisionException in meter.PBTextMeter
If size is 0, using pb.Percentage will result in a ZeroDivisionException. Note: the output in case of size == 0 looks a bit "strange" - for a consistent output we should probably subclass pb.Percentage.
This commit is contained in:
parent
f233066448
commit
60f9290d02
@ -17,8 +17,11 @@ class PBTextMeter(object):
|
||||
widgets = [basename + ': ', pb.AnimatedMarker(), ' ', pb.Timer()]
|
||||
self.bar = pb.ProgressBar(widgets=widgets, maxval=pb.UnknownLength)
|
||||
else:
|
||||
widgets = [basename + ': ', pb.Percentage(), pb.Bar(), ' ',
|
||||
pb.ETA()]
|
||||
widgets = [basename + ': ', pb.Bar(), ' ', pb.ETA()]
|
||||
if size:
|
||||
# if size is 0, using pb.Percentage will result in
|
||||
# a ZeroDivisionException
|
||||
widgets.insert(1, pb.Percentage())
|
||||
self.bar = pb.ProgressBar(widgets=widgets, maxval=size)
|
||||
self.bar.start()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user