Only draw the advanced progress bar if 'num_pieces' is greater than 0.

This commit is contained in:
Andrew Resch 2008-02-01 21:18:58 +00:00
parent 7a973947a7
commit 4b18f49ec1
1 changed files with 10 additions and 9 deletions

View File

@ -94,6 +94,7 @@ class DetailsTabManager(object):
gc.set_foreground(colormap.alloc_color('#2020FF'))
progress_window.draw_rectangle(gc, True, 0, top, int(size[0] * state['progress']), 4)
num_pieces = state["total_wanted"] / state["piece_length"]
if num_pieces > 0:
for pieces_range in state['pieces']:
range_first = pieces_range[0] * size[0] / num_pieces
range_length = ((pieces_range[1] - pieces_range[0] + 1) * size[0] / num_pieces)