""" Forge Animation Widget V2 - Verbessertes Design mit prominenter Warnung Angepasst an den bestehenden Code mit minimalen Änderungen """ from PyQt5.QtWidgets import QDialog, QWidget, QVBoxLayout, QLabel, QTextEdit, QPushButton, QHBoxLayout, QFrame from PyQt5.QtCore import Qt, pyqtSignal, QTimer from PyQt5.QtGui import QFont, QMovie, QPixmap class ForgeAnimationDialog(QDialog): """Modal-Dialog für die Account-Erstellung mit verbessertem Design""" # Signal wenn Abbrechen geklickt wird cancel_clicked = pyqtSignal() # Signal wenn Dialog geschlossen wird closed = pyqtSignal() def __init__(self, parent=None): super().__init__(parent) self.init_ui() # Timer für das regelmäßige Nach-vorne-Holen self.raise_timer = QTimer() self.raise_timer.timeout.connect(self._raise_to_front) self.raise_timer.setInterval(500) # Alle 500ms def init_ui(self): """Initialisiert die UI mit verbessertem Design""" # Nur Dialog im Vordergrund, nicht das ganze Hauptfenster self.setWindowFlags(Qt.Dialog | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint) self.setModal(False) # Nicht modal - blockiert nicht das Hauptfenster self.setFixedSize(650, 600) # Größer für bessere Sichtbarkeit # Styling für Light Theme self.setStyleSheet(""" ForgeAnimationDialog { background-color: #FFFFFF; border: 1px solid #E2E8F0; border-radius: 8px; } """) # Hauptlayout layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) # NEUE WARNUNG OBEN - Sehr auffällig! warning_banner = QFrame() warning_banner.setFixedHeight(80) warning_banner.setStyleSheet(""" QFrame { background-color: #DC2626; border-top-left-radius: 8px; border-top-right-radius: 8px; padding: 15px 30px; } """) warning_layout = QVBoxLayout(warning_banner) warning_layout.setContentsMargins(0, 10, 0, 10) # Großer Warning Text warning_text = QLabel("⚠️ BROWSER NICHT BERÜHREN!") warning_text.setAlignment(Qt.AlignCenter) warning_text.setStyleSheet(""" QLabel { color: #FFFFFF; font-size: 22px; font-weight: 700; font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; letter-spacing: 1px; } """) warning_subtext = QLabel("Jede Interaktion kann den Prozess unterbrechen") warning_subtext.setAlignment(Qt.AlignCenter) warning_subtext.setStyleSheet(""" QLabel { color: rgba(255, 255, 255, 0.9); font-size: 13px; font-weight: 400; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; } """) warning_layout.addWidget(warning_text) warning_layout.addWidget(warning_subtext) layout.addWidget(warning_banner) # Content Container content_container = QWidget() content_layout = QVBoxLayout(content_container) content_layout.setContentsMargins(30, 25, 30, 30) content_layout.setSpacing(20) # Titel (etwas größer) title_label = QLabel("Account wird erstellt") title_label.setObjectName("titleLabel") title_label.setAlignment(Qt.AlignCenter) title_label.setStyleSheet(""" QLabel#titleLabel { color: #1A365D; font-size: 26px; font-weight: 600; font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; padding-bottom: 10px; border: none; } """) content_layout.addWidget(title_label) # Moderne Info-Karte (angepasst) info_frame = QFrame() info_frame.setStyleSheet(""" QFrame { background: #DBEAFE; border: 1px solid #2563EB; border-radius: 12px; min-height: 100px; } """) info_layout = QHBoxLayout(info_frame) info_layout.setContentsMargins(20, 15, 20, 15) info_layout.setSpacing(15) # Icon Container icon_container = QFrame() icon_container.setFixedSize(50, 50) icon_container.setStyleSheet(""" QFrame { background: #2563EB; border-radius: 25px; } """) icon_layout = QVBoxLayout(icon_container) icon_layout.setContentsMargins(0, 0, 0, 0) icon_label = QLabel("🤖") icon_label.setAlignment(Qt.AlignCenter) icon_label.setStyleSheet(""" QLabel { font-size: 24px; background: transparent; border: none; color: white; } """) icon_layout.addWidget(icon_label) # Text Container text_container = QFrame() text_layout = QVBoxLayout(text_container) text_layout.setContentsMargins(0, 0, 0, 0) text_layout.setSpacing(5) # Titel info_title = QLabel("Automatisierung läuft") info_title.setObjectName("infoTitle") info_title.setStyleSheet(""" QLabel#infoTitle { color: #1E40AF; font-size: 17px; font-weight: 600; font-family: 'Segoe UI', -apple-system, sans-serif; background-color: transparent; border: none; } """) # Beschreibung (deutlicher) info_desc = QLabel("Der Browser arbeitet automatisch. Bitte warten Sie, bis der Vorgang abgeschlossen ist.") info_desc.setObjectName("infoDesc") info_desc.setWordWrap(True) info_desc.setStyleSheet(""" QLabel#infoDesc { color: #1E40AF; font-size: 14px; font-weight: 500; font-family: 'Segoe UI', -apple-system, sans-serif; background-color: transparent; border: none; line-height: 20px; } """) text_layout.addWidget(info_title) text_layout.addWidget(info_desc) text_layout.addStretch() info_layout.addWidget(icon_container) info_layout.addWidget(text_container, 1) content_layout.addWidget(info_frame) # Status Container status_container = QFrame() status_container.setStyleSheet(""" QFrame { background-color: #1A365D; border-radius: 8px; padding: 15px; } """) status_layout = QVBoxLayout(status_container) # Status-Label (größer) self.status_label = QLabel("Initialisiere...") self.status_label.setObjectName("statusLabel") self.status_label.setAlignment(Qt.AlignLeft) self.status_label.setStyleSheet(""" QLabel#statusLabel { color: #FFFFFF; font-size: 16px; padding: 5px; font-weight: 500; border: none; font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace; } """) status_layout.addWidget(self.status_label) content_layout.addWidget(status_container) # Log-Ausgabe (größer) self.log_output = QTextEdit() self.log_output.setReadOnly(True) self.log_output.setMaximumHeight(180) # Etwas größer self.log_output.setStyleSheet(""" QTextEdit { background-color: #F8FAFC; color: #2D3748; font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace; font-size: 12px; border: 1px solid #CBD5E0; border-radius: 8px; padding: 12px; } """) content_layout.addWidget(self.log_output) # Button-Container button_layout = QHBoxLayout() button_layout.addStretch() # Abbrechen-Button (weniger prominent) self.cancel_button = QPushButton("Abbrechen") self.cancel_button.setStyleSheet(""" QPushButton { background-color: #F0F4F8; color: #4A5568; font-size: 14px; font-weight: 500; padding: 8px 24px; border-radius: 24px; border: 1px solid #E2E8F0; min-height: 40px; } QPushButton:hover { background-color: #FEE2E2; color: #DC2626; border-color: #DC2626; } QPushButton:pressed { background-color: #DC2626; color: #FFFFFF; } """) self.cancel_button.clicked.connect(self.cancel_clicked.emit) button_layout.addWidget(self.cancel_button) button_layout.addStretch() content_layout.addLayout(button_layout) layout.addWidget(content_container) self.setLayout(layout) # Volle Sichtbarkeit self.setWindowOpacity(1.0) def start_animation(self): """Zeigt den Dialog an""" self.status_label.setText("Initialisiere...") self.raise_timer.start() # Starte Timer für Always-on-Top def stop_animation(self): """Stoppt die Animation und den Timer""" self.raise_timer.stop() def set_status(self, status: str): """Aktualisiert den Status-Text""" self.status_label.setText(status) def add_log(self, message: str): """Fügt eine Log-Nachricht hinzu""" self.log_output.append(message) # Auto-scroll zum Ende scrollbar = self.log_output.verticalScrollBar() scrollbar.setValue(scrollbar.maximum()) def clear_log(self): """Löscht alle Log-Nachrichten""" self.log_output.clear() def set_progress(self, value: int): """Setzt den Fortschritt (0-100) - wird ignoriert da wir Spinner nutzen""" pass def closeEvent(self, event): """Wird aufgerufen wenn der Dialog geschlossen wird""" self.stop_animation() self.closed.emit() event.accept() def keyPressEvent(self, event): """Verhindert das Schließen mit ESC""" if event.key() == Qt.Key_Escape: event.ignore() else: super().keyPressEvent(event) def _raise_to_front(self): """Holt den Dialog in den Vordergrund""" self.raise_() def show(self): """Überschreibt show() um den Dialog richtig zu positionieren""" super().show() self._raise_to_front() # Initial in den Vordergrund holen # Zusätzliche Widget-Klasse für den AccountForger class ForgeAnimationWidget(QLabel): """ Einfaches Animation Widget für den Progress Modal Kann einen Spinner oder andere Animation anzeigen """ def __init__(self): super().__init__() self.setText("⚙️") # Placeholder Icon self.setAlignment(Qt.AlignCenter) self.setStyleSheet(""" QLabel { font-size: 48px; color: #3182CE; } """) # Animation Timer self.animation_timer = QTimer() self.animation_timer.timeout.connect(self.rotate_icon) self.rotation_state = 0 def start_animation(self): """Startet die Animation""" self.animation_timer.start(100) def stop_animation(self): """Stoppt die Animation""" self.animation_timer.stop() def rotate_icon(self): """Einfache Rotation Animation""" icons = ["⚙️", "🔧", "🔨", "⚒️"] self.setText(icons[self.rotation_state % len(icons)]) self.rotation_state += 1