Blackened
This commit is contained in:
parent
585633020b
commit
829c58d3fb
6 changed files with 18 additions and 7 deletions
|
|
@ -1,3 +1,3 @@
|
||||||
from .autofocus import autofocus_extension_v2
|
from .autofocus import autofocus_extension_v2
|
||||||
from .scan import scan_extension_v2
|
from .scan import scan_extension_v2
|
||||||
from .zip_builder import zip_extension_v2
|
from .zip_builder import zip_extension_v2
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,10 @@ from typing import Tuple
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
|
|
||||||
from openflexure_microscope.camera.base import generate_basename
|
from openflexure_microscope.camera.base import generate_basename
|
||||||
from openflexure_microscope.common.flask_labthings.find import find_device, find_extension
|
from openflexure_microscope.common.flask_labthings.find import (
|
||||||
|
find_device,
|
||||||
|
find_extension,
|
||||||
|
)
|
||||||
from openflexure_microscope.common.flask_labthings.extensions import BaseExtension
|
from openflexure_microscope.common.flask_labthings.extensions import BaseExtension
|
||||||
|
|
||||||
from openflexure_microscope.devel import (
|
from openflexure_microscope.devel import (
|
||||||
|
|
|
||||||
|
|
@ -86,9 +86,11 @@ class ZipManager:
|
||||||
def zip_from_id(self, session_id):
|
def zip_from_id(self, session_id):
|
||||||
return self.session_zips[session_id]["fp"]
|
return self.session_zips[session_id]["fp"]
|
||||||
|
|
||||||
|
|
||||||
# Create a global ZIP manager
|
# Create a global ZIP manager
|
||||||
default_zip_manager = ZipManager()
|
default_zip_manager = ZipManager()
|
||||||
|
|
||||||
|
|
||||||
class ZipBuilderAPIView(Resource):
|
class ZipBuilderAPIView(Resource):
|
||||||
def post(self):
|
def post(self):
|
||||||
|
|
||||||
|
|
@ -145,4 +147,3 @@ zip_extension_v2.add_view(ZipListAPIView, "/get")
|
||||||
|
|
||||||
zip_extension_v2.add_view(ZipBuilderAPIView, "/build")
|
zip_extension_v2.add_view(ZipBuilderAPIView, "/build")
|
||||||
zip_extension_v2.register_action(ZipBuilderAPIView)
|
zip_extension_v2.register_action(ZipBuilderAPIView)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,9 @@ def init_default_extensions(extension_path):
|
||||||
os.makedirs(os.path.dirname(extension_path), exist_ok=True)
|
os.makedirs(os.path.dirname(extension_path), exist_ok=True)
|
||||||
|
|
||||||
if not os.path.exists(extension_path): # If user extensions file doesn't exist
|
if not os.path.exists(extension_path): # If user extensions file doesn't exist
|
||||||
logging.warning("No extension file found at {}. Creating...".format(extension_path))
|
logging.warning(
|
||||||
|
"No extension file found at {}. Creating...".format(extension_path)
|
||||||
|
)
|
||||||
create_file(extension_path)
|
create_file(extension_path)
|
||||||
|
|
||||||
logging.info("Populating {}...".format(extension_path))
|
logging.info("Populating {}...".format(extension_path))
|
||||||
|
|
|
||||||
|
|
@ -156,6 +156,8 @@ def find_extensions(extension_dir, module_name="extensions"):
|
||||||
extension_paths = glob.glob(os.path.join(extension_dir, "*.py"))
|
extension_paths = glob.glob(os.path.join(extension_dir, "*.py"))
|
||||||
|
|
||||||
for extension_path in extension_paths:
|
for extension_path in extension_paths:
|
||||||
extensions.extend(find_extensions_in_file(extension_path, module_name=module_name))
|
extensions.extend(
|
||||||
|
find_extensions_in_file(extension_path, module_name=module_name)
|
||||||
|
)
|
||||||
|
|
||||||
return extensions
|
return extensions
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,10 @@ class ExtensionSchema(Schema):
|
||||||
view_rule = view_data["rule"]
|
view_rule = view_data["rule"]
|
||||||
# Make links dictionary if it doesn't yet exist
|
# Make links dictionary if it doesn't yet exist
|
||||||
d[view_id] = {
|
d[view_id] = {
|
||||||
"href": url_for(ExtensionListResource.endpoint, **view_kwargs, _external=True) + view_rule,
|
"href": url_for(
|
||||||
|
ExtensionListResource.endpoint, **view_kwargs, _external=True
|
||||||
|
)
|
||||||
|
+ view_rule,
|
||||||
**description_from_view(view_cls),
|
**description_from_view(view_cls),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue