add: hashtag to album page to go directly on the picture you clicked

This commit is contained in:
Starnakin 2025-05-06 22:42:22 +02:00
parent 5fc12d5d33
commit 129dfe7df9
4 changed files with 9 additions and 6 deletions

View File

@ -26,9 +26,11 @@ def scan_pages(folders: list[Path]) -> list[Page]:
page: Page = Page(folder, folder.get_name(), prev=prev) page: Page = Page(folder, folder.get_name(), prev=prev)
raw: Path = Path(folder, folder.get_name() + ".NEF") raw: Path = Path(folder, folder.get_name() + ".NEF")
id: int = 0
for file in files: for file in files:
if file.get_name().endswith(".png"): if file.get_name().endswith(".png"):
page.add_picture(Picture(file, page=page, raw=raw)) page.add_picture(Picture(file, id, page=page, raw=raw))
id += 1
if len(page.get_pictures()) == 0: if len(page.get_pictures()) == 0:
bar.next() bar.next()

View File

@ -14,13 +14,14 @@ if TYPE_CHECKING:
from album import Album from album import Album
class Picture(): class Picture():
def __init__(self, picture_path: Path, page = None, raw: Path|None = None, is_repertoried: bool = True): def __init__(self, picture_path: Path, id: int, page = None, raw: Path|None = None, is_repertoried: bool = True):
self._large: Path = picture_path self._large: Path = picture_path
self._small: Path = Path(picture_path.get_absolute_path()[:-4] + "_small.jpg") self._small: Path = Path(picture_path.get_absolute_path()[:-4] + "_small.jpg")
self._thumb: Path = Path(picture_path.get_absolute_path()[:-4] + "_thumb.jpg") self._thumb: Path = Path(picture_path.get_absolute_path()[:-4] + "_thumb.jpg")
self._profile_file: Path = Path(picture_path.get_absolute_path() + ".out.pp3") self._profile_file: Path = Path(picture_path.get_absolute_path() + ".out.pp3")
self._albums_file: Path = Path(picture_path.get_absolute_path()[:-4] + "_albums.txt") self._albums_file: Path = Path(picture_path.get_absolute_path()[:-4] + "_albums.txt")
self._raw: Path|None = raw self._raw: Path|None = raw
self.id: int = id
self._page: Page = page self._page: Page = page
self._albums_name: list[str] = [] self._albums_name: list[str] = []
self.albums: list[Album] = [] self.albums: list[Album] = []

View File

@ -9,7 +9,7 @@
<h1>{{ album.name }}</h1> <h1>{{ album.name }}</h1>
<div class="picture-container"> <div class="picture-container">
{% for picture in album._pictures %} {% for picture in album._pictures %}
<a href="{{ picture.get_page().html.get_url() }}"> <a href="{{ picture.get_page().html.get_url() }}#{{ picture.id }}">
<img src="{{ picture.get_thumb().get_url() }}"> <img src="{{ picture.get_thumb().get_url() }}">
</a> </a>
{% endfor %} {% endfor %}

View File

@ -28,7 +28,7 @@
{% endif %} {% endif %}
<div class="picture-container"> <div class="picture-container">
{% for picture in page._pictures %} {% for picture in page._pictures %}
<div class="picture-container-item"> <div class="picture-container-item" id="{{ picture.id}}">
<div class="picture"> <div class="picture">
<a href="{{ picture.get_small().get_url() }}"> <a href="{{ picture.get_small().get_url() }}">
<img src='{{ picture.get_small().get_url() }}'> <img src='{{ picture.get_small().get_url() }}'>
@ -43,7 +43,7 @@
<div class="albums_container"> <div class="albums_container">
<h1>Albums:</h1> <h1>Albums:</h1>
{% for album in picture.albums %} {% for album in picture.albums %}
<a href="{{ album.path.get_url() }}" class="album_item">{{ album.name }}</a> <a href="{{ album.path.get_url() }}" class="album_item">{{ al }}</a>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
@ -52,7 +52,7 @@
{% if page.get_raw().exist() %} {% if page.get_raw().exist() %}
<div class="download"> <div class="download">
<h1>Download</h1> <h1>Download</h1>
<a href="{{ page.get_raw().get_url() }}">RAW</a> <a href="{{ page.get_raw() }}">RAW</a>
</div> </div>
{% endif %} {% endif %}
{% if page.get_exif() %} {% if page.get_exif() %}