Format donwload string so it jumps less
This commit is contained in:
parent
c9f60caa12
commit
cd7d6b87f9
@ -89,18 +89,18 @@ class DownloadItem(QObject):
|
||||
def __str__(self):
|
||||
"""Get the download as a string.
|
||||
|
||||
Example: foo.pdf [699.2K/s|0.34|16%|4.253/25.124]
|
||||
Example: foo.pdf [699.2kB/s|0.34|16%|4.253/25.124]
|
||||
"""
|
||||
perc = 0 if self.percentage is None else round(self.percentage)
|
||||
remaining = (format_seconds(self.remaining_time)
|
||||
if self.remaining_time is not None else
|
||||
'?')
|
||||
if self.remaining_time is not None else '?')
|
||||
speed = format_size(self.speed, suffix='B/s')
|
||||
down = format_size(self.bytes_done, suffix='B')
|
||||
total = format_size(self.bytes_total, suffix='B')
|
||||
return '{name} [{speed}|{remaining}|{perc: 2}%|{down}/{total}]'.format(
|
||||
name=self.basename, speed=speed, remaining=remaining, perc=perc,
|
||||
down=down, total=total)
|
||||
return ('{name} [{speed:>10}|{remaining:>5}|{perc:>2}%|'
|
||||
'{down}/{total}]'.format(name=self.basename, speed=speed,
|
||||
remaining=remaining, perc=perc,
|
||||
down=down, total=total))
|
||||
|
||||
def _die(self, msg):
|
||||
"""Abort the download and emit an error."""
|
||||
|
Loading…
Reference in New Issue
Block a user