From 069bd5da88796f990cc8919d0364ecb50f77749c Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Mon, 12 May 2008 13:19:41 +0000 Subject: [PATCH] Fix advanced progressbar to display properly when torrent only has 1 wanted piece that is smaller than the piece size --- src/tab_details.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tab_details.py b/src/tab_details.py index 0e999c956..7cf0c338f 100644 --- a/src/tab_details.py +++ b/src/tab_details.py @@ -93,7 +93,10 @@ class DetailsTabManager(object): if state != None: 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 state["total_wanted"] < state["piece_length"] and state["total_wanted"] > 0: + num_pieces = 1 + else: + 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