__plugin_init__ => __plugin_load__
This commit is contained in:
parent
2aa31024e6
commit
b61996c761
1 changed files with 4 additions and 4 deletions
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Reference in a new issue