v0.6.5 - Fix affichage icone dans le header

Changements :
- Methode _find_icon() : cherche icon.png a cote de l'exe puis dans _internal comme fallback
- Redimensionnement corrige : diviseur commun pour conserver le ratio (image 912x1164)
- tk.Label au lieu de ttk.Label pour l'image (meilleur rendu sur fond sombre)
- icon.png bundle dans l'exe via --add-data pour fonctionner sans le fichier externe
- Logs d'erreur si l'icone ne charge pas

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-24 22:24:24 +01:00
parent 1a51d6b5fa
commit 8718b04a7d
6 changed files with 28 additions and 15 deletions

Binary file not shown.

Binary file not shown.

BIN
_internal/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

@@ -25,7 +25,7 @@ python -c "from PIL import Image; img = Image.open('icon.png'); img.save('icon.i
echo [*] Compilation en cours...
echo.
pyinstaller --onedir --noconsole --name "GitUpdateChecker" --icon=icon.ico -y git_updater.py
pyinstaller --onedir --noconsole --name "GitUpdateChecker" --icon=icon.ico --add-data "icon.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.4"
VERSION = "0.6.5"
import subprocess
import sys
@@ -484,6 +484,18 @@ def do_restore(local_path):
# ── Interface graphique ──────────────────────────────────────────────────────
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"
if p.exists():
return p
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
p = Path(sys._MEIPASS) / "icon.png"
if p.exists():
return p
return None
def __init__(self):
super().__init__()
self.title(f"Git Update Checker v{VERSION}")
@@ -496,12 +508,13 @@ class App(tk.Tk):
# Icône de la fenêtre (barre de titre + taskbar)
self._app_icon = None
icon_path = get_exe_dir() / "icon.png"
if icon_path.exists():
icon_path = self._find_icon()
if icon_path:
try:
self._app_icon = tk.PhotoImage(file=str(icon_path))
self.iconphoto(True, self._app_icon)
except Exception:
except Exception as e:
log.warning(f"Icone fenetre: {e}")
self._app_icon = None
log.info(f"=== Demarrage Git Update Checker v{VERSION} ===")
@@ -545,17 +558,17 @@ class App(tk.Tk):
header = ttk.Frame(self)
header.pack(fill="x", padx=15, pady=(15, 5))
# Icône dans le coin haut gauche (redimensionnée à 32x32)
# Icône dans le coin haut gauche (32x32, ratio conservé)
if self._app_icon:
try:
icon_small = tk.PhotoImage(file=str(get_exe_dir() / "icon.png")).subsample(
max(1, self._app_icon.width() // 32),
max(1, self._app_icon.height() // 32),
)
self._icon_small = icon_small # garder la référence
ttk.Label(header, image=icon_small, style="TLabel").pack(side="left", padx=(0, 8))
except Exception:
pass
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))
except Exception as e:
log.warning(f"Icone header: {e}")
ttk.Label(header, text=f"Git Update Checker v{VERSION}", style="Title.TLabel").pack(side="left")
self.status_label = ttk.Label(header, text="Verification en cours...", style="Status.TLabel")

View File

@@ -1 +1 @@
0.6.4
0.6.5