main.py 925 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. from init_var import *
  2. import os, sys, locale
  3. from logger import create_logger
  4. from PySide6.QtWidgets import QApplication
  5. from PySide6.QtCore import QLocale, QTranslator, QCoreApplication
  6. # from appdirs import user_data_dir
  7. def main():
  8. app = QApplication(sys.argv)
  9. create_logger()
  10. load_variables()
  11. from module.WorkWithDB import init_db
  12. from module.CleanerImage import CleanerImage
  13. from window.MainWindow import MainWindow
  14. init_db()
  15. CleanerImage(os.environ.get('PHOTO_DIR')) \
  16. .clear()
  17. translator = QTranslator(app)
  18. path_lang = os.path.join(os.environ.get("ABSOLUTE_PATH"), "window", "lang")
  19. if translator.load(QLocale(), 'propusk', '.', path_lang):
  20. app.installTranslator(translator)
  21. else:
  22. #
  23. print(1)
  24. window = MainWindow()
  25. window.show()
  26. sys.exit(app.exec())
  27. if __name__ == "__main__":
  28. main()