From 2ecb233b5bb8015c3a3b4b1db26131a8d537ca33 Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Thu, 10 Dec 2009 17:35:35 +0000 Subject: [PATCH] fix uploading plugins when the daemon is not localhost --- deluge/ui/gtkui/preferences.py | 67 +++++++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 6 deletions(-) diff --git a/deluge/ui/gtkui/preferences.py b/deluge/ui/gtkui/preferences.py index 0abf7dbb6..74a9b2e3c 100644 --- a/deluge/ui/gtkui/preferences.py +++ b/deluge/ui/gtkui/preferences.py @@ -17,9 +17,9 @@ # # You should have received a copy of the GNU General Public License # along with deluge. If not, write to: -# The Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor -# Boston, MA 02110-1301, USA. +# The Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor +# Boston, MA 02110-1301, USA. # # In addition, as a special exception, the copyright holders give # permission to link the code of portions of this program with the OpenSSL @@ -469,6 +469,35 @@ class Preferences(component.Component): self.glade.get_widget("chk_show_new_releases").set_active( self.gtkui_config["show_new_releases"]) + ## Notification tab ## + self.glade.get_widget("chk_ntf_tray_blink").set_active( + self.gtkui_config["ntf_tray_blink"]) + if deluge.common.windows_check(): + self.glade.get_widget("chk_ntf_popup").set_sensitive(False) + else: + self.glade.get_widget("chk_ntf_popup").set_active( + self.gtkui_config["ntf_popup"]) + self.glade.get_widget("chk_ntf_email").set_active( + self.gtkui_config["ntf_email"]) + self.glade.get_widget("chk_ntf_sound").set_active( + self.gtkui_config["ntf_sound"]) + if self.gtkui_config["ntf_sound_path"]: + self.glade.get_widget("combo_ntf_sound_path").set_filename(self.gtkui_config["ntf_sound_path"]) + self.glade.get_widget("txt_ntf_email").set_text( + self.gtkui_config["ntf_email_add"]) + self.glade.get_widget("txt_ntf_server").set_text( + self.gtkui_config["ntf_server"]) + self.glade.get_widget("txt_ntf_username").set_text( + self.gtkui_config["ntf_username"]) + self.glade.get_widget("txt_ntf_pass").set_text( + self.gtkui_config["ntf_pass"]) + if not self.gtkui_config["ntf_security"]: + self.glade.get_widget("rad_ntf_none").set_active(True) + elif self.gtkui_config["ntf_security"] == 'SSL': + self.glade.get_widget("rad_ntf_none").set_active(True) + elif self.gtkui_config["ntf_security"] == 'TLS': + self.glade.get_widget("rad_ntf_tls").set_active(True) + ## Cache tab ## if client.connected(): self.__update_cache_status() @@ -634,6 +663,32 @@ class Preferences(component.Component): new_gtkui_config["show_rate_in_title"] = \ self.glade.get_widget("chk_show_rate_in_title").get_active() + ## Notification tab ## + new_gtkui_config["ntf_tray_blink"] = \ + self.glade.get_widget("chk_ntf_tray_blink").get_active() + new_gtkui_config["ntf_popup"] = \ + self.glade.get_widget("chk_ntf_popup").get_active() + new_gtkui_config["ntf_sound"] = \ + self.glade.get_widget("chk_ntf_sound").get_active() + new_gtkui_config["ntf_email"] = \ + self.glade.get_widget("chk_ntf_email").get_active() + new_gtkui_config["ntf_email_add"] = \ + self.glade.get_widget("txt_ntf_email").get_text() + new_gtkui_config["ntf_username"] = \ + self.glade.get_widget("txt_ntf_username").get_text() + new_gtkui_config["ntf_pass"] = \ + self.glade.get_widget("txt_ntf_pass").get_text() + new_gtkui_config["ntf_server"] = \ + self.glade.get_widget("txt_ntf_server").get_text() + new_gtkui_config["ntf_sound_path"] = \ + self.glade.get_widget("combo_ntf_sound_path").get_filename() + if self.glade.get_widget("rad_ntf_none").get_active(): + new_gtkui_config["ntf_security"] = None + elif self.glade.get_widget("rad_ntf_ssl").get_active(): + new_gtkui_config["ntf_security"] = 'SSL' + elif self.glade.get_widget("rad_ntf_tls").get_active(): + new_gtkui_config["ntf_security"] = 'TLS' + ## Other tab ## new_gtkui_config["show_new_releases"] = \ self.glade.get_widget("chk_show_new_releases").get_active() @@ -877,6 +932,7 @@ class Preferences(component.Component): chooser.destroy() return + import base64 import shutil import os.path filename = os.path.split(filepath)[1] @@ -888,9 +944,8 @@ class Preferences(component.Component): if not client.is_localhost(): # We need to send this plugin to the daemon - client.core.upload_plugin( - filename, - xmlrpclib.Binary(open(filepath, "rb").read())) + filedump = base64.encodestring(open(filepath, "rb").read()) + client.core.upload_plugin(filename, filedump) client.core.rescan_plugins() chooser.destroy()