Attempt to call 'apply_prefs()' in enabled plugins when the user clicks

OK or Apply in preferences.  This is designed to allow plugins to save 
their preferences.
This commit is contained in:
Andrew Resch 2008-02-25 02:49:30 +00:00
parent a39b8baa72
commit 4513531ef4
2 changed files with 13 additions and 1 deletions

View file

@ -60,7 +60,17 @@ class PluginManager(deluge.pluginmanagerbase.PluginManagerBase,
# Enable the plugins that are enabled in the config and core
self.enable_plugins()
def apply_prefs(self):
"""Attempts to call 'apply_prefs()' in each enabled plugin. This is
called when a user clicks OK or Apply in the preferences window and is
designed to give plugins the opportunity to save their prefs."""
for key in self.plugins.keys():
try:
self.plugins[key].apply_prefs()
except AttributeError:
pass
## Plugin functions.. will likely move to own class..
def add_torrentview_text_column(self, *args, **kwargs):

View file

@ -529,12 +529,14 @@ class Preferences(component.Component):
def on_button_ok_clicked(self, data):
log.debug("on_button_ok_clicked")
self.set_config()
component.get("PluginManager").apply_prefs()
self.hide()
return True
def on_button_apply_clicked(self, data):
log.debug("on_button_apply_clicked")
self.set_config()
component.get("PluginManager").apply_prefs()
def on_button_cancel_clicked(self, data):
log.debug("on_button_cancel_clicked")