from PyQt5.QtWidgets import QApplication
import time 
from track2p.gui.main_wd import MainWindow
from PyQt5.QtGui import QIcon
import os

# the same script as track2p/gui/run_gui.py

if __name__ == '__main__':
    start_time = time.time()

    app = QApplication([])
 

    # Utiliser un chemin relatif pour l'icône
    icon_path = os.path.join(os.path.dirname(__file__), 'resources', 'logo.png')
    print(icon_path)
    
    if not os.path.exists(icon_path):
        print(f"Icon file not found: {icon_path}")
    else:
        app.setWindowIcon(QIcon(icon_path))
    
    mainWindow = MainWindow()
    mainWindow.setWindowTitle("track2p")
   
    end_time = time.time()
    print(f"Application took {end_time - start_time} seconds to open.")
    app.exec_()