-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackup.py
More file actions
51 lines (39 loc) · 1.76 KB
/
backup.py
File metadata and controls
51 lines (39 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
def run_visagevault():
"""Función para iniciar la aplicación con Splash Screen corregido (PySide6)."""
app = QApplication(sys.argv)
# --- 1. INSTANCIAR LA APP PRIMERO ---
window = VisageVaultApp()
# --- 2. PREPARAR IMAGEN ---
splash_path = "AnabasaSoft.png"
if not os.path.exists(splash_path):
splash_path = resource_path("AnabasaSoft.png")
pixmap = QPixmap(splash_path)
if pixmap.isNull():
pixmap = QPixmap(resource_path("visagevault.png")).scaled(
600, 400, Qt.KeepAspectRatio, Qt.SmoothTransformation
)
# --- 3. CONFIGURAR SPLASH SCREEN (CORRECCIÓN) ---
# ERROR ANTERIOR: QSplashScreen(window, pixmap) -> No permitido en PySide6
# SOLUCIÓN: Instanciar solo con pixmap y asignar padre después.
splash = QSplashScreen(pixmap)
# Asignamos la ventana principal como padre explícitamente.
# Los flags son vitales:
# - Qt.Window: Para que sea una ventana flotante y no se incruste dentro de la app.
# - Qt.FramelessWindowHint: Para quitar los bordes.
# - Qt.WindowStaysOnTopHint: Para reforzar que esté encima.
splash.setParent(window, Qt.Window | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint)
# Bloqueo Modal: Impide clics en la ventana 'padre' (window)
splash.setWindowModality(Qt.ApplicationModal)
# --- 4. MOSTRAR EN ORDEN ---
window.showMaximized() # Mostramos la App
splash.show() # Mostramos el Splash (al ser hijo, aparecerá encima)
app.processEvents() # Asegurar renderizado inmediato
# --- 5. ESPERAR 2 SEGUNDOS ---
loop = QEventLoop()
QTimer.singleShot(2000, loop.quit)
loop.exec()
# --- 6. TERMINAR ---
splash.finish(window)
sys.exit(app.exec())
if __name__ == "__main__":
run_visagevault()