From 7024caa6f360792e25f91d8f9dbc4cd6189c095d Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Thu, 21 Jun 2007 22:19:18 +0000 Subject: [PATCH] Fix deprecation warning --- src/dialogs.py | 2 +- src/interface.py | 17 ++++++++++------- src/pref.py | 4 ++-- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/dialogs.py b/src/dialogs.py index c3d96464e..7546f9626 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -119,7 +119,7 @@ class PreferencesDlg: self.preferences.set("max_number_uploads", self.glade.get_widget("spin_num_upload").get_value()) self.preferences.set("max_download_rate", self.glade.get_widget("spin_max_download").get_value()) self.preferences.set("proxy_port", self.glade.get_widget("spin_proxy_port").get_value()) - self.preferences.set("max_connections", self.glade.get_widget("spin_max_connections").get_value()) + self.preferences.set("max_connections", int(self.glade.get_widget("spin_max_connections").get_value())) self.preferences.set("max_active_torrents", int(self.glade.get_widget("spin_torrents").get_value())) self.preferences.set("queue_seeds_to_bottom", self.glade.get_widget("chk_seedbottom").get_active()) self.preferences.set("enable_dht", self.glade.get_widget("chk_dht").get_active()) diff --git a/src/interface.py b/src/interface.py index bdd63a104..431af46e7 100644 --- a/src/interface.py +++ b/src/interface.py @@ -692,14 +692,17 @@ class DelugeGTK: def apply_prefs(self): # Show tray icon if necessary self.tray_icon.set_visible(self.config.get("enable_system_tray")) - + # Update the max_*_rate_bps prefs - ulrate = self.config.get("max_upload_rate") * 1024 - dlrate = self.config.get("max_download_rate") * 1024 - if not (ulrate < 0): - self.config.set("max_upload_rate_bps", ulrate) - if not (dlrate < 0): - self.config.set("max_download_rate_bps", dlrate) + if self.config.get("max_upload_rate") < 0: + self.config.set("max_upload_rate_bps", -1) + else: + self.config.set("max_upload_rate_bps", int(self.config.get("max_upload_rate") * 1024)) + + if self.config.get("max_download_rate") < 0: + self.config.set("max_download_rate_bps", -1) + else: + self.config.set("max_download_rate_bps", int(self.config.get("max_download_rate") * 1024)) # Update the tray download speed limits if self.config.get("max_download_rate") not in self.config.get("tray_downloadspeedlist") and self.config.get("max_download_rate") >= 0: diff --git a/src/pref.py b/src/pref.py index 0851530a9..cc1f3e98d 100644 --- a/src/pref.py +++ b/src/pref.py @@ -53,12 +53,12 @@ DEFAULT_PREFS = { "lock_tray" : False, "max_active_torrents" : -1, "max_connections" : 600, - "max_download_rate" : -1.0, + "max_download_rate" : -1, "max_download_rate_bps": -1.0, "max_number_downloads" : -1.0, "max_number_uploads" : -1.0, "max_upload_rate" : -1.0, - "max_upload_rate_bps" : -1.0, + "max_upload_rate_bps" : -1, "max_uploads" : 2, "pref_rc4" : True, "proxy_type" : common.ProxyType.none,