Module: deluge Branch: chunked-sessionproxy-and-gtkui-speedups Commit: 1ac997e7d735908ba9fde28dcfec06d514a499ac
Author: Pedro Algarvio <[email protected]> Date: Mon May 9 15:47:10 2011 +0100 Upgrade core config and handle empty AutoAdd watchdirs. We now upgrade the core's config to include 'sequential_download'. On the auto add plugin, if there are no watchdir, provide a default that will allow the GTK UI not to thrown an exception. --- deluge/core/preferencesmanager.py | 23 +++++++++++++++++++---- deluge/plugins/autoadd/autoadd/gtkui.py | 3 ++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/deluge/core/preferencesmanager.py b/deluge/core/preferencesmanager.py index 743d3ea..76b1d41 100644 --- a/deluge/core/preferencesmanager.py +++ b/deluge/core/preferencesmanager.py @@ -154,6 +154,7 @@ class PreferencesManager(component.Component): "attribute to shared.") self.config["shared"] = self.config["public"] del self.config["public"] + self.config.run_converter((0, 1), 2, self.__migrate_config_1_to_2) def start(self): self.core = component.get("Core") @@ -196,7 +197,9 @@ class PreferencesManager(component.Component): # Only set the listen ports if random_port is not true if self.config["random_port"] is not True: log.debug("listen port range set to %s-%s", value[0], value[1]) - self.session.listen_on(value[0], value[1], str(self.config["listen_interface"])) + self.session.listen_on( + value[0], value[1], str(self.config["listen_interface"]) + ) def _on_set_listen_interface(self, key, value): # Call the random_port callback since it'll do what we need @@ -218,7 +221,10 @@ class PreferencesManager(component.Component): # Set the listen ports log.debug("listen port range set to %s-%s", listen_ports[0], listen_ports[1]) - self.session.listen_on(listen_ports[0], listen_ports[1], str(self.config["listen_interface"])) + self.session.listen_on( + listen_ports[0], listen_ports[1], + str(self.config["listen_interface"]) + ) def _on_set_outgoing_ports(self, key, value): if not self.config["random_outgoing_ports"]: @@ -445,8 +451,12 @@ class PreferencesManager(component.Component): geoip_db = "" if os.path.exists(value): geoip_db = value - elif os.path.exists(pkg_resources.resource_filename("deluge", os.path.join("data", "GeoIP.dat"))): - geoip_db = pkg_resources.resource_filename("deluge", os.path.join("data", "GeoIP.dat")) + elif os.path.exists( + pkg_resources.resource_filename("deluge", + os.path.join("data", "GeoIP.dat"))): + geoip_db = pkg_resources.resource_filename( + "deluge", os.path.join("data", "GeoIP.dat") + ) else: log.warning("Unable to find GeoIP database file!") @@ -464,3 +474,8 @@ class PreferencesManager(component.Component): def _on_set_cache_expiry(self, key, value): log.debug("%s: %s", key, value) self.session_set_setting("cache_expiry", value) + + def __migrate_config_1_to_2(self, config): + if 'sequential_download' not in config: + config['sequential_download'] = DEFAULT_PREFS['sequential_download'] + return config diff --git a/deluge/plugins/autoadd/autoadd/gtkui.py b/deluge/plugins/autoadd/autoadd/gtkui.py index 18ce63f..d06daae 100644 --- a/deluge/plugins/autoadd/autoadd/gtkui.py +++ b/deluge/plugins/autoadd/autoadd/gtkui.py @@ -458,7 +458,8 @@ class GtkUI(GtkPluginBase): def cb_get_config(self, watchdirs): """callback for on show_prefs""" - self.watchdirs = watchdirs + log.debug("Got whatchdirs from core: %s", watchdirs) + self.watchdirs = watchdirs or {} self.store.clear() for watchdir_id, watchdir in self.watchdirs.iteritems(): self.store.append([ -- You received this message because you are subscribed to the Google Groups "deluge-commit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/deluge-commit?hl=en.
