Restructured builtin plugins and docstrings
This commit is contained in:
parent
9ca821c24c
commit
95a3abde7e
7 changed files with 104 additions and 35 deletions
|
|
@ -12,19 +12,9 @@ class IdentifyAPI(MicroscopeViewPlugin):
|
|||
"""
|
||||
def get(self):
|
||||
"""
|
||||
Method to call when an HTTP GET request is made.
|
||||
Default plugin to return a plaintext representation of the camera and stage objects.
|
||||
|
||||
.. :quickref: Default plugin; Show representation of camera and stage objects.
|
||||
"""
|
||||
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)
|
||||
return Response(escape(data))
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
from openflexure_microscope.plugins import MicroscopePlugin
|
||||
|
||||
from .api import IdentifyAPI, HelloWorldAPI
|
||||
from .api import IdentifyAPI
|
||||
|
||||
|
||||
class Plugin(MicroscopePlugin):
|
||||
|
|
@ -10,7 +10,6 @@ class Plugin(MicroscopePlugin):
|
|||
|
||||
api_views = {
|
||||
'/identify': IdentifyAPI,
|
||||
'/hello': HelloWorldAPI,
|
||||
}
|
||||
|
||||
def identify(self):
|
||||
|
|
@ -21,10 +20,3 @@ class Plugin(MicroscopePlugin):
|
|||
response = "My parent camera is {}, and my parent stage is {}.".format(self.microscope.camera, self.microscope.stage)
|
||||
print(response)
|
||||
return response
|
||||
|
||||
def hello_world(self):
|
||||
"""
|
||||
Demonstrate passive method
|
||||
"""
|
||||
|
||||
return "Hello world!"
|
||||
Loading…
Add table
Add a link
Reference in a new issue