1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-29 03:06:15 +01:00
github.com_openSUSE_osc/osc/meter.py
lethliel 65b053abb3 replace urlgrabber to enable python3 compatibility
- new module grabber.py
  * OscMirrorGroup to keep urlgrabber.mirrorgroup behavior
  * OscFileGrabber moved here

- meter.py
  * reworked to use progressbar module instead of progressbar
    of urlgrabber and simplified the module.

- babysitter.py
  * removed URLGrabErrorr

- build.py
  * removed adding of url_local to urllist. (not needed anymore)
  * removed URLGrabError

- commandline.py
  * switched from urlgrabber.urlgrab to OscFileGrabber().urlgrab

- core.py
  * reworked progressbar behavior

- fetch.py
  * removed join_url (not needed anymore)
  * moved OscFileGrabber to grabber.py
  * removed failureReport (not needed anymore)
2018-10-19 09:31:37 +02:00

28 lines
875 B
Python

# Copyright (C) 2018 SUSE Linux. All rights reserved.
# This program is free software; it may be used, copied, modified
# and distributed under the terms of the GNU General Public Licence,
# either version 2, or (at your option) any later version.
import progressbar as pb
class TextMeter(object):
def start(self, basename, size=None):
if size is None:
widgets = [basename + ': ', pb.AnimatedMarker(), ' ', pb.Timer()]
self.bar = pb.ProgressBar(widgets=widgets, maxval=pb.UnknownLength)
else:
widgets = [basename + ': ', pb.Percentage(), pb.Bar(), ' ',
pb.ETA()]
self.bar = pb.ProgressBar(widgets=widgets, maxval=size)
self.bar.start()
def update(self, amount_read):
self.bar.update(amount_read)
def end(self):
self.bar.finish()
# vim: sw=4 et