69 Zeilen
2.3 KiB
Python
69 Zeilen
2.3 KiB
Python
"""
|
|
Zentralisierte UI-Dialoge für Account-Erstellung
|
|
"""
|
|
from PyQt5.QtWidgets import QMessageBox
|
|
from typing import Dict, Any, Optional
|
|
|
|
|
|
class AccountInfo:
|
|
"""Datenklasse für Account-Informationen"""
|
|
def __init__(self, username: str, password: str, email: Optional[str] = None, phone: Optional[str] = None):
|
|
self.username = username
|
|
self.password = password
|
|
self.email = email
|
|
self.phone = phone
|
|
|
|
|
|
class AccountCreationResultDialog:
|
|
"""Kapselt alle UI-Dialoge für Account-Erstellung"""
|
|
|
|
@staticmethod
|
|
def show_success(parent, account_info: AccountInfo):
|
|
"""Zeigt Erfolgs-Dialog"""
|
|
message = f"Account erfolgreich erstellt!\n\n"
|
|
message += f"Benutzername: {account_info.username}\n"
|
|
message += f"Passwort: {account_info.password}\n"
|
|
|
|
if account_info.email:
|
|
message += f"E-Mail: {account_info.email}"
|
|
elif account_info.phone:
|
|
message += f"Telefon: {account_info.phone}"
|
|
|
|
QMessageBox.information(
|
|
parent,
|
|
"Erfolg",
|
|
message
|
|
)
|
|
|
|
@staticmethod
|
|
def show_error(parent, error_message: str):
|
|
"""Zeigt Fehler-Dialog"""
|
|
QMessageBox.critical(parent, "Fehler", error_message)
|
|
|
|
@staticmethod
|
|
def show_warning(parent, warning_message: str):
|
|
"""Zeigt Warnung-Dialog"""
|
|
QMessageBox.warning(parent, "Warnung", warning_message)
|
|
|
|
@staticmethod
|
|
def show_account_details(parent, platform: str, account_data: Dict[str, Any]):
|
|
"""Zeigt detaillierte Account-Informationen"""
|
|
username = account_data.get('username', '')
|
|
password = account_data.get('password', '')
|
|
email = account_data.get('email')
|
|
phone = account_data.get('phone')
|
|
|
|
account_info = AccountInfo(username, password, email, phone)
|
|
AccountCreationResultDialog.show_success(parent, account_info)
|
|
|
|
@staticmethod
|
|
def confirm_cancel(parent) -> bool:
|
|
"""Zeigt Bestätigungs-Dialog für Abbruch"""
|
|
reply = QMessageBox.question(
|
|
parent,
|
|
"Abbrechen bestätigen",
|
|
"Möchten Sie die Account-Erstellung wirklich abbrechen?",
|
|
QMessageBox.Yes | QMessageBox.No,
|
|
QMessageBox.No
|
|
)
|
|
return reply == QMessageBox.Yes |