#!/usr/bin/env python3 """Quick test of GUI initialization""" import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).parent)) # Fix Qt plugin conflict with OpenCV - must be done BEFORE any imports import os os.environ.pop('QT_QPA_PLATFORM_PLUGIN_PATH', None) # Import PyQt5 BEFORE cv2 to avoid plugin conflicts from PyQt5.QtWidgets import QApplication from PyQt5.QtCore import Qt # Now safe to import other modules from gui.main_window import MainWindow from gui.orchestrator import RPAOrchestrator def test_orchestrator(): """Test orchestrator initialization""" print("Testing orchestrator...") orch = RPAOrchestrator() # Test initialization success = orch.initialize_components() print(f" Components initialized: {success}") # Test workflow retrieval workflows = orch.get_workflows() print(f" Workflows: {len(workflows)}") print("āœ“ Orchestrator test passed") return True def test_gui(): """Test GUI creation""" print("\nTesting GUI...") # Use offscreen platform to avoid display issues os.environ['QT_QPA_PLATFORM'] = 'offscreen' app = QApplication(sys.argv) window = MainWindow() print(" Window created") print(f" Title: {window.windowTitle()}") print(f" Size: {window.width()}x{window.height()}") # Test orchestrator connection print(f" Orchestrator connected: {window.orchestrator is not None}") print("āœ“ GUI test passed") return True if __name__ == '__main__': try: test_orchestrator() test_gui() print("\nāœ“ All tests passed!") except Exception as e: print(f"\nāœ— Test failed: {e}") import traceback traceback.print_exc() sys.exit(1)