From 41c953112ae6ef87eac3ca461b4b1a023435368d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 24 Dec 2019 12:53:19 +0100 Subject: [PATCH] Make animation time instead of update dependant CURA-6823 --- cura/UI/CuraSplashScreen.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cura/UI/CuraSplashScreen.py b/cura/UI/CuraSplashScreen.py index 70df454e7d..4074020865 100644 --- a/cura/UI/CuraSplashScreen.py +++ b/cura/UI/CuraSplashScreen.py @@ -9,6 +9,7 @@ from UM.Resources import Resources from UM.Application import Application from cura import ApplicationMetadata +import time class CuraSplashScreen(QSplashScreen): def __init__(self): @@ -34,15 +35,20 @@ class CuraSplashScreen(QSplashScreen): self._change_timer.setSingleShot(False) self._change_timer.timeout.connect(self.updateLoadingImage) + self._last_update_time = None + def show(self): super().show() + self._last_update_time = time.time() self._change_timer.start() def updateLoadingImage(self): if self._to_stop: return - - self._loading_image_rotation_angle -= 10 + time_since_last_update = time.time() - self._last_update_time + self._last_update_time = time.time() + # Since we don't know how much time actually passed, check how many intervals of 50 we had. + self._loading_image_rotation_angle -= 10 * (time_since_last_update * 1000 / 50) self.repaint() # Override the mousePressEvent so the splashscreen doesn't disappear when clicked