EncrypC_14.py 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. def decrypt_execute(self):
  2. self.freeze_controls()
  3. try:
  4. self._cipher = EncryptionTool(
  5. self._file_url.get(), self._secret_key.get(), self._salt.get()
  6. )
  7. for percentage in self._cipher.decrypt():
  8. if self.should_cancel:
  9. break
  10. percentage = "{0:.2f}%".format(percentage)
  11. self._status.set(percentage)
  12. self.status_label.update()
  13. if self.should_cancel:
  14. self._cipher.abort()
  15. self._status.set("Cancellation Successful !!")
  16. messagebox.showinfo("EncrypC", "Cancellation Successful !!")
  17. self._cipher = None
  18. self.should_cancel = False
  19. self.unfreeze_controls()
  20. return
  21. self._cipher = None
  22. self.should_cancel = False
  23. self._status.set("File Decryption Successful !!")
  24. messagebox.showinfo("EncrypC", "File Decryption Successful !!")
  25. except Exception as e:
  26. self._status.set(e)
  27. self.unfreeze_controls()