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

Binary file not shown.

Binary file not shown.

BIN
_internal/icon_small.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -19,13 +19,13 @@ if errorlevel 1 (
pip install pyinstaller
)
echo [*] Conversion icon.png -> icon.ico...
python -c "from PIL import Image; img = Image.open('icon.png'); img.save('icon.ico', format='ICO', sizes=[(256,256),(128,128),(64,64),(32,32),(16,16)])"
echo [*] Conversion icon.png -> icon.ico + icon_small.png (32x32)...
python -c "from PIL import Image; img = Image.open('icon.png').convert('RGBA'); img.save('icon.ico', format='ICO', sizes=[(256,256),(128,128),(64,64),(32,32),(16,16)]); thumb = img.copy(); thumb.thumbnail((32,32), Image.LANCZOS); thumb.save('icon_small.png')"
echo [*] Compilation en cours...
echo.
pyinstaller --onedir --noconsole --name "GitUpdateChecker" --icon=icon.ico --add-data "icon.png:." -y git_updater.py
pyinstaller --onedir --noconsole --name "GitUpdateChecker" --icon=icon.ico --add-data "icon.png:." --add-data "icon_small.png:." -y git_updater.py
echo.
if exist "dist\GitUpdateChecker\GitUpdateChecker.exe" (

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}")

BIN
icon_small.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -1 +1 @@
0.6.5
0.6.6