test_qt_minimal.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env python3
  2. """
  3. Minimal Qt/QML test app for kiosk mode debugging
  4. Tests basic Qt functionality without complex effects or image loading
  5. """
  6. import sys
  7. import os
  8. from pathlib import Path
  9. from PySide6.QtCore import QUrl
  10. from PySide6.QtGui import QGuiApplication
  11. from PySide6.QtQml import QQmlApplicationEngine
  12. def main():
  13. # Check for kiosk mode flag
  14. kiosk_mode = '--kiosk' in sys.argv or os.environ.get('KIOSK_MODE', '0') == '1'
  15. if kiosk_mode:
  16. # Set Qt platform for fullscreen framebuffer mode
  17. # Try linuxfb instead of eglfs (software rendering, no GPU)
  18. os.environ['QT_QPA_PLATFORM'] = 'linuxfb'
  19. os.environ['QT_QPA_FB_DRM'] = '0' # Disable DRM
  20. print("🖥️ Running in KIOSK MODE (linuxfb - software rendering)")
  21. else:
  22. print("🪟 Running in WINDOWED MODE (development)")
  23. print(" Use --kiosk flag or set KIOSK_MODE=1 for fullscreen")
  24. app = QGuiApplication(sys.argv)
  25. # Load minimal QML
  26. engine = QQmlApplicationEngine()
  27. qml_file = Path(__file__).parent / "test_minimal.qml"
  28. engine.load(QUrl.fromLocalFile(str(qml_file)))
  29. if not engine.rootObjects():
  30. print("❌ Failed to load QML")
  31. return -1
  32. print("✅ Qt app started successfully")
  33. return app.exec()
  34. if __name__ == "__main__":
  35. sys.exit(main())