diff --git a/deluge/core/core.py b/deluge/core/core.py index 93ab345ef..d60b6b53a 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -56,6 +56,7 @@ from deluge.log import LOG as log DEFAULT_PREFS = { "daemon_port": 58846, + "allow_remote": False, "compact_allocation": True, "download_location": deluge.common.get_default_download_dir(), "listen_ports": [6881, 6891], @@ -95,11 +96,16 @@ class Core( if port == None: port = self.config["daemon_port"] + if self.config["allow_remote"]: + hostname = "" + else: + hostname = "localhost" + # Setup the xmlrpc server try: log.info("Starting XMLRPC server on port %s", port) SimpleXMLRPCServer.SimpleXMLRPCServer.__init__( - self, ("localhost", port), logRequests=False, allow_none=True) + self, (hostname, port), logRequests=False, allow_none=True) except: log.info("Daemon already running or port not available..") sys.exit(0) diff --git a/deluge/ui/client.py b/deluge/ui/client.py index 8f0ae6290..75dd8c788 100644 --- a/deluge/ui/client.py +++ b/deluge/ui/client.py @@ -58,14 +58,17 @@ class CoreProxy: def set_core_uri(self, uri): log.info("Setting core uri as %s", uri) - + if uri == None and self._uri != None: for callback in self._on_no_core_callbacks: callback() self._uri = None self._core = None return - + + if uri != self._uri: + self._core = None + self._uri = uri # Get a new core self.get_core() diff --git a/deluge/ui/gtkui/glade/preferences_dialog.glade b/deluge/ui/gtkui/glade/preferences_dialog.glade index 3fee5dcda..0c8266f0e 100644 --- a/deluge/ui/gtkui/glade/preferences_dialog.glade +++ b/deluge/ui/gtkui/glade/preferences_dialog.glade @@ -1,6 +1,6 @@ - + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -966,9 +966,15 @@ Either - + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + page 7 + tab + 1 + False @@ -1030,71 +1036,40 @@ Either 2 15 - + True - The maximum upload speed for all torrents. Set -1 for unlimited. - 0 - Maximum Upload Speed (KiB/s): - - - 2 - 3 - GTK_FILL - - - - - True - The maximum number of connections allowed. Set -1 for unlimited. - 0 - Maximum Connections: - - - GTK_FILL - - - - - True - The maximum upload speed for all torrents. Set -1 for unlimited. - 0 - Maximum Upload Slots: + True + The maximum upload slots for all torrents. Set -1 for unlimited. + 1 + -1 -1 9000 1 10 10 + 1 + True + True + 1 + 2 3 4 GTK_FILL - + True True - The maximum number of connections allowed. Set -1 for unlimited. - 4 + The maximum upload speed for all torrents. Set -1 for unlimited. 1 -1 -1 9000 1 10 10 1 - True + 1 True - GTK_UPDATE_IF_VALID 1 2 - GTK_FILL - - - - - True - The maximum download speed for all torrents. Set -1 for unlimited. - 0 - Maximum Download Speed (KiB/s): - - - 1 - 2 + 2 + 3 GTK_FILL @@ -1119,43 +1094,74 @@ Either - + True - True - The maximum upload speed for all torrents. Set -1 for unlimited. - 1 - -1 -1 9000 1 10 10 - 1 - 1 - True + The maximum download speed for all torrents. Set -1 for unlimited. + 0 + Maximum Download Speed (KiB/s): - 1 - 2 - 2 - 3 + 1 + 2 GTK_FILL - + True True - The maximum upload slots for all torrents. Set -1 for unlimited. + The maximum number of connections allowed. Set -1 for unlimited. + 4 1 -1 -1 9000 1 10 10 1 True True + GTK_UPDATE_IF_VALID 1 2 + GTK_FILL + + + + + True + The maximum upload speed for all torrents. Set -1 for unlimited. + 0 + Maximum Upload Slots: + + 3 4 GTK_FILL + + + True + The maximum number of connections allowed. Set -1 for unlimited. + 0 + Maximum Connections: + + + GTK_FILL + + + + + True + The maximum upload speed for all torrents. Set -1 for unlimited. + 0 + Maximum Upload Speed (KiB/s): + + + 2 + 3 + GTK_FILL + + @@ -1199,29 +1205,24 @@ Either 2 15 - + True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Maximum Upload Slots: + True + The maximum upload slots per torrent. Set -1 for unlimited. + 1 + -1 -1 9000 1 10 10 + 1 + True + True + 1 + 2 1 2 GTK_FILL - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Maximum Connections: - - - GTK_FILL - - True @@ -1239,19 +1240,24 @@ Either - + True - True - The maximum upload slots per torrent. Set -1 for unlimited. - 1 - -1 -1 9000 1 10 10 - 1 - True - True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Maximum Connections: + + + GTK_FILL + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Maximum Upload Slots: - 1 - 2 1 2 GTK_FILL @@ -1502,15 +1508,33 @@ Either 2 10 - + True - False True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Open folder with: + 0 + True + True + + + + GTK_FILL + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Custom: + 0 + True + True + radio_open_folder_stock + - 1 - 2 1 2 GTK_FILL @@ -1540,38 +1564,20 @@ Thunar - + True + False True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Custom: - 0 - True - True - radio_open_folder_stock - + 1 + 2 1 2 GTK_FILL - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Open folder with: - 0 - True - True - - - - GTK_FILL - - @@ -1799,6 +1805,179 @@ Thunar tab + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_RESIZE_QUEUE + GTK_SHADOW_NONE + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0.05000000074505806 + 10 + <i><b><big>Daemon</big></b></i> + True + + + False + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + False + 1 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + GTK_SHADOW_NONE + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 2 + 12 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Daemon port: + + + False + False + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 1 + 0 0 65535 1 10 10 + + + False + False + 1 + + + + + False + False + + + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + <b>Port</b> + True + + + label_item + + + + + False + False + 5 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + GTK_SHADOW_NONE + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + 10 + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Allow Remote Connections + 0 + True + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + <b>Connections</b> + True + + + label_item + + + + + False + False + 5 + 3 + + + + + + + + + 5 + + + + + + tab + + True @@ -1882,7 +2061,7 @@ Thunar - 5 + 6 diff --git a/deluge/ui/gtkui/preferences.py b/deluge/ui/gtkui/preferences.py index d03522b4d..49f797ef6 100644 --- a/deluge/ui/gtkui/preferences.py +++ b/deluge/ui/gtkui/preferences.py @@ -63,7 +63,7 @@ class Preferences(component.Component): # Add the default categories i = 0 for category in ["Downloads", "Network", "Bandwidth", "Interface", - "Other", "Plugins"]: + "Other", "Daemon", "Plugins"]: self.liststore.append([i, category]) i += 1 @@ -189,7 +189,11 @@ class Preferences(component.Component): "spin_max_connections_per_torrent": \ ("value", self.core_config["max_connections_per_torrent"]), "spin_max_upload_slots_per_torrent": \ - ("value", self.core_config["max_upload_slots_per_torrent"]) + ("value", self.core_config["max_upload_slots_per_torrent"]), + "spin_daemon_port": \ + ("value", self.core_config["daemon_port"]), + "chk_allow_remote_connections": \ + ("active", self.core_config["allow_remote"]) } # Update the widgets accordingly @@ -237,7 +241,9 @@ class Preferences(component.Component): "spin_max_upload", "spin_max_upload_slots_global", "spin_max_connections_per_torrent", - "spin_max_upload_slots_per_torrent" + "spin_max_upload_slots_per_torrent", + "spin_daemon_port", + "chk_allow_remote_connections" ] # We don't appear to be connected to a daemon for key in core_widget_list: @@ -255,7 +261,7 @@ class Preferences(component.Component): self.glade.get_widget("chk_enable_files_dialog").set_active( self.gtkui_config["enable_files_dialog"]) - ## Other tab ## + ## Interface tab ## self.glade.get_widget("chk_use_tray").set_active( self.gtkui_config["enable_system_tray"]) self.glade.get_widget("chk_min_on_close").set_active( @@ -272,7 +278,8 @@ class Preferences(component.Component): self.gtkui_config["open_folder_stock"]) self.glade.get_widget("radio_open_folder_custom").set_active( not self.gtkui_config["open_folder_stock"]) - + + ## Other tab ## self.glade.get_widget("chk_new_releases").set_active( self.gtkui_config["check_new_releases"]) @@ -363,7 +370,7 @@ class Preferences(component.Component): self.glade.get_widget( "spin_max_upload_slots_per_torrent").get_value_as_int() - ## Other tab ## + ## Interface tab ## new_gtkui_config["enable_system_tray"] = \ self.glade.get_widget("chk_use_tray").get_active() new_gtkui_config["close_to_tray"] = \ @@ -382,13 +389,20 @@ class Preferences(component.Component): self.glade.get_widget("txt_open_folder_location").get_text() new_gtkui_config["open_folder_stock"] = \ self.glade.get_widget("radio_open_folder_stock").get_active() - + + ## Other tab ## new_gtkui_config["check_new_releases"] = \ self.glade.get_widget("chk_new_releases").get_active() new_gtkui_config["send_info"] = \ self.glade.get_widget("chk_send_info").get_active() + ## Daemon tab ## + new_core_config["daemon_port"] = \ + self.glade.get_widget("spin_daemon_port").get_value_as_int() + new_core_config["allow_remote"] = \ + self.glade.get_widget("chk_allow_remote_connections").get_active() + # GtkUI for key in new_gtkui_config.keys(): # The values do not match so this needs to be updated