Compilation .exe PyInstaller + fix chemins resources
- L'installation compile maintenant un vrai .exe autonome - Les raccourcis Bureau/Menu Demarrer pointent vers le .exe - Support PyInstaller pour les chemins resources (logo, icone) - La mise a jour recompile aussi le .exe - Fallback lanceur .vbs si compilation echoue Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
13
main.py
13
main.py
@@ -5,8 +5,15 @@ import sys
|
||||
import os
|
||||
import hashlib
|
||||
|
||||
# Ajouter le repertoire racine au path
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
# Support PyInstaller (chemin des resources)
|
||||
if getattr(sys, 'frozen', False):
|
||||
BASE_DIR = os.path.dirname(sys.executable)
|
||||
BUNDLE_DIR = sys._MEIPASS
|
||||
else:
|
||||
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
BUNDLE_DIR = BASE_DIR
|
||||
|
||||
sys.path.insert(0, BUNDLE_DIR)
|
||||
|
||||
from PyQt6.QtWidgets import QApplication, QInputDialog, QMessageBox, QLineEdit
|
||||
|
||||
@@ -44,7 +51,7 @@ def main():
|
||||
|
||||
# Icone application
|
||||
from PyQt6.QtGui import QIcon
|
||||
icon_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "resources", "logo.png")
|
||||
icon_path = os.path.join(BUNDLE_DIR, "resources", "logo.png")
|
||||
if os.path.exists(icon_path):
|
||||
app.setWindowIcon(QIcon(icon_path))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user