From 5867afa5b57599e33e7c91fe347dcf569991ec2f Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Tue, 11 Dec 2018 17:20:00 +0000 Subject: [PATCH] Attach plugins to webapp --- openflexure_microscope/api/app.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/openflexure_microscope/api/app.py b/openflexure_microscope/api/app.py index 155e8475..3a6c184e 100644 --- a/openflexure_microscope/api/app.py +++ b/openflexure_microscope/api/app.py @@ -70,17 +70,20 @@ def attach_microscope(): logging.debug("First request made. Populating microscope with hardware...") openflexurerc = config.load_config() # Load default user config - logging.debug("Creating camera object.") + logging.debug("Creating camera object...") api_camera = StreamingCamera(config=openflexurerc) - logging.debug("Creating stage object.") + logging.debug("Creating stage object...") api_stage = OpenFlexureStage("/dev/ttyUSB0") - logging.debug("Attaching to microscope.") + logging.debug("Attaching devices to microscope...") api_microscope.attach( api_camera, api_stage ) + logging.debug("Attaching plugins to microscope...") + api_microscope.find_plugins() # Automatically find microscope plugins + logging.debug("Microscope successfully attached!") @@ -111,6 +114,10 @@ app.register_blueprint(stage_blueprint, url_prefix=uri('/stage', 'v1')) camera_blueprint = blueprints.camera.construct_blueprint(api_microscope) app.register_blueprint(camera_blueprint, url_prefix=uri('/camera', 'v1')) +# Pluginroutes +plugin_blueprint = blueprints.plugins.construct_blueprint(api_microscope) +app.register_blueprint(plugin_blueprint, url_prefix=uri('/plugin', 'v1')) + # List all routes list_routes(app)