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. #
"Name", "License", "Author", "Home-page", "Summary", "Platform", "Version", "Author-email", "Description", ]
The plugin %s is not using the "deluge.plugins" namespace. In order to avoid package name clashes between regular python packages and deluge plugins, the way deluge plugins should be created has changed. If you're seeing this message and you're not the developer of the plugin which triggered this warning, please report to it's author. If you're the developer, please take a look at the plugins hosted on deluge's git repository to have an idea of what needs to be changed. """
"""PluginManagerBase is a base class for PluginManagers to inherit"""
# Create the plugins folder if it doesn't exist
# This is the entry we want to load..
# Loaded plugins
# Scan the plugin folders for plugins
# Load plugins that are enabled in the config. self.enable_plugin(name)
# Disable all plugins that are enabled self.disable_plugin(key)
return self.plugins[key]
"""Returns a list of the available plugins name"""
"""Returns a list of enabled plugins""" return self.plugins.keys()
"""Scans for available plugins"""
self.pkg_env[name][0].project_name, self.pkg_env[name][0].version, self.pkg_env[name][0].location)
"""Enables a plugin""" if plugin_name not in self.available_plugins: log.warning("Cannot enable non-existant plugin %s", plugin_name) return
if plugin_name in self.plugins: log.warning("Cannot enable already enabled plugin %s", plugin_name) return
plugin_name = plugin_name.replace(" ", "-") egg = self.pkg_env[plugin_name][0] egg.activate() for name in egg.get_entry_map(self.entry_name): entry_point = egg.get_entry_info(self.entry_name, name) try: cls = entry_point.load() instance = cls(plugin_name.replace("-", "_")) except Exception as ex: log.error("Unable to instantiate plugin %r from %r!", name, egg.location) log.exception(ex) continue instance.enable() if not instance.__module__.startswith("deluge.plugins."): import warnings warnings.warn_explicit( DEPRECATION_WARNING % name, DeprecationWarning, instance.__module__, 0 ) if self._component_state == "Started": component.start([instance.plugin._component_name]) plugin_name = plugin_name.replace("-", " ") self.plugins[plugin_name] = instance if plugin_name not in self.config["enabled_plugins"]: log.debug("Adding %s to enabled_plugins list in config", plugin_name) self.config["enabled_plugins"].append(plugin_name) log.info("Plugin %s enabled..", plugin_name)
"""Disables a plugin""" try: self.plugins[name].disable() component.deregister(self.plugins[name].plugin) del self.plugins[name] self.config["enabled_plugins"].remove(name) except KeyError: log.warning("Plugin %s is not enabled..", name)
log.info("Plugin %s disabled..", name)
"""Returns a dictionary of plugin info from the metadata""" # Missing plugin info log.warn("Failed to retrive info for plugin '%s'" % name) for k in info: info[k] = _("Not available") return info continue # This is a continuation else: |