From b61996c761d7b14243d1e013b784c31863022dde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 14 Apr 2015 18:01:17 +0200 Subject: [PATCH] __plugin_init__ => __plugin_load__ --- docs/plugins/concepts.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/plugins/concepts.rst b/docs/plugins/concepts.rst index 87386049..94e83c2f 100644 --- a/docs/plugins/concepts.rst +++ b/docs/plugins/concepts.rst @@ -31,8 +31,8 @@ plugin subsystem about themselves. These are simple package attributes defined i # ... __plugin_name__ = "My Plugin" - def __plugin_init__(): - # whatever you need to do to init your plugin, if anything at all + def __plugin_load__(): + # whatever you need to do to load your plugin, if anything at all pass The following properties are recognized: @@ -190,7 +190,7 @@ to register themselves with the Software Update Plugin by returning their own up If you want your hook handler to be an instance method of a mixin implementation of your plugin (for example since you need access to instance variables handed to your implementation via mixin invocations), you can get this work -by using a small trick. Instead of defining it directly via ``__plugin_hooks__`` utilize the ``__plugin_init__`` +by using a small trick. Instead of defining it directly via ``__plugin_hooks__`` utilize the ``__plugin_load__`` property instead, manually instantiate your implementation instance and then add its hook handler method to the ``__plugin_hooks__`` property and itself to the ``__plugin_implementation__`` property. See the following example. @@ -224,7 +224,7 @@ which provides it's SSDP browsing and Zeroconf browsing and publishing functions :caption: Excerpt from the Discovery Plugin showing the declaration of its exported helpers. :name: sec-plugin-concepts-helpers-example-export - def __plugin_init__(): + def __plugin_load__(): if not pybonjour: # no pybonjour available, we can't use that logging.getLogger("octoprint.plugins." + __name__).info("pybonjour is not installed, Zeroconf Discovery won't be available")