From bb0973917d167710c3d5f20b73d0ee93c96b8fde Mon Sep 17 00:00:00 2001 From: Starnakin Date: Wed, 23 Apr 2025 20:49:58 +0200 Subject: [PATCH] recreate page --- src/page.py | 7 ++++ src/picture.py | 6 +-- src/templates/page.css | 89 +++++++++++++++++++++++----------------- src/templates/page.jinja | 42 ++++++++++++------- 4 files changed, 88 insertions(+), 56 deletions(-) diff --git a/src/page.py b/src/page.py index 65d1cb9..193c3b5 100644 --- a/src/page.py +++ b/src/page.py @@ -62,6 +62,13 @@ class Page(): if (self._gen_exif()): return None return self._exif + + def render_exif(self): + if not self.get_exif(): + return None + + with open(self._exif.get_absolute_path()) as f: + return f.read() def get_raw(self): return self._raw \ No newline at end of file diff --git a/src/picture.py b/src/picture.py index d2ea31e..15fc776 100644 --- a/src/picture.py +++ b/src/picture.py @@ -17,7 +17,7 @@ class Picture(): def __init__(self, picture_path: Path, page = None, raw: Path|None = None, albums_name: list[str] = None, is_repertoried: bool = True): self._large: Path = picture_path self._small: Path = Path(picture_path.get_absolute_path()[:-4] + "_small.jpg") - self._export_file: Path = Path(picture_path.get_absolute_path() + ".out.pp3") + self._profile_file: Path = Path(picture_path.get_absolute_path() + ".out.pp3") self._raw: Path|None = raw self._page: Page = page self._albums_name: list[str] = albums_name or [] @@ -39,8 +39,8 @@ class Picture(): def get_large(self): return self._large - def get_export_file(self): - return self._export_file + def get_profile_file(self): + return self._profile_file def gen_small(self): im = Image.open(self._large.get_absolute_path()).convert("RGB") diff --git a/src/templates/page.css b/src/templates/page.css index aaef936..8af7c4c 100644 --- a/src/templates/page.css +++ b/src/templates/page.css @@ -10,61 +10,74 @@ } body { - display: flex; - justify-content: center; - flex-direction: column; - width: 50%; background-color: var(--bg1); - margin: auto; - margin-top: 10px; - margin-bottom: 50px; - color: lightgray; -} - -body * { - width: 100%; -} - -.picture-container { - margin-top: 10px; -} - -.picture-container-element { - margin-top: 0px; + display: flex; + flex-direction: column; + align-items: center; + margin: 15% 15%; + margin-top: 5%; + height: auto; } .readme { - border: 1px solid; background-color: var(--bg2); } -.readme-content { - margin: 30px; -} - -.export, -.next { - margin-top: 0px; - display: block; - text-align: right; -} - -.download { - margin-top: 10px; +.picture-container { background-color: var(--bg2); - text-align: center; - padding-bottom: 30px; + padding: 10px; } -.navigation, -.meta-picture { +.picture-container-item { + padding: 5px; + background-color: var(--content1); +} + +img { + max-width: 100%; + height: auto; +} + +.meta-picture, .navigation { display: flex; flex-direction: row; justify-content: space-between; + width: 100%; +} + +.profile { + text-align: right; } a { color: white; text-decoration: none; font-size: 1.5rem; + } + +@media screen and (max-width:767px) { + body { + margin: 0% 0%; + } +} + +.exif, .readme { + width: 100%; + display: block; +} + +.download { + width: 100%; + background-color: var(--bg2); + text-align: center; +} + +.exif summary { + text-align: center; +} + +.exif details { + display: flex; + justify-content: center; + background-color: var(--bg2); } \ No newline at end of file diff --git a/src/templates/page.jinja b/src/templates/page.jinja index e357e98..e5adcac 100644 --- a/src/templates/page.jinja +++ b/src/templates/page.jinja @@ -16,33 +16,45 @@ {% if page._readme.exist() %}
-
- {{page.render_readme()}} -
+
+ + README + +
+ {{page.render_readme()}} +
+
{% endif %} - {% for picture in page._pictures %}
-
- + {% for picture in page._pictures %} +
+ + +
Large - {% if picture._export_file.exist() %} - export file + {% if picture._profile_file.exist() %} + Raw therapee profile {% endif %}
+ {% endfor %}
- {% endfor %} - {% if page.get_raw().exist() or page.get_exif() %} + {% if page.get_raw().exist() %}

Download

- {% if page.get_raw().exist() %} RAW - {% endif %} - {% if page.get_exif() %} - Exif - {% endif %} +
+ {% endif %} + {% if page.get_exif() %} +
+
+ Exif +
+                {{ page.render_exif() }}
+            
+
{% endif %}