gget r38 - trunk/gget



Author: johans
Date: Tue Jul 22 17:13:17 2008
New Revision: 38
URL: http://svn.gnome.org/viewvc/gget?rev=38&view=rev

Log:
Present speed in Mb/s when appropriate. Bug fix.

Modified:
   trunk/gget/MainWindow.py
   trunk/gget/Notification.py
   trunk/gget/Utils.py

Modified: trunk/gget/MainWindow.py
==============================================================================
--- trunk/gget/MainWindow.py	(original)
+++ trunk/gget/MainWindow.py	Tue Jul 22 17:13:17 2008
@@ -280,7 +280,7 @@
     def __speed_cell_data_func(self, column, cell, model, iter):
         """Data function for the speed of downloads."""
         download = model.get_value(iter, 0)
-        cell.props.text = "%.0fkb/s" % download.bit_rate
+        cell.props.text = Utils.get_readable_speed(download.bit_rate)
 
     def __eta_cell_data_func(self, column, cell, model, iter):
         """Data function for estemated time of arrival (ETA) of downloads."""

Modified: trunk/gget/Notification.py
==============================================================================
--- trunk/gget/Notification.py	(original)
+++ trunk/gget/Notification.py	Tue Jul 22 17:13:17 2008
@@ -44,7 +44,7 @@
         self.download = download
 
         self.config = Configuration()
-        self.status_icon = StatusIcon()
+        self.status_icon = TrayIcon()
 
         pynotify.init(NAME)
 

Modified: trunk/gget/Utils.py
==============================================================================
--- trunk/gget/Utils.py	(original)
+++ trunk/gget/Utils.py	Tue Jul 22 17:13:17 2008
@@ -35,6 +35,11 @@
         bits = float(bits)
         bits /= 1024.0
 
+def get_readable_speed(bitrate):
+    if bitrate > 1000:
+        return "%.2f MB/s" % (float(bitrate) / float(1000))
+    return "%.0f kb/s" % bitrate
+
 def debug_print(message):
     config = Configuration()
     if config.debug:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]