Fix library thumbs, decouple save/bookmark, smaller dot + yellow star

- Skip video files in library thumbnail generation (PIL can't open them)
- _on_bookmark_done only sets bookmarked for bookmark ops, saved for save ops
- Smaller green dot with yellow star to its right
- Default bookmark star color: yellow (#ffcc00)
This commit is contained in:
pax 2026-04-05 01:46:42 -05:00
parent 72e4d5c5a2
commit e84765a06f
3 changed files with 21 additions and 15 deletions

View File

@ -350,7 +350,7 @@ class BooruApp(QMainWindow):
self._bookmarks_view.bookmark_activated.connect(self._on_bookmark_activated)
self._stack.addWidget(self._bookmarks_view)
self._library_view = LibraryView(self._db)
self._library_view = LibraryView()
self._library_view.file_selected.connect(self._on_library_selected)
self._library_view.file_activated.connect(self._on_library_activated)
self._stack.addWidget(self._library_view)
@ -1594,10 +1594,10 @@ class BooruApp(QMainWindow):
self._status.showMessage(msg)
thumbs = self._grid._thumbs
if 0 <= index < len(thumbs):
thumbs[index].set_bookmarked(True)
# Only green if actually saved to library, not just cached
if "Saved" in msg:
thumbs[index].set_saved_locally(True)
elif "Bookmarked" in msg:
thumbs[index].set_bookmarked(True)
self._update_fullscreen_state()
def closeEvent(self, event) -> None:

View File

@ -29,7 +29,7 @@ class ThumbnailWidget(QWidget):
# QSS-controllable dot colors: qproperty-savedColor / qproperty-bookmarkedColor
_saved_color = QColor("#22cc22")
_bookmarked_color = QColor("#ff4444")
_bookmarked_color = QColor("#ffcc00")
def _get_saved_color(self): return self._saved_color
def _set_saved_color(self, c): self._saved_color = QColor(c) if isinstance(c, str) else c
@ -120,20 +120,19 @@ class ThumbnailWidget(QWidget):
y = (self.height() - self._pixmap.height()) // 2
p.drawPixmap(x, y, self._pixmap)
# Bookmark/saved indicators (independent dots)
dot_x = self.width() - 14
# Saved dot + bookmark star (right-aligned, star right of dot)
indicator_x = self.width() - 4
if self._bookmarked:
from PySide6.QtGui import QFont
p.setPen(self._bookmarked_color)
p.setFont(QFont(p.font().family(), 8))
indicator_x -= 11
p.drawText(indicator_x, 12, "\u2605")
if self._saved_locally:
p.setPen(Qt.PenStyle.NoPen)
p.setBrush(self._saved_color)
p.drawEllipse(dot_x, 4, 10, 10)
dot_x -= 14
if self._bookmarked:
from PySide6.QtGui import QFont
p.setPen(Qt.PenStyle.NoPen)
p.setBrush(self._bookmarked_color)
p.setFont(QFont(p.font().family(), 10))
p.setPen(self._bookmarked_color)
p.drawText(dot_x - 2, 14, "\u2605")
indicator_x -= 9
p.drawEllipse(indicator_x, 4, 7, 7)
# Multi-select checkmark
if self._multi_selected:

View File

@ -184,9 +184,16 @@ class LibraryView(QWidget):
# Async thumbnail generation
# ------------------------------------------------------------------
_VIDEO_EXTS = {".mp4", ".webm", ".mkv", ".avi", ".mov"}
def _generate_thumb_async(
self, index: int, source: Path, dest: Path
) -> None:
if source.suffix.lower() in self._VIDEO_EXTS:
# Can't thumbnail videos with PIL — just show the file directly
# and let QPixmap try (it won't work for video, but that's OK)
return
def _work() -> None:
try:
from PIL import Image