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:
Binary file not shown.
Binary file not shown.
BIN
_internal/icon_small.png
Normal file
BIN
_internal/icon_small.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
@@ -19,13 +19,13 @@ if errorlevel 1 (
|
|||||||
pip install pyinstaller
|
pip install pyinstaller
|
||||||
)
|
)
|
||||||
|
|
||||||
echo [*] Conversion icon.png -> icon.ico...
|
echo [*] Conversion icon.png -> icon.ico + icon_small.png (32x32)...
|
||||||
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)])"
|
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 [*] Compilation en cours...
|
||||||
echo.
|
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.
|
echo.
|
||||||
if exist "dist\GitUpdateChecker\GitUpdateChecker.exe" (
|
if exist "dist\GitUpdateChecker\GitUpdateChecker.exe" (
|
||||||
|
|||||||
@@ -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.
|
Tous les chemins sont relatifs à l'emplacement de l'exécutable.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
VERSION = "0.6.5"
|
VERSION = "0.6.6"
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
@@ -485,13 +485,13 @@ def do_restore(local_path):
|
|||||||
|
|
||||||
class App(tk.Tk):
|
class App(tk.Tk):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _find_icon():
|
def _find_icon(filename="icon.png"):
|
||||||
"""Cherche icon.png : d'abord à côté de l'exe, sinon dans _internal (bundle)."""
|
"""Cherche un fichier icône : d'abord à côté de l'exe, sinon dans _internal (bundle)."""
|
||||||
p = get_exe_dir() / "icon.png"
|
p = get_exe_dir() / filename
|
||||||
if p.exists():
|
if p.exists():
|
||||||
return p
|
return p
|
||||||
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
|
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
|
||||||
p = Path(sys._MEIPASS) / "icon.png"
|
p = Path(sys._MEIPASS) / filename
|
||||||
if p.exists():
|
if p.exists():
|
||||||
return p
|
return p
|
||||||
return None
|
return None
|
||||||
@@ -558,15 +558,12 @@ class App(tk.Tk):
|
|||||||
header = ttk.Frame(self)
|
header = ttk.Frame(self)
|
||||||
header.pack(fill="x", padx=15, pady=(15, 5))
|
header.pack(fill="x", padx=15, pady=(15, 5))
|
||||||
|
|
||||||
# Icône dans le coin haut gauche (32x32, ratio conservé)
|
# Icône dans le coin haut gauche (icon_small.png pré-générée à 32x32)
|
||||||
if self._app_icon:
|
small_path = self._find_icon("icon_small.png")
|
||||||
|
if small_path:
|
||||||
try:
|
try:
|
||||||
w, h = self._app_icon.width(), self._app_icon.height()
|
self._icon_small = tk.PhotoImage(file=str(small_path))
|
||||||
# Calculer un diviseur commun pour garder le ratio
|
tk.Label(header, image=self._icon_small, bg=bg, bd=0).pack(side="left", padx=(0, 8))
|
||||||
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:
|
except Exception as e:
|
||||||
log.warning(f"Icone header: {e}")
|
log.warning(f"Icone header: {e}")
|
||||||
|
|
||||||
|
|||||||
BIN
icon_small.png
Normal file
BIN
icon_small.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
@@ -1 +1 @@
|
|||||||
0.6.5
|
0.6.6
|
||||||
|
|||||||
Reference in New Issue
Block a user