fix for bandwidth settings?

This commit is contained in:
Zach Tibbitts 2007-02-21 21:05:23 +00:00
parent a029fa8f3f
commit 7b75c2796a
2 changed files with 10 additions and 2 deletions

View File

@ -1,4 +1,5 @@
[Desktop Entry] [Desktop Entry]
Version=1.0
Encoding=UTF-8 Encoding=UTF-8
Name=Deluge BitTorrent Client Name=Deluge BitTorrent Client
Comment=Bittorrent client written in Python/PyGTK Comment=Bittorrent client written in Python/PyGTK
@ -8,3 +9,4 @@ Terminal=false
Type=Application Type=Application
Categories=Application;Network Categories=Application;Network
StartupNotify=true StartupNotify=true
GenericName[en_US]=

View File

@ -471,11 +471,17 @@ class DelugeGTK:
def apply_prefs(self): def apply_prefs(self):
ulrate = self.config.get("max_upload_rate", int, default=-1)
dlrate = self.config.get("max_download_rate", int, default=-1)
if not (ulrate == -1):
ulrate *= 1024
if not (dlrate == -1):
ulrate *= 1024
self.tray.set_visible(self.config.get("enable_system_tray", bool)) self.tray.set_visible(self.config.get("enable_system_tray", bool))
self.manager.set_pref("listen_on", [self.config.get("tcp_port_range_lower", int), self.config.get("tcp_port_range_upper", int)]) self.manager.set_pref("listen_on", [self.config.get("tcp_port_range_lower", int), self.config.get("tcp_port_range_upper", int)])
self.manager.set_pref("max_upload_rate", ulrate)
self.manager.set_pref("max_download_rate", dlrate)
self.manager.set_pref("max_uploads", self.config.get("max_number_uploads", int)) self.manager.set_pref("max_uploads", self.config.get("max_number_uploads", int))
self.manager.set_pref("max_upload_rate", 1024 * self.config.get("max_upload_rate", int))
self.manager.set_pref("max_download_rate", 1024 * self.config.get("max_download_rate", int))
self.manager.set_pref("max_connections", self.config.get("max_number_downloads", int)) self.manager.set_pref("max_connections", self.config.get("max_number_downloads", int))