1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 14:56:14 +01:00

make osc built in text meter display progress immediately

This commit is contained in:
Ludwig Nussel 2010-02-24 11:27:18 +01:00
parent 99d3147519
commit fd3977dc59
2 changed files with 5 additions and 7 deletions

View File

@ -39,12 +39,6 @@ You can modify osc commands, or roll you own, via the plugin API:
osc was written by several authors. This man page is automatically generated.
"""
class OscTextMeter(urlgrabber.progress.TextMeter):
"""show the progress bar immediately"""
def _do_start(self, *args, **kwargs):
urlgrabber.progress.TextMeter._do_start(self, *args, **kwargs)
self._do_update(0)
class Osc(cmdln.Cmdln):
"""Usage: osc [GLOBALOPTS] SUBCOMMAND [OPTS] [ARGS...]
or: osc help SUBCOMMAND
@ -142,7 +136,8 @@ class Osc(cmdln.Cmdln):
self.options.verbose = conf.config['verbose']
self.download_progress = None
if conf.config.get('show_download_progress', False):
self.download_progress = OscTextMeter()
from meter import TextMeter
self.download_progress = TextMeter()
def get_cmd_help(self, cmdname):

View File

@ -50,6 +50,9 @@ class TextMeter(BaseMeter):
self.sized_templ = '\r%%-%s.%ss %%3i%%%% |%%-%s.%ss| %%5sB %%8s ' %(width*4/10, width*4/10, self.bar_length, self.bar_length)
def _do_start(self, *args, **kwargs):
BaseMeter._do_start(self, *args, **kwargs)
self._do_update(0)
def _do_update(self, amount_read, now=None):
etime = self.re.elapsed_time()