diff --git a/src/textual_paint/gallery.py b/src/textual_paint/gallery.py index 3a2cc81..f3ecd60 100644 --- a/src/textual_paint/gallery.py +++ b/src/textual_paint/gallery.py @@ -99,9 +99,12 @@ class GalleryApp(App[None]): if not gallery_folder.exists(): self.exit(None, f"Folder not found: {gallery_folder}") + return if not gallery_folder.is_dir(): + # TODO: allow showing a specific file, and load whatever folder it's in self.exit(None, f"Not a folder: {gallery_folder}") + return exts = (".ans", ".txt") @@ -129,6 +132,7 @@ class GalleryApp(App[None]): # Debugging # self.exit(None, "\n".join(str(path) for path in paths)) + # return for path in paths: if path.suffix not in exts: @@ -141,6 +145,7 @@ class GalleryApp(App[None]): if len(self.scroll.children) == 0: self.exit(None, f"No ANSI art ({', '.join(f'*{ext}' for ext in exts)}) found in folder: {gallery_folder}") + return def _scroll_to_adjacent_item(self, delta_index: int = 0) -> None: """Scroll to the next/previous item."""