Support "disabling unrecommended" for bundled plugins

* Extended plugin metadata by new property, only evaluated for bundled
    plugins.
  * Adjusted plugin manager to evaluate new metadata and add
    confirmation dialog with details when attempting to disable such
    a plugin.
This commit is contained in:
Gina Häußge committed 2017-03-30 14:08:47 +02:00
1 parent c3ad1d3691
commit 18e14aa412
3 files changed
+37 -3

No files matched your search

+16
View File
@@ -71,6 +71,9 @@ class PluginInfo(object):
attr_description = '__plugin_description__'
""" Module attribute from which to retrieve the plugin's description. """
attr_disabling_discouraged = '__plugin_disabling_discouraged__'
""" Module attribute from which to retrieve the reason why disabling the plugin is discouraged. Only effective if ``self.bundled`` is True. """
attr_version = '__plugin_version__'
""" Module attribute from which to retrieve the plugin's version. """
@@ -294,6 +297,19 @@ class PluginInfo(object):
"""
return self._get_instance_attribute(self.__class__.attr_description, default=self._description)
@property
def disabling_discouraged(self):
"""
Reason why disabling of this plugin is discouraged. Only evaluated for bundled plugins! Will be taken from
the disabling_discouraged attribute of the plugin module as defined in :attr:`attr_disabling_discouraged` if
available. False if unset or plugin not bundled.
Returns:
str or None: Reason why disabling this plugin is discouraged (only for bundled plugins)
"""
return self._get_instance_attribute(self.__class__.attr_disabling_discouraged, default=False) if self.bundled \
else False
@property
def version(self):
"""