Plugin schema are now just plugin forms (requires eV 1.2)
This commit is contained in:
parent
0d7a5f71e0
commit
d9e07f913a
16 changed files with 106 additions and 98 deletions
|
|
@ -132,7 +132,7 @@ class PluginMount(object):
|
|||
def __init__(self, parent):
|
||||
self.parent = parent
|
||||
self.plugins = [] # List of plugin objects
|
||||
self.schemas = [] # List of plugin schemas
|
||||
self.forms = [] # List of plugin forms
|
||||
logging.info("Creating plugin mount")
|
||||
|
||||
@property
|
||||
|
|
@ -182,7 +182,7 @@ class PluginMount(object):
|
|||
logging.info(ConColors.OKGREEN + "Plugin {} loaded as {}.".format(plugin_map, plugin_name) + ConColors.ENDC)
|
||||
|
||||
else:
|
||||
logging.error("Error loading plugin. Moving on.")
|
||||
logging.error(f"Error loading plugin {plugin_map}. Moving on.")
|
||||
|
||||
class MicroscopePlugin:
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
"selfUpdate": true,
|
||||
"route": "/do",
|
||||
"submitLabel": "Do things",
|
||||
"schema": [
|
||||
"form": [
|
||||
[
|
||||
{
|
||||
"fieldType": "numberInput",
|
||||
|
|
@ -66,7 +66,7 @@
|
|||
"selfUpdate": true,
|
||||
"route": "/task",
|
||||
"submitLabel": "Start task",
|
||||
"schema": [
|
||||
"form": [
|
||||
{
|
||||
"fieldType": "numberInput",
|
||||
"placeholder": "",
|
||||
|
|
@ -7,16 +7,16 @@ from openflexure_microscope.devel import MicroscopePlugin
|
|||
from .api import DoAPI, TaskAPI
|
||||
|
||||
HERE = os.path.dirname(os.path.realpath(__file__))
|
||||
SCHEMA_PATH = os.path.join(HERE, "schema.json")
|
||||
FORM_PATH = os.path.join(HERE, "forms.json")
|
||||
|
||||
class ExamplePlugin(MicroscopePlugin):
|
||||
"""
|
||||
An example plugin using a comprehensive schema
|
||||
An example plugin using a comprehensive form
|
||||
"""
|
||||
global SCHEMA_PATH
|
||||
global FORM_PATH
|
||||
|
||||
with open(SCHEMA_PATH, 'r') as sc:
|
||||
api_schema = json.load(sc)
|
||||
with open(FORM_PATH, 'r') as sc:
|
||||
api_form = json.load(sc)
|
||||
|
||||
api_views = {
|
||||
'/do': DoAPI,
|
||||
|
|
@ -35,7 +35,7 @@ class ExamplePlugin(MicroscopePlugin):
|
|||
|
||||
def set_values(self, val_int, val_str, val_radio, val_check, val_select, val_disposable):
|
||||
"""
|
||||
Demonstrate a plugin with schema
|
||||
Demonstrate a plugin with form
|
||||
"""
|
||||
if val_int:
|
||||
self.val_int = int(val_int)
|
||||
Loading…
Add table
Add a link
Reference in a new issue