Removed old plugin system

This commit is contained in:
Joel Collins 2019-12-18 15:04:55 +00:00
parent a77ed8e273
commit 45c8d2b47f
7 changed files with 1 additions and 435 deletions

View file

@ -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
@ -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):
@ -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
@ -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
@ -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
@ -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):
"""
@ -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: