From 81d7a0c5d0e2b824e1459672068fd0cab61a30be Mon Sep 17 00:00:00 2001 From: pax Date: Sun, 5 Apr 2026 14:31:52 -0500 Subject: [PATCH] =?UTF-8?q?Fix=20copy=20to=20clipboard=20=E2=80=94=20check?= =?UTF-8?q?=20slideshow,=20grid=20selection,=20cached=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tries in order: preview pixmap, slideshow pixmap, preview path, selected post's cached file. Covers all states: normal preview, slideshow open, video posts. --- booru_viewer/gui/app.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/booru_viewer/gui/app.py b/booru_viewer/gui/app.py index 9cd54d0..be1f15f 100644 --- a/booru_viewer/gui/app.py +++ b/booru_viewer/gui/app.py @@ -1896,14 +1896,28 @@ class BooruApp(QMainWindow): super().keyPressEvent(event) def _copy_preview_to_clipboard(self) -> None: - # Try image viewer pixmap first + # Try preview pixmap pix = self._preview._image_viewer._pixmap if pix and not pix.isNull(): QApplication.clipboard().setPixmap(pix) self._status.showMessage(f"{len(self._posts)} results — Copied to clipboard") return - # Try loading from cached path + # Try slideshow pixmap + if self._fullscreen_window and self._fullscreen_window._viewer._pixmap: + pix = self._fullscreen_window._viewer._pixmap + if not pix.isNull(): + QApplication.clipboard().setPixmap(pix) + self._status.showMessage(f"{len(self._posts)} results — Copied to clipboard") + return + # Try loading from preview path or selected post's cached file path = self._preview._current_path + if not path: + idx = self._grid.selected_index + if 0 <= idx < len(self._posts): + from ..core.cache import cached_path_for + cp = cached_path_for(self._posts[idx].file_url) + if cp.exists(): + path = str(cp) if path: pix = QPixmap(path) if not pix.isNull():