From e43fc798df1944a5b585f613b3bf6fc05a5224ac Mon Sep 17 00:00:00 2001 From: Jules Date: Sat, 21 Mar 2026 23:34:01 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20galerie=20:=20cartes=20=C3=A0=20taille=20?= =?UTF-8?q?fixe,=20plus=20de=20cadre=20blanc=20extensible?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Miniature en taille fixe (responsive selon la fenêtre mais pas extensible). Même rendu avec 3 ou 50 photos. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/ui/screens/import_screen.py | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/ui/screens/import_screen.py b/src/ui/screens/import_screen.py index 6d9097e..7c1b9c4 100644 --- a/src/ui/screens/import_screen.py +++ b/src/ui/screens/import_screen.py @@ -28,19 +28,17 @@ class PhotoCard(QFrame): border-radius: 10px; } """) - self.setMaximumWidth(350) - self.setMaximumHeight(300) - layout = QVBoxLayout(self) layout.setContentsMargins(4, 4, 4, 4) layout.setSpacing(4) - # Miniature — s'étire pour remplir la carte + # Miniature — taille fixe self.thumb_label = QLabel() self.thumb_label.setAlignment(Qt.AlignmentFlag.AlignCenter) - self.thumb_label.setScaledContents(False) + self.thumb_label.setFixedSize(200, 140) self._pixmap_original = QPixmap(self.path) - layout.addWidget(self.thumb_label, 1) + self._update_thumbnail() + layout.addWidget(self.thumb_label) # Barre du bas : crayon + quantité bar = QHBoxLayout() @@ -128,12 +126,8 @@ class PhotoCard(QFrame): """) self.qty_label.setStyleSheet("color: #333;") - def resizeEvent(self, event): - super().resizeEvent(event) - self._update_thumbnail() - def _update_thumbnail(self): - """Redimensionne la miniature pour remplir l'espace disponible.""" + """Redimensionne la miniature pour remplir le label fixe.""" if self._pixmap_original.isNull(): return w = self.thumb_label.width() @@ -148,10 +142,10 @@ class PhotoCard(QFrame): def apply_responsive(self, window_height): """Adapte les tailles au responsive.""" - max_h = max(150, int(window_height * 0.28)) - max_w = max(200, int(max_h * 1.3)) - self.setMaximumHeight(max_h) - self.setMaximumWidth(max_w) + thumb_h = max(100, int(window_height * 0.16)) + thumb_w = max(140, int(thumb_h * 1.45)) + self.thumb_label.setFixedSize(thumb_w, thumb_h) + self._update_thumbnail() btn_size = max(28, int(window_height * 0.04)) font_size = max(12, int(window_height * 0.02))