63 Zeilen
2.1 KiB
Python
63 Zeilen
2.1 KiB
Python
"""
|
|
Social Media Account Generator - Hauptanwendung (Einstiegspunkt)
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
from PyQt5.QtWidgets import QApplication
|
|
from PyQt5.QtCore import Qt
|
|
|
|
# Stelle sicher, dass das Hauptverzeichnis im Pythonpfad ist
|
|
if os.path.dirname(os.path.abspath(__file__)) not in sys.path:
|
|
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
# Import der Hauptcontroller-Klasse
|
|
from controllers.main_controller import MainController
|
|
from utils.logger import setup_logger
|
|
from config.paths import PathConfig
|
|
|
|
# Stelle sicher, dass benötigte Verzeichnisse existieren
|
|
PathConfig.ensure_directories()
|
|
|
|
def main():
|
|
"""Hauptfunktion für die Anwendung."""
|
|
# High DPI Skalierung MUSS vor QApplication gesetzt werden
|
|
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
|
|
QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True)
|
|
|
|
# Logger initialisieren
|
|
logger = setup_logger()
|
|
logger.info("Anwendung wird gestartet...")
|
|
print("\n=== AccountForger wird gestartet ===")
|
|
|
|
# Feature 5: Process Guard initialisieren
|
|
from utils.process_guard import get_guard
|
|
get_guard().reset()
|
|
logger.info("Process Guard initialisiert")
|
|
|
|
# QApplication erstellen
|
|
app = QApplication(sys.argv)
|
|
|
|
try:
|
|
# Hauptcontroller initialisieren (mit QApplication-Instanz)
|
|
# Dies prüft auch die Lizenz und zeigt ggf. den Aktivierungsdialog
|
|
print("[INFO] Initialisiere Hauptcontroller...")
|
|
controller = MainController(app)
|
|
print("[INFO] Anwendung bereit - GUI wird geöffnet")
|
|
|
|
# Anwendung starten
|
|
sys.exit(app.exec_())
|
|
except SystemExit as e:
|
|
# Erwarteter Exit (z.B. bei fehlender Lizenz)
|
|
logger.info("Anwendung wird beendet")
|
|
print("[INFO] Anwendung beendet")
|
|
sys.exit(e.code)
|
|
except Exception as e:
|
|
# Unerwarteter Fehler
|
|
logger.error(f"Unerwarteter Fehler beim Start: {e}", exc_info=True)
|
|
print(f"[ERROR] Anwendung konnte nicht gestartet werden: {e}")
|
|
print("[INFO] Weitere Details finden Sie in den Log-Dateien")
|
|
sys.exit(1)
|
|
|
|
if __name__ == "__main__":
|
|
main() |