diff --git a/docs/plugins/developing.rst b/docs/plugins/developing.rst index 34681bf1..c0f1ee5c 100644 --- a/docs/plugins/developing.rst +++ b/docs/plugins/developing.rst @@ -27,6 +27,10 @@ a couple of properties describing the module: Version of your plugin ``__plugin_description__`` Description of your plugin +``__plugin_author__`` + Author of your plugin +``__plugin_url__`` + URL of the webpage of your plugin, e.g. the Github repository ``__plugin_implementations__`` Instances of one or more of the various :ref:`plugin mixins ` ``__plugin_hooks__`` diff --git a/src/octoprint/plugin/core.py b/src/octoprint/plugin/core.py index bfbbef70..770da190 100644 --- a/src/octoprint/plugin/core.py +++ b/src/octoprint/plugin/core.py @@ -20,6 +20,10 @@ class PluginInfo(object): attr_version = '__plugin_version__' + attr_author = '__plugin_author__' + + attr_url = '__plugin_url__' + attr_hooks = '__plugin_hooks__' attr_implementations = '__plugin_implementations__' @@ -34,6 +38,7 @@ class PluginInfo(object): self.key = key self.location = location self.instance = instance + self.origin = None self._version = version @@ -71,6 +76,14 @@ class PluginInfo(object): def version(self): return self._version if self._version is not None else self._get_instance_attribute(self.__class__.attr_version, default=None) + @property + def author(self): + return self._get_instance_attribute(self.__class__.attr_author, default=None) + + @property + def url(self): + return self._get_instance_attribute(self.__class__.attr_url, default=None) + @property def hooks(self): return self._get_instance_attribute(self.__class__.attr_hooks, default={}) @@ -153,6 +166,7 @@ class PluginManager(object): plugin = self._load_plugin_from_module(key, folder=folder) if plugin: + plugin.origin = ("folder", folder) plugins[key] = plugin return plugins @@ -179,6 +193,7 @@ class PluginManager(object): plugin = self._load_plugin_from_module(key, module_name=module_name, version=version) if plugin: + plugin.origin = ("entry_point", group) plugins[key] = plugin return plugins