main.py 759 B

12345678910111213141516171819202122232425262728
  1. import sys
  2. import os
  3. from PyQt6.QtWidgets import QApplication
  4. from ui.main_window import MainWindow
  5. def get_resource_path(relative_path):
  6. if hasattr(sys, '_MEIPASS'):
  7. return os.path.join(sys._MEIPASS, relative_path)
  8. return os.path.join(os.path.abspath("."), relative_path)
  9. def main():
  10. app = QApplication(sys.argv)
  11. # Load stylesheet
  12. style_path = get_resource_path(os.path.join("resources", "style.qss"))
  13. try:
  14. with open(style_path, "r") as f:
  15. app.setStyleSheet(f.read())
  16. except FileNotFoundError:
  17. print(f"Warning: style.qss not found at {style_path}, using default styling.")
  18. window = MainWindow()
  19. window.show()
  20. sys.exit(app.exec())
  21. if __name__ == "__main__":
  22. main()