From 14033b57b5cf829c6ab1cbd7d834b62063e6fc02 Mon Sep 17 00:00:00 2001 From: pax Date: Sat, 11 Apr 2026 22:26:31 -0500 Subject: [PATCH] main_window: live-apply thumbnail size and flip layout Thumbnail size change now resizes all existing thumbnails from their source pixmap and reflows all three grids immediately. No restart needed. Flip layout change now swaps the splitter widget order live. behavior change: thumbnail size and preview-on-left settings apply instantly via Apply/Save instead of requiring a restart. --- booru_viewer/gui/main_window.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/booru_viewer/gui/main_window.py b/booru_viewer/gui/main_window.py index ac256c7..237d9ee 100644 --- a/booru_viewer/gui/main_window.py +++ b/booru_viewer/gui/main_window.py @@ -1028,12 +1028,31 @@ class BooruApp(QMainWindow): if lib_dir: from ..core.config import set_library_dir set_library_dir(Path(lib_dir)) - # Apply thumbnail size + # Apply thumbnail size live — update the module constant, resize + # existing thumbnails, and reflow the grid. from .grid import THUMB_SIZE new_size = self._db.get_setting_int("thumbnail_size") if new_size and new_size != THUMB_SIZE: import booru_viewer.gui.grid as grid_mod grid_mod.THUMB_SIZE = new_size + for grid in (self._grid, self._bookmarks_view._grid, self._library_view._grid): + for thumb in grid._thumbs: + thumb.setFixedSize(new_size, new_size) + if thumb._source_pixmap: + thumb._pixmap = thumb._source_pixmap.scaled( + new_size - 4, new_size - 4, + Qt.AspectRatioMode.KeepAspectRatio, + Qt.TransformationMode.SmoothTransformation, + ) + thumb.update() + grid._flow._do_layout() + # Apply flip layout live + flip = self._db.get_setting_bool("flip_layout") + current_first = self._splitter.widget(0) + want_right_first = flip + right_is_first = current_first is self._right_splitter + if want_right_first != right_is_first: + self._splitter.insertWidget(0, self._right_splitter if flip else self._stack) self._status.showMessage("Settings applied") # -- Fullscreen & Privacy --