From c4ae7f7c9003c4a6ee0e47593aabe5a5b85972c0 Mon Sep 17 00:00:00 2001 From: Julian Stirling Date: Wed, 24 Jun 2026 11:24:41 +0100 Subject: [PATCH] Only delete selected data types from gallery button. --- .../things/gallery.py | 18 +++++++++++------- webapp/src/components/appContent.vue | 1 + .../tabContentComponents/galleryContent.vue | 16 ++++++++++++++-- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/openflexure_microscope_server/things/gallery.py b/src/openflexure_microscope_server/things/gallery.py index 2b1fd4ef..532fff81 100644 --- a/src/openflexure_microscope_server/things/gallery.py +++ b/src/openflexure_microscope_server/things/gallery.py @@ -45,7 +45,8 @@ class GalleryThing(lt.Thing): all_ofm_things: Mapping[str, OFMThing] = lt.thing_slot() _gallery_providing_things: Optional[Mapping[str, GalleryCompatibleThing]] = None - _card_types: Optional[Mapping[str, GalleryCompatibleThing]] = None + _card_types: Optional[list[str]] = None + _card_type_map: dict[str, str] = {} @property def gallery_providing_things(self) -> Mapping[str, GalleryCompatibleThing]: @@ -101,6 +102,7 @@ class GalleryThing(lt.Thing): card_type = props["card_type"]["const"] if card_type not in card_types: card_types.append(card_type) + self._card_type_map[thing.name] = card_type self._card_types = card_types @@ -133,10 +135,12 @@ class GalleryThing(lt.Thing): return data_list @lt.action - def delete_all_data(self) -> None: - """Delete all the gallery data on this microscope.""" + def delete_all_data(self, card_types: list[str]) -> None: + """Delete all the gallery data on this microscope with the given card types.""" for thing in self.gallery_providing_things.values(): - try: - thing.delete_all_gallery_items() - except Exception as e: - self.logger.exception(e) + thing_card_type = self._card_type_map.get(thing.name) + if thing_card_type in card_types: + try: + thing.delete_all_gallery_items() + except Exception as e: + self.logger.exception(e) diff --git a/webapp/src/components/appContent.vue b/webapp/src/components/appContent.vue index d5fac1a0..61051a6c 100644 --- a/webapp/src/components/appContent.vue +++ b/webapp/src/components/appContent.vue @@ -267,6 +267,7 @@ export default { #container-left { overflow: auto; + scrollbar-gutter: stable; background-color: rgba(180, 180, 180, 0.025); width: 100%; height: 100%; diff --git a/webapp/src/components/tabContentComponents/galleryContent.vue b/webapp/src/components/tabContentComponents/galleryContent.vue index 5bef578c..65da50bd 100644 --- a/webapp/src/components/tabContentComponents/galleryContent.vue +++ b/webapp/src/components/tabContentComponents/galleryContent.vue @@ -1,5 +1,5 @@