mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-07 08:58:38 +00:00
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:
parent
a39b8baa72
commit
4513531ef4
2 changed files with 13 additions and 1 deletions
|
@ -61,6 +61,16 @@ class PluginManager(deluge.pluginmanagerbase.PluginManagerBase,
|
||||||
# Enable the plugins that are enabled in the config and core
|
# Enable the plugins that are enabled in the config and core
|
||||||
self.enable_plugins()
|
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..
|
## Plugin functions.. will likely move to own class..
|
||||||
|
|
||||||
def add_torrentview_text_column(self, *args, **kwargs):
|
def add_torrentview_text_column(self, *args, **kwargs):
|
||||||
|
|
|
@ -529,12 +529,14 @@ class Preferences(component.Component):
|
||||||
def on_button_ok_clicked(self, data):
|
def on_button_ok_clicked(self, data):
|
||||||
log.debug("on_button_ok_clicked")
|
log.debug("on_button_ok_clicked")
|
||||||
self.set_config()
|
self.set_config()
|
||||||
|
component.get("PluginManager").apply_prefs()
|
||||||
self.hide()
|
self.hide()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def on_button_apply_clicked(self, data):
|
def on_button_apply_clicked(self, data):
|
||||||
log.debug("on_button_apply_clicked")
|
log.debug("on_button_apply_clicked")
|
||||||
self.set_config()
|
self.set_config()
|
||||||
|
component.get("PluginManager").apply_prefs()
|
||||||
|
|
||||||
def on_button_cancel_clicked(self, data):
|
def on_button_cancel_clicked(self, data):
|
||||||
log.debug("on_button_cancel_clicked")
|
log.debug("on_button_cancel_clicked")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue