Files
SaraFem/ImageView.py
T

42 lines
1.3 KiB
Python

"""Fullscreen in-app image view (Features/Major: "Different display in
middle" — fullscreen image, no stretch). Fills Browser's file-area Container
in place of the entry list, same mechanism as Editor.py's EditorView. Just
fit-to-window display — no zoom/pan, matching what was actually asked for."""
from pathlib import Path
from typing import Callable
import flet as ft
from Core import Palette
class ImageView(ft.Container):
def __init__(self, EntryPath: Path, OnClose: Callable[[], None]):
self.EntryPath = EntryPath
self.OnClose = OnClose
Toolbar = ft.Row(
[
ft.IconButton(
icon=ft.Icons.ARROW_BACK, tooltip="Back to file list", on_click=lambda e: self.OnClose()
),
ft.Text(EntryPath.name, weight=ft.FontWeight.BOLD, expand=True),
],
spacing=8,
)
Body = ft.Container(
content=ft.Image(src=str(EntryPath), fit=ft.BoxFit.CONTAIN, expand=True),
expand=True,
padding=12,
)
super().__init__(
content=ft.Column(
[Toolbar, ft.Divider(height=1, color=Palette.Surface1), Body], expand=True, spacing=8
),
expand=True,
bgcolor=Palette.Base,
padding=12,
)