From d31d1154cca5c73c2aca7a084598c648384ab7f8 Mon Sep 17 00:00:00 2001 From: Julian Stirling Date: Wed, 24 Jun 2026 10:23:35 +0000 Subject: [PATCH] Apply suggestions from code review of branch image-capture Co-authored-by: Joe Knapper --- src/openflexure_microscope_server/things/camera/__init__.py | 2 +- tests/unit_tests/test_gallery.py | 2 +- tests/unit_tests/test_smart_scan.py | 2 +- .../tabContentComponents/galleryComponents/galleryCard.vue | 3 +++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/openflexure_microscope_server/things/camera/__init__.py b/src/openflexure_microscope_server/things/camera/__init__.py index 92322b05..8a2644f1 100644 --- a/src/openflexure_microscope_server/things/camera/__init__.py +++ b/src/openflexure_microscope_server/things/camera/__init__.py @@ -360,7 +360,7 @@ class BaseCamera(OFMThing, ABC): try: os.remove(full_path) except IOError as e: - self.logger.warning(f"Camera has no image named {name}.") + self.logger.warning(f"Failed to delete {name}.") raise HTTPException( 400, "Couldn't delete capture, check log for details" ) from e diff --git a/tests/unit_tests/test_gallery.py b/tests/unit_tests/test_gallery.py index 406e2983..579e06c2 100644 --- a/tests/unit_tests/test_gallery.py +++ b/tests/unit_tests/test_gallery.py @@ -227,7 +227,7 @@ GALLERY_DELETE_TEST_CASES = [ @pytest.mark.parametrize("test_case", GALLERY_DELETE_TEST_CASES) def test_gallery_calls_delete(test_case, minimal_gallery_env, mocker): - """Test that the gallery delete on all gallery providing things..""" + """Test that the gallery deletes on all gallery providing things.""" # Create a config with the minimal Thing and the bad Thing gallery = minimal_gallery_env.get_thing_by_name("gallery") thing_1 = minimal_gallery_env.get_thing_by_name("minimal_thing1") diff --git a/tests/unit_tests/test_smart_scan.py b/tests/unit_tests/test_smart_scan.py index b6e75085..404165da 100644 --- a/tests/unit_tests/test_smart_scan.py +++ b/tests/unit_tests/test_smart_scan.py @@ -302,7 +302,7 @@ def test_delete_all_scans(entered_smart_scan_thing, caplog, mocker): for fake_scan_name in fake_scan_names: fake_scan_path = os.path.join(SCAN_DIR, fake_scan_name) assert not os.path.exists(fake_scan_path) - # No One log generated per scan deleted + # One log generated per scan deleted assert len(caplog.records) == 4 for record in caplog.records: assert record.message.startswith("Deleting: fake_scan_000") diff --git a/webapp/src/components/tabContentComponents/galleryComponents/galleryCard.vue b/webapp/src/components/tabContentComponents/galleryComponents/galleryCard.vue index 637e0291..1d69591b 100644 --- a/webapp/src/components/tabContentComponents/galleryComponents/galleryCard.vue +++ b/webapp/src/components/tabContentComponents/galleryComponents/galleryCard.vue @@ -112,6 +112,9 @@ export default { } return `${this.baseUri}/data/${this.itemData.thing}/${this.itemData.name}`; }, + /** + * Return True if there is a viewer available for this card's data. + */ viewerAvailable() { if (this.itemData.card_type === "Scan") return Boolean(this.itemData?.dzi); return true;