75 lines
1.9 KiB
Python
75 lines
1.9 KiB
Python
"""
|
|
Script de démonstration pour tester l'interface GUI minimale
|
|
"""
|
|
|
|
import sys
|
|
from PyQt5.QtWidgets import QApplication
|
|
from PyQt5.QtCore import QTimer
|
|
from minimal_gui import MinimalGUI
|
|
|
|
|
|
def demo_mode_transitions(gui):
|
|
"""Démonstration des transitions de mode"""
|
|
modes = ["shadow", "assist", "auto", "shadow"]
|
|
current_mode_idx = [0]
|
|
|
|
def next_mode():
|
|
if current_mode_idx[0] < len(modes):
|
|
mode = modes[current_mode_idx[0]]
|
|
gui.update_mode_indicator(mode)
|
|
gui.show_notification(
|
|
f"Transition vers le mode {mode.upper()}",
|
|
"info"
|
|
)
|
|
current_mode_idx[0] += 1
|
|
|
|
# Changer de mode toutes les 3 secondes
|
|
timer = QTimer()
|
|
timer.timeout.connect(next_mode)
|
|
timer.start(3000)
|
|
|
|
return timer
|
|
|
|
|
|
def demo_suggestion(gui):
|
|
"""Démonstration de la superposition de suggestion"""
|
|
# Simuler une décision d'action
|
|
decision = {
|
|
"action_type": "click",
|
|
"target_element": "bouton_valider",
|
|
"bbox": (500, 300, 120, 40),
|
|
"confidence": 0.95,
|
|
"description": "Cliquer sur le bouton 'Valider' pour soumettre le formulaire"
|
|
}
|
|
|
|
# Attendre 2 secondes puis afficher la suggestion
|
|
QTimer.singleShot(2000, lambda: show_suggestion_demo(gui, decision))
|
|
|
|
|
|
def show_suggestion_demo(gui, decision):
|
|
"""Afficher la suggestion et traiter le retour"""
|
|
feedback = gui.show_suggestion(decision, animated=True)
|
|
print(f"Retour utilisateur: {feedback}")
|
|
|
|
|
|
def main():
|
|
"""Point d'entrée principal"""
|
|
app = QApplication(sys.argv)
|
|
|
|
# Créer l'interface GUI
|
|
gui = MinimalGUI()
|
|
gui.show()
|
|
|
|
# Démonstration des transitions de mode
|
|
mode_timer = demo_mode_transitions(gui)
|
|
|
|
# Démonstration de la suggestion (après 2 secondes)
|
|
# demo_suggestion(gui)
|
|
|
|
# Lancer l'application
|
|
sys.exit(app.exec_())
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|