Loading openflexure_microscope/api/__init__.py +0 −3 Original line number Diff line number Diff line __all__ = ["utilities", "views"] from . import utilities, views openflexure_microscope/api/v2/views/actions/__init__.py +0 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,6 @@ from flask import Blueprint, url_for, jsonify from openflexure_microscope.api.utilities import blueprint_for_module from openflexure_microscope.utilities import get_docstring, description_from_view from openflexure_microscope.api.views import MicroscopeView from . import camera, stage, system Loading openflexure_microscope/api/views.pydeleted 100644 → 0 +0 −28 Original line number Diff line number Diff line from flask.views import MethodView class MicroscopeView(MethodView): """ Create a generic MethodView with a globally available microscope object passed as an argument. """ def __init__(self, microscope, **kwargs): self.microscope = microscope MethodView.__init__(self, **kwargs) class MicroscopeViewPlugin(MicroscopeView): """ Create a generic MethodView with a globally available microscope object passed as an argument, and a plugin reference stored in 'self'. Initially None. """ def __init__(self, microscope, plugin=None, **kwargs): self.plugin = plugin MicroscopeView.__init__(self, microscope=microscope, **kwargs) openflexure_microscope/devel/__init__.py +0 −3 Original line number Diff line number Diff line Loading @@ -5,9 +5,6 @@ Here we include some classes used frequently in plugin development, as well as some Flask imports to simplify API route development """ # Plugin classes from openflexure_microscope.plugins import MicroscopePlugin from openflexure_microscope.api.views import MicroscopeViewPlugin from openflexure_microscope.api.utilities import JsonResponse # Task management Loading openflexure_microscope/microscope.py +1 −34 Original line number Diff line number Diff line Loading @@ -12,7 +12,6 @@ from openflexure_microscope.camera.base import BaseCamera from openflexure_microscope.camera.mock import MockStreamer from openflexure_microscope.utilities import serialise_array_b64 from openflexure_microscope.plugins import PluginLoader from openflexure_microscope.common.lock import CompositeLock from openflexure_microscope.config import user_settings Loading @@ -30,7 +29,6 @@ class Microscope: stage (:py:class:`openflexure_microscope.stage.base.BaseStage`): Stage object task: (:py:class:`openflexure_microscope.task.TaskOrchestrator`): Threaded ask orchestrator for managing background tasks using microscope hardware plugins (:py:class:`openflexure_microscope.plugins.PluginLoader`): Mounting point for all microscope plugins """ def __init__(self): Loading @@ -38,7 +36,6 @@ class Microscope: self.id = uuid.uuid4().hex self.name = self.id self.fov = [0, 0] self.plugin_maps = [] self.camera = None self.stage = None Loading @@ -48,10 +45,6 @@ class Microscope: # Apply settings loaded from file self.apply_settings(user_settings.load()) # Create plugin mount-point and attach plugins from maps self.plugins = PluginLoader(self) self.attach_plugins(self.plugin_maps) def __enter__(self): """Create microscope on context enter.""" return self Loading Loading @@ -116,25 +109,6 @@ class Microscope: logging.info("Reapplying settings to newly attached devices") self.apply_settings(settings_full) def attach_plugins(self, plugin_maps: list): """ Automatically search for plugin maps in config, and attach. """ if plugin_maps: for plugin_map in plugin_maps: self.plugins.attach(plugin_map) else: logging.warning("No plugins specified. Skipping.") def reload_plugins(self): """ Empty the plugin mount and re-attach from config. """ logging.info("Tearing down existing PluginMount...") self.plugins = PluginLoader(self) logging.info("Repopulating PluginMount...") self.attach_plugins(self.plugin_maps) def has_real_stage(self): if hasattr(self, "stage") and not isinstance(self.stage, MockStage): return True Loading Loading @@ -183,8 +157,6 @@ class Microscope: self.name = config["name"] if "fov" in config: self.fov = config["fov"] if "plugins" in config: self.plugin_maps = config["plugins"] def read_settings(self, json_safe=False): """ Loading @@ -197,12 +169,7 @@ class Microscope: don't get removed from the settings file. """ settings_current = { "id": self.id, "name": self.name, "fov": self.fov, "plugins": self.plugin_maps, } settings_current = {"id": self.id, "name": self.name, "fov": self.fov} # If attached to a camera if self.camera: Loading Loading
openflexure_microscope/api/__init__.py +0 −3 Original line number Diff line number Diff line __all__ = ["utilities", "views"] from . import utilities, views
openflexure_microscope/api/v2/views/actions/__init__.py +0 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,6 @@ from flask import Blueprint, url_for, jsonify from openflexure_microscope.api.utilities import blueprint_for_module from openflexure_microscope.utilities import get_docstring, description_from_view from openflexure_microscope.api.views import MicroscopeView from . import camera, stage, system Loading
openflexure_microscope/api/views.pydeleted 100644 → 0 +0 −28 Original line number Diff line number Diff line from flask.views import MethodView class MicroscopeView(MethodView): """ Create a generic MethodView with a globally available microscope object passed as an argument. """ def __init__(self, microscope, **kwargs): self.microscope = microscope MethodView.__init__(self, **kwargs) class MicroscopeViewPlugin(MicroscopeView): """ Create a generic MethodView with a globally available microscope object passed as an argument, and a plugin reference stored in 'self'. Initially None. """ def __init__(self, microscope, plugin=None, **kwargs): self.plugin = plugin MicroscopeView.__init__(self, microscope=microscope, **kwargs)
openflexure_microscope/devel/__init__.py +0 −3 Original line number Diff line number Diff line Loading @@ -5,9 +5,6 @@ Here we include some classes used frequently in plugin development, as well as some Flask imports to simplify API route development """ # Plugin classes from openflexure_microscope.plugins import MicroscopePlugin from openflexure_microscope.api.views import MicroscopeViewPlugin from openflexure_microscope.api.utilities import JsonResponse # Task management Loading
openflexure_microscope/microscope.py +1 −34 Original line number Diff line number Diff line Loading @@ -12,7 +12,6 @@ from openflexure_microscope.camera.base import BaseCamera from openflexure_microscope.camera.mock import MockStreamer from openflexure_microscope.utilities import serialise_array_b64 from openflexure_microscope.plugins import PluginLoader from openflexure_microscope.common.lock import CompositeLock from openflexure_microscope.config import user_settings Loading @@ -30,7 +29,6 @@ class Microscope: stage (:py:class:`openflexure_microscope.stage.base.BaseStage`): Stage object task: (:py:class:`openflexure_microscope.task.TaskOrchestrator`): Threaded ask orchestrator for managing background tasks using microscope hardware plugins (:py:class:`openflexure_microscope.plugins.PluginLoader`): Mounting point for all microscope plugins """ def __init__(self): Loading @@ -38,7 +36,6 @@ class Microscope: self.id = uuid.uuid4().hex self.name = self.id self.fov = [0, 0] self.plugin_maps = [] self.camera = None self.stage = None Loading @@ -48,10 +45,6 @@ class Microscope: # Apply settings loaded from file self.apply_settings(user_settings.load()) # Create plugin mount-point and attach plugins from maps self.plugins = PluginLoader(self) self.attach_plugins(self.plugin_maps) def __enter__(self): """Create microscope on context enter.""" return self Loading Loading @@ -116,25 +109,6 @@ class Microscope: logging.info("Reapplying settings to newly attached devices") self.apply_settings(settings_full) def attach_plugins(self, plugin_maps: list): """ Automatically search for plugin maps in config, and attach. """ if plugin_maps: for plugin_map in plugin_maps: self.plugins.attach(plugin_map) else: logging.warning("No plugins specified. Skipping.") def reload_plugins(self): """ Empty the plugin mount and re-attach from config. """ logging.info("Tearing down existing PluginMount...") self.plugins = PluginLoader(self) logging.info("Repopulating PluginMount...") self.attach_plugins(self.plugin_maps) def has_real_stage(self): if hasattr(self, "stage") and not isinstance(self.stage, MockStage): return True Loading Loading @@ -183,8 +157,6 @@ class Microscope: self.name = config["name"] if "fov" in config: self.fov = config["fov"] if "plugins" in config: self.plugin_maps = config["plugins"] def read_settings(self, json_safe=False): """ Loading @@ -197,12 +169,7 @@ class Microscope: don't get removed from the settings file. """ settings_current = { "id": self.id, "name": self.name, "fov": self.fov, "plugins": self.plugin_maps, } settings_current = {"id": self.id, "name": self.name, "fov": self.fov} # If attached to a camera if self.camera: Loading