Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*- # # Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com> # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. # See LICENSE for more details. #
"""PluginManager handles the loading of plugins and provides plugins with functions to access parts of the core."""
# Call the PluginManagerBase constructor self, "core.conf", "deluge.plugin.core")
# Enable plugins that are enabled in the config
# Disable all enabled plugins
for plugin in self.plugins.keys(): if hasattr(self.plugins[plugin], "update"): try: self.plugins[plugin].update() except Exception as ex: log.exception(ex)
if name not in self.plugins: super(PluginManager, self).enable_plugin(name) if name in self.plugins: component.get("EventManager").emit(PluginEnabledEvent(name))
if name in self.plugins: super(PluginManager, self).disable_plugin(name) if name not in self.plugins: component.get("EventManager").emit(PluginDisabledEvent(name))
"""Return the value of status fields for the selected torrent_id.""" status = {} for field in fields: try: status[field] = self.status_fields[field](torrent_id) except KeyError: pass return status
"""Register a new status field. This can be used in the same way the client requests other status information from core.""" log.debug("Registering status field %s with PluginManager", field) self.status_fields[field] = function
"""Deregisters a status field""" log.debug("Deregistering status field %s with PluginManager", field) try: del self.status_fields[field] except: log.warning("Unable to deregister status field %s", field) |