Open GoogleCodeExporter opened 9 years ago
I don't know if this is technically a "defect". The problem you are detailing
is to provide two different metrics:
1. File progress
2. Transfer progress
Right now the ProgressBar will show only one of the two metrics.
To solve you could do the following: Build a widget yourself which knew the
lengths of each of the files. With this information the widget could determine
which file was currently being downloaded.
On our end we could possibly build a composite ProgressBar which would be able
to show multiple metrics. Since this is not really a priority at the time I
would suggest my first alternative.
For people visiting this issue here is a quick example of how I might solve the
problem:
class MultipartWidget(progressbar.widgets.Widget):
format = '%d of %d'
def __init__(self, bounds):
self.bounds = bounds
self.current = 0
def update(self, pbar):
if pbar.finished:
self.current = len(self.bounds) - 1
elif pbar.currval >= self.bounds[self.current]:
self.current += 1
return self.format % (self.current + 1, len(self.bounds))
# Usage:
# file1.size() == 10 bytes
# file2.size() == 10 bytes
# file3.size() == 15 bytes
# file4.size() == 65 bytes
#
# (you could have __init__ sum everything up for you,
# but I'm just giving a very quick example)
>>> MultipartWidget([10, 20, 35, 100])
Original comment by Terence....@gmail.com
on 16 May 2011 at 3:56
Original issue reported on code.google.com by
lpq...@gmail.com
on 28 Dec 2010 at 11:36