From 6d68652e61134799c2841721757a82ffdf6b993d Mon Sep 17 00:00:00 2001 From: pax Date: Tue, 7 Apr 2026 15:19:24 -0500 Subject: [PATCH] Bookmarks/library/preview toolbars: compact button padding, 4px splitter pad, uniform 30px row height; library drops unreachable set_missing call --- booru_viewer/gui/bookmarks.py | 20 ++++++++++++++++---- booru_viewer/gui/library.py | 18 +++++++++++++----- booru_viewer/gui/preview.py | 6 ++++-- 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/booru_viewer/gui/bookmarks.py b/booru_viewer/gui/bookmarks.py index 3ef8d39..babbca7 100644 --- a/booru_viewer/gui/bookmarks.py +++ b/booru_viewer/gui/bookmarks.py @@ -52,8 +52,20 @@ class BookmarksView(QWidget): layout = QVBoxLayout(self) layout.setContentsMargins(0, 0, 0, 0) - # Top bar: folder selector + search + # Top bar: folder selector + search. + # 4px right margin so the rightmost button doesn't sit flush + # against the preview splitter handle. top = QHBoxLayout() + top.setContentsMargins(0, 0, 4, 0) + + # Compact button padding matches the rest of the app's narrow + # toolbar buttons (search bar score field, settings spinbox +/-, + # preview toolbar). The bundled themes' default `padding: 5px 12px` + # is too wide for short labels in fixed-width slots. + # min-height 22px gives a total height of 30px (22 + 3+3 padding + + # 1+1 border), matching the inputs/combos in the same row so the + # whole toolbar lines up at one consistent height. + _btn_style = "padding: 3px 6px; min-height: 22px;" self._folder_combo = QComboBox() self._folder_combo.setMinimumWidth(120) @@ -62,7 +74,8 @@ class BookmarksView(QWidget): manage_btn = QPushButton("+ Folder") manage_btn.setToolTip("New folder") - manage_btn.setFixedWidth(65) + manage_btn.setFixedWidth(75) + manage_btn.setStyleSheet(_btn_style) manage_btn.clicked.connect(self._new_folder) top.addWidget(manage_btn) @@ -72,11 +85,10 @@ class BookmarksView(QWidget): top.addWidget(self._search_input, stretch=1) search_btn = QPushButton("Search") + search_btn.setStyleSheet(_btn_style) search_btn.clicked.connect(self._do_search) top.addWidget(search_btn) - top.setContentsMargins(0, 0, 0, 0) - layout.addLayout(top) # Count label diff --git a/booru_viewer/gui/library.py b/booru_viewer/gui/library.py index 4a9003f..69e4d99 100644 --- a/booru_viewer/gui/library.py +++ b/booru_viewer/gui/library.py @@ -58,8 +58,18 @@ class LibraryView(QWidget): layout.setContentsMargins(0, 0, 0, 0) # --- Top bar --- + # 4px right margin so the rightmost widget doesn't sit flush + # against the preview splitter handle. top = QHBoxLayout() - top.setContentsMargins(0, 0, 0, 0) + top.setContentsMargins(0, 0, 4, 0) + + # Compact button padding matches the rest of the app's narrow + # toolbar buttons. Bundled themes' default `padding: 5px 12px` + # is too wide for short labels in fixed-width slots. + # min-height 22px gives a total height of 30px (22 + 3+3 padding + + # 1+1 border), matching the inputs/combos in the same row so the + # whole toolbar lines up at one consistent height. + _btn_style = "padding: 3px 6px; min-height: 22px;" self._folder_combo = QComboBox() self._folder_combo.setMinimumWidth(140) @@ -73,7 +83,8 @@ class LibraryView(QWidget): top.addWidget(self._sort_combo) refresh_btn = QPushButton("Refresh") - refresh_btn.setFixedWidth(65) + refresh_btn.setFixedWidth(75) + refresh_btn.setStyleSheet(_btn_style) refresh_btn.clicked.connect(self.refresh) top.addWidget(refresh_btn) @@ -136,9 +147,6 @@ class LibraryView(QWidget): for i, (filepath, thumb) in enumerate(zip(self._files, thumbs)): thumb._cached_path = str(filepath) thumb.setToolTip(filepath.name) - if not filepath.exists(): - thumb.set_missing(True) - continue thumb.set_saved_locally(True) cached_thumb = lib_thumb_dir / f"{filepath.stem}.jpg" if cached_thumb.exists(): diff --git a/booru_viewer/gui/preview.py b/booru_viewer/gui/preview.py index 01035ea..9ec40fc 100644 --- a/booru_viewer/gui/preview.py +++ b/booru_viewer/gui/preview.py @@ -1306,10 +1306,12 @@ class ImagePreview(QWidget): layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) - # Action toolbar — above the media, in the layout + # Action toolbar — above the media, in the layout. + # 4px horizontal margins so the leftmost button (Bookmark) doesn't + # sit flush against the preview splitter handle on the left. self._toolbar = QWidget() tb = QHBoxLayout(self._toolbar) - tb.setContentsMargins(2, 1, 2, 1) + tb.setContentsMargins(4, 1, 4, 1) tb.setSpacing(4) # Compact toolbar buttons. The bundled themes set