Docs for {Reload|Restart}NeedingPlugin

This commit is contained in:
Gina Häußge 2016-10-14 14:15:19 +02:00
parent ee92fc6907
commit f7eb12a3ee
5 changed files with 31 additions and 2 deletions

View file

@ -35,6 +35,10 @@ any :ref:`settings overlays <sec-plugins-controlproperties-plugin_settings_overl
On disabling a plugin, its hook handlers, helpers, mixin implementations and settings overlays will be de-registered again.
Some plugin types require a reload of the frontend or a restart of OctoPrint for enabling/disabling them. You
can recognized such plugins by their implementations implementing :class:`~octoprint.plugin.ReloadNeedingPlugin` or
:class:`~octoprint.plugin.RestartNeedingPlugin` or providing handlers for one of the hooks marked correspondingly.
.. image:: ../images/plugins_lifecycle.png
:align: center
:alt: The lifecycle of OctoPrint plugins.

View file

@ -732,6 +732,10 @@ octoprint.server.http.bodysize
The path of the route will be prefixed by OctoPrint with ``/plugin/<plugin identifier>/`` (if the path already begins
with a ``/`` that will be stripped first).
.. important::
Implementing this hook will make your plugin require a restart of OctoPrint for enabling/disabling it fully.
**Example**
The following plugin example sets the maximum body size for ``POST`` requests against four custom URLs to 100, 200,
@ -779,6 +783,10 @@ octoprint.server.http.routes
view of the blueprint will thus not be reachable since processing of the request will directly be handed over
to your defined handler class.
.. important::
Implementing this hook will make your plugin require a restart of OctoPrint for enabling/disabling it fully.
**Example**
The following example registers two new routes ``/plugin/add_tornado_route/download`` and ``/plugin/add_tornado_route/forward``

View file

@ -276,3 +276,20 @@ SlicerPlugin
:members:
:show-inheritance:
.. _sec-plugins-mixins-restartneeding:
RestartNeedingPlugin
~~~~~~~~~~~~~~~~~~~~
.. autoclass:: octoprint.plugin.RestartNeedingPlugin
:members:
:show-inheritance:
.. _sec-plugins-mixins-reloadneeding:
ReloadNeedingPlugin
~~~~~~~~~~~~~~~~~~~
.. autoclass:: octoprint.plugin.ReloadNeedingPlugin
:members:
:show-inheritance:

View file

@ -1396,7 +1396,7 @@ class Plugin(object):
class RestartNeedingPlugin(Plugin):
"""
Mixin for plugin types that need a restart in order to be enabled.
Mixin for plugin types that need a restart after enabling/disabling them.
"""
class SortablePlugin(Plugin):

View file

@ -101,7 +101,7 @@ class OctoPrintPlugin(Plugin):
class ReloadNeedingPlugin(Plugin):
"""
Mixin for plugin types that need a reload of the UI in order to become usable.
Mixin for plugin types that need a reload of the UI after enabling/disabling them.
"""
class StartupPlugin(OctoPrintPlugin, SortablePlugin):