PrintJobUploadProgressMessage.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. # Copyright (c) 2019 Ultimaker B.V.
  2. # Cura is released under the terms of the LGPLv3 or higher.
  3. from UM import i18nCatalog
  4. from UM.Message import Message
  5. I18N_CATALOG = i18nCatalog("cura")
  6. class PrintJobUploadProgressMessage(Message):
  7. """Class responsible for showing a progress message while a mesh is being uploaded to the cloud."""
  8. def __init__(self):
  9. super().__init__(
  10. title = I18N_CATALOG.i18nc("@info:status", "Sending Print Job"),
  11. text = I18N_CATALOG.i18nc("@info:status", "Uploading print job to printer."),
  12. progress = -1,
  13. lifetime = 0,
  14. dismissable = False,
  15. use_inactivity_timer = False
  16. )
  17. def show(self):
  18. """Shows the progress message."""
  19. self.setProgress(0)
  20. super().show()
  21. def update(self, percentage: int) -> None:
  22. """Updates the percentage of the uploaded.
  23. :param percentage: The percentage amount (0-100).
  24. """
  25. if not self._visible:
  26. super().show()
  27. self.setProgress(percentage)