From b3492b07a1d29c33f4ea130cf7e7263fe70bc9c6 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 5 May 2011 18:38:52 +0100 Subject: [PATCH] PiecesBar Now, either show the pieces bar or the progress bar, not both. --- deluge/ui/gtkui/status_tab.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/deluge/ui/gtkui/status_tab.py b/deluge/ui/gtkui/status_tab.py index fee9509b0..1166140d2 100644 --- a/deluge/ui/gtkui/status_tab.py +++ b/deluge/ui/gtkui/status_tab.py @@ -74,6 +74,7 @@ class StatusTab(Tab): # Get the labels we need to update. # widgetname, modifier function, status keys self.glade = glade = component.get("MainWindow").main_glade + self.progressbar = component.get("MainWindow").main_glade.get_widget("progressbar") self._name = "Status" self._child_widget = glade.get_widget("status_tab") @@ -161,12 +162,12 @@ class StatusTab(Tab): widget[0].set_text(txt) # Do the progress bar because it's a special case (not a label) - w = component.get("MainWindow").main_glade.get_widget("progressbar") - fraction = status["progress"] / 100 - if w.get_fraction() != fraction: - w.set_fraction(fraction) if self.config['show_piecesbar']: self.piecesbar.update_from_status(status) + else: + fraction = status["progress"] / 100 + if self.progressbar.get_fraction() != fraction: + self.progressbar.set_fraction(fraction) def on_show_pieces_bar_config_changed(self, key, show): self.show_pieces_bar(show) @@ -175,19 +176,23 @@ class StatusTab(Tab): if hasattr(self, 'piecesbar'): if show: self.piecesbar.show() + self.progressbar.hide() else: self.piecesbar.hide() + self.progressbar.show() else: if show: self.piecesbar = PiecesBar() self.glade.get_widget("status_progress_vbox").pack_start( self.piecesbar, False, False, 5 ) + self.progressbar.hide() def clear(self): for widget in self.label_widgets: widget[0].set_text("") - component.get("MainWindow").main_glade.get_widget("progressbar").set_fraction(0.0) if self.config['show_piecesbar']: self.piecesbar.clear() + else: + self.progressbar.set_fraction(0.0)