v0.6.6 - Fix icone header : icon_small.png pre-generee

Changements :
- icon_small.png (25x32) generee au build via Pillow LANCZOS, plus de subsample au runtime
- Chargement direct de icon_small.png dans le header, sans calcul de redimensionnement
- build.bat genere automatiquement icon_small.png avant la compilation
- _find_icon() generalisee pour chercher n'importe quel fichier icone

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-24 22:32:49 +01:00
parent fa17301842
commit 959298fc2d
7 changed files with 14 additions and 17 deletions

View File

@@ -5,7 +5,7 @@ Accès lecture seule uniquement (fetch/pull/checkout, jamais de push).
Tous les chemins sont relatifs à l'emplacement de l'exécutable.
"""
VERSION = "0.6.5"
VERSION = "0.6.6"
import subprocess
import sys
@@ -485,13 +485,13 @@ def do_restore(local_path):
class App(tk.Tk):
@staticmethod
def _find_icon():
"""Cherche icon.png : d'abord à côté de l'exe, sinon dans _internal (bundle)."""
p = get_exe_dir() / "icon.png"
def _find_icon(filename="icon.png"):
"""Cherche un fichier icône : d'abord à côté de l'exe, sinon dans _internal (bundle)."""
p = get_exe_dir() / filename
if p.exists():
return p
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
p = Path(sys._MEIPASS) / "icon.png"
p = Path(sys._MEIPASS) / filename
if p.exists():
return p
return None
@@ -558,15 +558,12 @@ class App(tk.Tk):
header = ttk.Frame(self)
header.pack(fill="x", padx=15, pady=(15, 5))
# Icône dans le coin haut gauche (32x32, ratio conservé)
if self._app_icon:
# Icône dans le coin haut gauche (icon_small.png pré-générée à 32x32)
small_path = self._find_icon("icon_small.png")
if small_path:
try:
w, h = self._app_icon.width(), self._app_icon.height()
# Calculer un diviseur commun pour garder le ratio
divisor = max(1, max(w, h) // 32)
icon_small = tk.PhotoImage(file=str(self._find_icon())).subsample(divisor, divisor)
self._icon_small = icon_small
tk.Label(header, image=icon_small, bg=bg, bd=0).pack(side="left", padx=(0, 8))
self._icon_small = tk.PhotoImage(file=str(small_path))
tk.Label(header, image=self._icon_small, bg=bg, bd=0).pack(side="left", padx=(0, 8))
except Exception as e:
log.warning(f"Icone header: {e}")