mirror of
https://git.srhtnin.garden/sarah/SaraFem.git
synced 2026-10-14 18:18:12 +02:00
Add fullscreen in-app image view, no stretch, sharing the editor's in-app/external toggle
This commit is contained in:
1 parent
d588d445b4
commit
117532e017
5 files changed
+281
-2
No files matched your search
@@ -0,0 +1,41 @@
|
||||
"""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,
|
||||
)
|
||||
Reference in new issue
Block a user