gget r47 - trunk/gget
- From: johans svn gnome org
- To: svn-commits-list gnome org
- Subject: gget r47 - trunk/gget
- Date: Mon, 4 Aug 2008 10:50:16 +0000 (UTC)
Author: johans
Date: Mon Aug 4 10:50:16 2008
New Revision: 47
URL: http://svn.gnome.org/viewvc/gget?rev=47&view=rev
Log:
Set bitrate to 0 when a download is paused/completed/has error. Fixed bug with clearing completed downloads.
Modified:
trunk/gget/Download.py
trunk/gget/DownloadList.py
trunk/gget/Utils.py
Modified: trunk/gget/Download.py
==============================================================================
--- trunk/gget/Download.py (original)
+++ trunk/gget/Download.py Mon Aug 4 10:50:16 2008
@@ -118,6 +118,7 @@
return self.uri
def __cmp__(self, other):
+ """Compare downloads based on id (start date)."""
if self.id == other.id:
return 0
return -1
@@ -183,8 +184,9 @@
def bitrate(self, bit_rate):
"""Callback with the download bitrate in kilobytes per second."""
- self.bit_rate = bit_rate
- self.emit("bitrate", bit_rate)
+ if self.status not in [COMPLETED, PAUSED, CANCELED, ERROR]:
+ self.bit_rate = bit_rate
+ self.emit("bitrate", bit_rate)
def cancel(self):
"""Tries to cancel this download. Returns True if sucessful, else
@@ -262,6 +264,8 @@
if self.config.show_notifications:
Notification(download)
+ # Set bitrate to 0 if download is completed, paused or canceled
+ if status in [COMPLETED, PAUSED, CANCELED, ERROR]:
if self.bit_rate != 0.0:
self.bit_rate = 0.0
self.emit("bitrate", self.bit_rate)
Modified: trunk/gget/DownloadList.py
==============================================================================
--- trunk/gget/DownloadList.py (original)
+++ trunk/gget/DownloadList.py Mon Aug 4 10:50:16 2008
@@ -185,7 +185,8 @@
def remove_completed_downloads(self):
"""Removes all completed downloads in the list (and xml tree)."""
- for download in self.downloads:
+ downloads = list(self.downloads)
+ for download in downloads:
if download.status == Download.COMPLETED:
self.remove_download(download)
Modified: trunk/gget/Utils.py
==============================================================================
--- trunk/gget/Utils.py (original)
+++ trunk/gget/Utils.py Mon Aug 4 10:50:16 2008
@@ -40,7 +40,7 @@
def get_readable_speed(bitrate):
if bitrate > 1000:
return "%.2f MB/s" % (float(bitrate) / float(1000))
- return "%.0f kb/s" % bitrate
+ return "%.0f kB/s" % bitrate
def debug_print(message):
config = Configuration()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]