Files
copydev-imposing-tool/main.py
Jules 5bd4a18660 Ajout logo CopyDev, icone et page A propos professionnelle
- Logo CopyDev 500x500 + icone 64x64
- Icone affichee dans la barre de titre et la taskbar
- Page A propos avec logo, version, description, coordonnees
  contact@copydev.fr, www.copydev.fr, copyright 2026

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 11:19:19 +01:00

62 lines
1.8 KiB
Python

#!/usr/bin/env python3
"""Copydev Imposing Tool — Point d'entree."""
import sys
import os
import hashlib
# Ajouter le repertoire racine au path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from PyQt6.QtWidgets import QApplication, QInputDialog, QMessageBox, QLineEdit
# Hash SHA-256 du mot de passe — jamais en clair dans le code
_PASSWORD_HASH = "f3dd6962a99a2fe2e03cd8e5cfa7dafb12570bdcca1b6590e27d95dcccdf1f58"
def _hash_password(pwd):
return hashlib.sha256(pwd.encode("utf-8")).hexdigest()
def _check_auth():
"""Demander le mot de passe au lancement."""
max_attempts = 3
for attempt in range(max_attempts):
pwd, ok = QInputDialog.getText(
None,
"Copydev Imposing Tool",
f"Mot de passe requis ({max_attempts - attempt} essai(s) restant(s)) :",
QLineEdit.EchoMode.Password,
)
if not ok:
return False
if _hash_password(pwd) == _PASSWORD_HASH:
return True
if attempt < max_attempts - 1:
QMessageBox.warning(None, "Erreur", "Mot de passe incorrect.")
QMessageBox.critical(None, "Acces refuse", "Trop de tentatives. L'application va se fermer.")
return False
def main():
app = QApplication(sys.argv)
app.setApplicationName("Copydev Imposing Tool")
app.setOrganizationName("Copydev")
# Icone application
from PyQt6.QtGui import QIcon
icon_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "resources", "logo.png")
if os.path.exists(icon_path):
app.setWindowIcon(QIcon(icon_path))
if not _check_auth():
sys.exit(1)
from app.main_window import MainWindow
window = MainWindow()
window.show()
sys.exit(app.exec())
if __name__ == "__main__":
main()