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:
parent
99d3147519
commit
fd3977dc59
@ -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):
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user