Fixed broken references
This commit is contained in:
parent
caf553db7a
commit
45ee112e6f
2 changed files with 13 additions and 9 deletions
|
|
@ -92,7 +92,7 @@ class AutostorageExtension(BaseExtension):
|
||||||
description="Handle switching capture storage devices",
|
description="Handle switching capture storage devices",
|
||||||
)
|
)
|
||||||
|
|
||||||
# We'll store a reference to a camera object, who's capture paths will be modified
|
# We'll store a reference to a CaptureManager object, who's capture paths will be modified
|
||||||
self.capture_manager = None
|
self.capture_manager = None
|
||||||
|
|
||||||
self.initial_location = get_default_location()
|
self.initial_location = get_default_location()
|
||||||
|
|
@ -103,10 +103,12 @@ class AutostorageExtension(BaseExtension):
|
||||||
def on_microscope(self, microscope_obj):
|
def on_microscope(self, microscope_obj):
|
||||||
"""Function to automatically call when the parent LabThing has a microscope attached."""
|
"""Function to automatically call when the parent LabThing has a microscope attached."""
|
||||||
logging.debug(f"Autostorage extension found microscope {microscope_obj}")
|
logging.debug(f"Autostorage extension found microscope {microscope_obj}")
|
||||||
if hasattr(microscope_obj, "camera"):
|
if hasattr(microscope_obj, "captures"):
|
||||||
logging.debug(f"Autostorage extension bound to camera {self.camera}")
|
logging.debug(
|
||||||
|
f"Autostorage extension bound to CaptureManager {self.capture_manager}"
|
||||||
|
)
|
||||||
|
|
||||||
# Store a reference to the camera
|
# Store a reference to the CaptureManager
|
||||||
self.capture_manager = microscope_obj.captures
|
self.capture_manager = microscope_obj.captures
|
||||||
# Store the initial storage location
|
# Store the initial storage location
|
||||||
self.initial_location = get_current_location(self.capture_manager)
|
self.initial_location = get_current_location(self.capture_manager)
|
||||||
|
|
@ -128,13 +130,13 @@ class AutostorageExtension(BaseExtension):
|
||||||
set_current_location(self.capture_manager, get_default_location())
|
set_current_location(self.capture_manager, get_default_location())
|
||||||
|
|
||||||
def get_locations(self):
|
def get_locations(self):
|
||||||
if self.camera:
|
if self.capture_manager:
|
||||||
locations = get_all_locations()
|
locations = get_all_locations()
|
||||||
|
|
||||||
current_location = get_current_location(self.capture_manager)
|
current_location = get_current_location(self.capture_manager)
|
||||||
if current_location not in locations.values():
|
if current_location not in locations.values():
|
||||||
locations.update({"Custom": current_location})
|
locations.update({"Custom": current_location})
|
||||||
# Add location from the cameras settings file
|
# Add location from the CaptureManager settings file
|
||||||
return locations
|
return locations
|
||||||
else:
|
else:
|
||||||
return {}
|
return {}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import datetime
|
||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
|
|
||||||
from openflexure_microscope.camera.base import generate_basename
|
from openflexure_microscope.captures.capture_manager import generate_basename
|
||||||
from labthings.server.find import find_component, find_extension
|
from labthings.server.find import find_component, find_extension
|
||||||
from labthings.server.extensions import BaseExtension
|
from labthings.server.extensions import BaseExtension
|
||||||
from labthings.server.decorators import marshal_task, use_args, ThingAction
|
from labthings.server.decorators import marshal_task, use_args, ThingAction
|
||||||
|
|
@ -90,10 +90,12 @@ def capture(
|
||||||
filename=filename,
|
filename=filename,
|
||||||
folder=folder,
|
folder=folder,
|
||||||
temporary=temporary,
|
temporary=temporary,
|
||||||
use_video_port=use_video_port, resize=resize, bayer=bayer,
|
use_video_port=use_video_port,
|
||||||
|
resize=resize,
|
||||||
|
bayer=bayer,
|
||||||
annotations=annotations,
|
annotations=annotations,
|
||||||
tags=tags,
|
tags=tags,
|
||||||
metadata=metadata
|
metadata=metadata,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue