init_var.py 876 B

1234567891011121314151617181920212223242526272829
  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.5 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. 'DEFAULT_PATH': '/home/asidorov/Документы/propusk_db'
  16. })
  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)