__init__.py 544 B

123456789101112131415161718192021
  1. from datetime import datetime
  2. import os
  3. from PySide6.QtWidgets import QApplication
  4. # from PySide6.QtWidgets import QMessageBox
  5. def create_filename(prefix: str = "propusk") -> str:
  6. file_name = os.path.join(os.environ.get(
  7. 'PHOTO_DIR'), F"{prefix}_{datetime.now().timestamp()}")
  8. match prefix:
  9. case 'pdf':
  10. file_name = F"{file_name}.pdf"
  11. case _:
  12. file_name = F"{file_name}.jpg"
  13. return file_name
  14. def translate(string: str) -> str:
  15. return QApplication.translate('propusk', string)