init_var.py 807 B

123456789101112131415161718192021222324252627
  1. import os
  2. import os
  3. import appdirs
  4. from dotenv import load_dotenv
  5. from window.DialogCustomVariables import DialogCustomVariables
  6. DEFAULT_PATH = os.path.join(appdirs.user_data_dir(), "propusk")
  7. DEFAULT_PATH_PHOTO = os.path.join(DEFAULT_PATH, "photo")
  8. no_media = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'image', 'no_media_main.jpg')
  9. os.environ.update({
  10. 'VERSION': "ver 0.4 beta",
  11. 'ABSOLUTE_PATH': os.path.dirname(os.path.abspath(__file__)),
  12. 'NO_MEDIA_IMAGE': no_media,
  13. 'INDEX_PHOTO': '0',
  14. 'INDEX_CAMERA': '1'
  15. })
  16. def load_variables():
  17. # Load variable from .env
  18. dotenv_path = os.path.join(os.path.dirname(__file__), '.env')
  19. if not os.path.exists(dotenv_path):
  20. DialogCustomVariables(dotenv_path).exec_()
  21. load_dotenv(dotenv_path=dotenv_path)