Module: deluge
Branch: master
Commit: b3492b07a1d29c33f4ea130cf7e7263fe70bc9c6

Author: Pedro Algarvio <[email protected]>
Date:   Thu May  5 18:38:52 2011 +0100

PiecesBar

Now, either show the pieces bar or the progress bar, not both.

---

 deluge/ui/gtkui/status_tab.py |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/deluge/ui/gtkui/status_tab.py b/deluge/ui/gtkui/status_tab.py
index fee9509..1166140 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)

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to