Let camera object handle its own library rebuild

This commit is contained in:
Joel Collins 2020-02-18 16:16:06 +00:00
parent d39f897531
commit 0595d3c620
2 changed files with 5 additions and 5 deletions

View file

@ -1,5 +1,4 @@
from openflexure_microscope import Microscope
from openflexure_microscope.camera.capture import build_captures_from_exif
import logging
@ -8,8 +7,6 @@ default_microscope = Microscope()
# Restore loaded capture array to camera object
logging.debug("Restoring captures...")
default_microscope.camera.images = build_captures_from_exif(
default_microscope.camera.paths["default"]
)
default_microscope.camera.rebuild_captures()
logging.debug("Microscope successfully attached!")

View file

@ -8,7 +8,7 @@ import logging
from abc import ABCMeta, abstractmethod
from .capture import CaptureObject
from .capture import CaptureObject, build_captures_from_exif
from openflexure_microscope.utilities import entry_by_uuid
from labthings.core.lock import StrictLock
@ -177,6 +177,9 @@ class BaseCamera(metaclass=ABCMeta):
shutil.rmtree(self.paths["temp"])
logging.debug("Cleared {}.".format(self.paths["temp"]))
def rebuild_captures(self):
self.images = build_captures_from_exif(self.paths["default"])
# START AND STOP WORKER THREAD
def start_worker(self, timeout: int = 5) -> bool: