Commit d681a206 authored by Joel Collins's avatar Joel Collins
Browse files

Started re-writing plugin documentation

parent 367c68ad
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@ Camera Functionality

.. toctree::
   :maxdepth: 2
   :caption: Contents:

   picamera.rst
   basecamera.rst
+17 −0
Original line number Diff line number Diff line
Plugin mounts
===============
.. automodule:: openflexure_microscope.plugins
    :members:

Default plugins
===============

Microscope plugin
+++++++++++++++++
.. automodule:: openflexure_microscope.plugins.default.plugin
    :members:

Web API plugin
++++++++++++++
.. automodule:: openflexure_microscope.plugins.default.api
    :members:
+24 −8
Original line number Diff line number Diff line
Plugin System
=============
Plugins
=======================================================

.. automodule:: openflexure_microscope.plugins
    :members:
Introduction
------------

Example Plugin
--------------
Single-file plugins
+++++++++++++++++++

.. automodule:: openflexure_microscope.plugins.default.test_plugin
    :members:
 No newline at end of file
Package plugins
+++++++++++++++

Loading plugins with microscoperc.yaml
++++++++++++++++++++++++++++++++++++++

Microscope plugin structure
---------------------------

Adding web API routes
---------------------

Mounting and built-ins
----------------------
.. toctree::
   :maxdepth: 2

   pluginmounts.rst
 No newline at end of file
+1 −2
Original line number Diff line number Diff line
@@ -23,4 +23,3 @@ picamera_params:
# Default plugins
plugins:
  - openflexure_microscope.plugins.default:Plugin
 No newline at end of file
  - openflexure_microscope.plugins.test_plugin:FirstPlugin
 No newline at end of file
+12 −2
Original line number Diff line number Diff line
@@ -7,14 +7,24 @@ import logging


class IdentifyAPI(MicroscopeViewPlugin):

    """
    A simple example API plugin, attached through the main microscope plugin.
    """
    def get(self):
        """
        Method to call when an HTTP GET request is made.
        """
        data = self.microscope.plugin.default.identify()  # Call a method from our plugin, using the full route
        return Response(escape(data))


class HelloWorldAPI(MicroscopeViewPlugin):

    """
    An even simpler example API plugin, which just returns static data without using the microscope.
    """
    def get(self):
        """
        Method to call when an HTTP GET request is made.
        """
        data = self.plugin.hello_world()  # Call a method from our plugin, using the MicroscopeViewPlugin.plugin shortcut
        return Response(data)
Loading