Loading openflexure_microscope/api/default_extensions/zip_builder.py +1 −1 Original line number Diff line number Diff line Loading @@ -80,7 +80,7 @@ class ZipManager: # Get array of captures from IDs capture_list = [ microscope.camera.images.get(capture_id) for capture_id in capture_id_list microscope.captures.images.get(capture_id) for capture_id in capture_id_list ] # Remove Nones from list (missing/invalid captures) capture_list = [capture for capture in capture_list if capture] Loading openflexure_microscope/api/v2/views/captures.py +10 −10 Original line number Diff line number Diff line Loading @@ -100,7 +100,7 @@ class CaptureList(View): List all image captures """ microscope = find_component("org.openflexure.microscope") image_list = microscope.camera.images.values() image_list = microscope.captures.images.values() return image_list Loading @@ -112,7 +112,7 @@ class CaptureView(View): Description of a single image capture """ microscope = find_component("org.openflexure.microscope") capture_obj = microscope.camera.images.get(id) capture_obj = microscope.captures.images.get(id) if not capture_obj: return abort(404) # 404 Not Found Loading @@ -124,7 +124,7 @@ class CaptureView(View): Delete a single image capture """ microscope = find_component("org.openflexure.microscope") capture_obj = microscope.camera.images.get(id) capture_obj = microscope.captures.images.get(id) if not capture_obj: return abort(404) # 404 Not Found Loading @@ -132,7 +132,7 @@ class CaptureView(View): # Delete the capture file capture_obj.delete() # Delete from capture list del microscope.camera.images[id] del microscope.captures.images[id] return "", 204 Loading @@ -145,7 +145,7 @@ class CaptureDownload(View): Image data for a single image capture """ microscope = find_component("org.openflexure.microscope") capture_obj = microscope.camera.images.get(id) capture_obj = microscope.captures.images.get(id) if not capture_obj: return abort(404) # 404 Not Found Loading Loading @@ -180,7 +180,7 @@ class CaptureTags(View): Get tags associated with a single image capture """ microscope = find_component("org.openflexure.microscope") capture_obj = microscope.camera.images.get(id) capture_obj = microscope.captures.images.get(id) if not capture_obj: return abort(404) # 404 Not Found Loading @@ -192,7 +192,7 @@ class CaptureTags(View): Add tags to a single image capture """ microscope = find_component("org.openflexure.microscope") capture_obj = microscope.camera.images.get(id) capture_obj = microscope.captures.images.get(id) if not capture_obj: return abort(404) # 404 Not Found Loading @@ -212,7 +212,7 @@ class CaptureTags(View): Delete tags from a single image capture """ microscope = find_component("org.openflexure.microscope") capture_obj = microscope.camera.images.get(id) capture_obj = microscope.captures.images.get(id) if not capture_obj: return abort(404) # 404 Not Found Loading @@ -235,7 +235,7 @@ class CaptureAnnotations(View): Get annotations associated with a single image capture """ microscope = find_component("org.openflexure.microscope") capture_obj = microscope.camera.images.get(id) capture_obj = microscope.captures.images.get(id) if not capture_obj: return abort(404) # 404 Not Found Loading @@ -247,7 +247,7 @@ class CaptureAnnotations(View): Update metadata for a single image capture """ microscope = find_component("org.openflexure.microscope") capture_obj = microscope.camera.images.get(id) capture_obj = microscope.captures.images.get(id) if not capture_obj: return abort(404) # 404 Not Found Loading openflexure_microscope/camera/base.py +0 −6 Original line number Diff line number Diff line Loading @@ -79,12 +79,6 @@ class BaseCamera(metaclass=ABCMeta): def close(self): """Close the BaseCamera and all attached StreamObjects.""" logging.info("Closing {}".format(self)) # Close all StreamObjects for capture_list in [self.images.values(), self.videos.values()]: for stream_object in capture_list: stream_object.close() # Empty temp directory self.clear_tmp() # Stop worker thread self.stop_worker() logging.info("Closed {}".format(self)) Loading openflexure_microscope/captures/capture_manager.py +17 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,23 @@ class CaptureManager: # FILE MANAGEMENT def __enter__(self): """Create camera on context enter.""" return self def __exit__(self, exc_type, exc_value, traceback): """Close camera stream on context exit.""" self.close() def close(self): logging.info("Closing {}".format(self)) # Close all StreamObjects for capture_list in [self.images.values(), self.videos.values()]: for stream_object in capture_list: stream_object.close() # Empty temp directory self.clear_tmp() def clear_tmp(self): """ Removes all files in the temporary capture directories Loading openflexure_microscope/microscope.py +1 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,7 @@ class Microscope: self.camera.close() if self.stage: self.stage.close() self.captures.close() logging.info("Closed {}".format(self)) def setup(self, configuration): Loading Loading
openflexure_microscope/api/default_extensions/zip_builder.py +1 −1 Original line number Diff line number Diff line Loading @@ -80,7 +80,7 @@ class ZipManager: # Get array of captures from IDs capture_list = [ microscope.camera.images.get(capture_id) for capture_id in capture_id_list microscope.captures.images.get(capture_id) for capture_id in capture_id_list ] # Remove Nones from list (missing/invalid captures) capture_list = [capture for capture in capture_list if capture] Loading
openflexure_microscope/api/v2/views/captures.py +10 −10 Original line number Diff line number Diff line Loading @@ -100,7 +100,7 @@ class CaptureList(View): List all image captures """ microscope = find_component("org.openflexure.microscope") image_list = microscope.camera.images.values() image_list = microscope.captures.images.values() return image_list Loading @@ -112,7 +112,7 @@ class CaptureView(View): Description of a single image capture """ microscope = find_component("org.openflexure.microscope") capture_obj = microscope.camera.images.get(id) capture_obj = microscope.captures.images.get(id) if not capture_obj: return abort(404) # 404 Not Found Loading @@ -124,7 +124,7 @@ class CaptureView(View): Delete a single image capture """ microscope = find_component("org.openflexure.microscope") capture_obj = microscope.camera.images.get(id) capture_obj = microscope.captures.images.get(id) if not capture_obj: return abort(404) # 404 Not Found Loading @@ -132,7 +132,7 @@ class CaptureView(View): # Delete the capture file capture_obj.delete() # Delete from capture list del microscope.camera.images[id] del microscope.captures.images[id] return "", 204 Loading @@ -145,7 +145,7 @@ class CaptureDownload(View): Image data for a single image capture """ microscope = find_component("org.openflexure.microscope") capture_obj = microscope.camera.images.get(id) capture_obj = microscope.captures.images.get(id) if not capture_obj: return abort(404) # 404 Not Found Loading Loading @@ -180,7 +180,7 @@ class CaptureTags(View): Get tags associated with a single image capture """ microscope = find_component("org.openflexure.microscope") capture_obj = microscope.camera.images.get(id) capture_obj = microscope.captures.images.get(id) if not capture_obj: return abort(404) # 404 Not Found Loading @@ -192,7 +192,7 @@ class CaptureTags(View): Add tags to a single image capture """ microscope = find_component("org.openflexure.microscope") capture_obj = microscope.camera.images.get(id) capture_obj = microscope.captures.images.get(id) if not capture_obj: return abort(404) # 404 Not Found Loading @@ -212,7 +212,7 @@ class CaptureTags(View): Delete tags from a single image capture """ microscope = find_component("org.openflexure.microscope") capture_obj = microscope.camera.images.get(id) capture_obj = microscope.captures.images.get(id) if not capture_obj: return abort(404) # 404 Not Found Loading @@ -235,7 +235,7 @@ class CaptureAnnotations(View): Get annotations associated with a single image capture """ microscope = find_component("org.openflexure.microscope") capture_obj = microscope.camera.images.get(id) capture_obj = microscope.captures.images.get(id) if not capture_obj: return abort(404) # 404 Not Found Loading @@ -247,7 +247,7 @@ class CaptureAnnotations(View): Update metadata for a single image capture """ microscope = find_component("org.openflexure.microscope") capture_obj = microscope.camera.images.get(id) capture_obj = microscope.captures.images.get(id) if not capture_obj: return abort(404) # 404 Not Found Loading
openflexure_microscope/camera/base.py +0 −6 Original line number Diff line number Diff line Loading @@ -79,12 +79,6 @@ class BaseCamera(metaclass=ABCMeta): def close(self): """Close the BaseCamera and all attached StreamObjects.""" logging.info("Closing {}".format(self)) # Close all StreamObjects for capture_list in [self.images.values(), self.videos.values()]: for stream_object in capture_list: stream_object.close() # Empty temp directory self.clear_tmp() # Stop worker thread self.stop_worker() logging.info("Closed {}".format(self)) Loading
openflexure_microscope/captures/capture_manager.py +17 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,23 @@ class CaptureManager: # FILE MANAGEMENT def __enter__(self): """Create camera on context enter.""" return self def __exit__(self, exc_type, exc_value, traceback): """Close camera stream on context exit.""" self.close() def close(self): logging.info("Closing {}".format(self)) # Close all StreamObjects for capture_list in [self.images.values(), self.videos.values()]: for stream_object in capture_list: stream_object.close() # Empty temp directory self.clear_tmp() def clear_tmp(self): """ Removes all files in the temporary capture directories Loading
openflexure_microscope/microscope.py +1 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,7 @@ class Microscope: self.camera.close() if self.stage: self.stage.close() self.captures.close() logging.info("Closed {}".format(self)) def setup(self, configuration): Loading