init_var.py 920 B

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