mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-15 02:35:57 +08:00
Make animation time instead of update dependant
CURA-6823
This commit is contained in:
parent
d110d04c36
commit
41c953112a
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user