Add way for gallery providers to specify bulk actions.

This commit is contained in:
Julian Stirling 2026-06-25 16:52:44 +01:00
parent 3e38722d45
commit 2dcd386661
4 changed files with 57 additions and 0 deletions

View file

@ -15,6 +15,7 @@ from openflexure_microscope_server.things.gallery import (
GalleryCompatibleThing,
GalleryThing,
)
from openflexure_microscope_server.ui import ActionButton
from ..shared_utils.lt_test_utils import LabThingsTestEnv
@ -63,6 +64,10 @@ class MinimalGalleryClass:
def delete_all_gallery_items(self) -> None:
"""Mock deleting all the data."""
def get_gallery_bulk_actions(self) -> list[ActionButton]:
"""No bulk actions."""
return []
class MinimalGallerySource(OFMThing, MinimalGalleryClass):
"""Minimal example of a Thing that can show data in the gallery.
@ -94,6 +99,10 @@ class BadGallerySource(OFMThing):
def delete_all_gallery_items(self) -> None:
"""Mock deleting all the data."""
def get_gallery_bulk_actions(self) -> list[ActionButton]:
"""No bulk actions."""
return []
class BadMockGalleryData(BaseModel):
"""Mock gallery data without a card type."""
@ -119,6 +128,10 @@ class BadGallerySource2(OFMThing):
def delete_all_gallery_items(self) -> None:
"""Mock deleting all the data."""
def get_gallery_bulk_actions(self) -> list[ActionButton]:
"""No bulk actions."""
return []
def test_gallery_compatible_protocol():
"""Check the gallery compatible protocol detects compatible classes only."""