diff options
author | Toshiki Sonoda <sonoda.toshiki@fujitsu.com> | 2022-11-09 18:33:57 +0900 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2022-12-14 13:18:36 -0500 |
commit | 6ec00474a659158f20248d6af3771d1a12ddac7b (patch) | |
tree | 63902ece312fe655f7ab42fef4a570451c06f7d0 /virtinst | |
parent | 39c7a443146433766e4e71e48ab59145c74924b3 (diff) | |
download | virt-manager-6ec00474a659158f20248d6af3771d1a12ddac7b.tar.gz |
virtinstall: Hide total_size in the progress bar if it doesn't need
virt-install prints the total_size value to the progress bar even if it
is meaningless.
This value can be confusing to user, so for execute prosess that doesn't
copy files (total_size = 0B), we hide the total_size value.
For example, 'Creating domain...' doesn't need to print the total_size
value.
Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
Signed-off-by: Haruka Ohata <ohata.haruka@fujitsu.com>
Diffstat (limited to 'virtinst')
-rw-r--r-- | virtinst/_progresspriv.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/virtinst/_progresspriv.py b/virtinst/_progresspriv.py index a035c9c4..207c6479 100644 --- a/virtinst/_progresspriv.py +++ b/virtinst/_progresspriv.py @@ -247,11 +247,15 @@ class TextMeter(BaseMeter): tl = TerminalLine(8) # For big screens, make it more readable. use_hours = bool(tl.llen > 80) - ui_size = tl.add(' | %5sB' % total_size) ui_time = tl.add(' %s' % format_time(self.re.elapsed_time(), use_hours)) ui_end, not_done = _term_add_end(tl, self.size, amount_read) - dummy = not_done + if not not_done and amount_read == 0: + # Doesn't need to print total_size + ui_size = tl.add(' | %5s ' % ' ') + else: + ui_size = tl.add(' | %5sB' % total_size) + out = '\r%-*.*s%s%s%s\n' % (tl.rest(), tl.rest(), self.text, ui_size, ui_time, ui_end) self.output.write(out) |