init_var.py 951 B

12345678910111213141516171819202122232425262728
  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.1 beta"
  7. DEFAULT_PATH = os.path.join(appdirs.user_data_dir(), "propusk")
  8. DEFAULT_PATH_PHOTO = os.path.join(DEFAULT_PATH, "photo")
  9. os.environ['VERSION'] = __VERSION
  10. # os.environ['DEFAULT_PATH'] = DEFAULT_PATH
  11. # os.environ['PHOTO_DIR'] = DEFAULT_PATH_PHOTO
  12. os.environ['ABSOLUTE_PATH'] = os.path.dirname(os.path.abspath(__file__))
  13. os.environ['NO_MEDIA_IMAGE'] = os.path.join(os.environ.get('ABSOLUTE_PATH'),
  14. 'image', 'no_media_main.jpg')
  15. os.environ['INDEX_PHOTO'] = '0'
  16. os.environ['INDEX_CAMERA'] = '1'
  17. def load_variables():
  18. # Load variable from .env
  19. dotenv_path = os.path.join(os.path.dirname(__file__), '.env')
  20. if not os.path.exists(dotenv_path):
  21. DialogCustomVariables(dotenv_path).exec_()
  22. load_dotenv(dotenv_path=dotenv_path)