src/eric7/EricWidgets/EricAnimatedLabel.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
--- a/src/eric7/EricWidgets/EricAnimatedLabel.py	Wed Jul 13 11:16:20 2022 +0200
+++ b/src/eric7/EricWidgets/EricAnimatedLabel.py	Wed Jul 13 14:55:47 2022 +0200
@@ -18,10 +18,11 @@
     """
     Class implementing a label widget showing an animated pixmap.
     """
+
     def __init__(self, parent=None, *, animationFile="", interval=100):
         """
         Constructor
-        
+
         @param parent reference to the parent window
         @type QWidget
         @keyparam animationFile path to the file containing the animation data
@@ -30,29 +31,29 @@
         @type int
         """
         super().__init__(parent)
-        
+
         self.__timer = QTimer(self)
         self.__timer.setInterval(interval)
         self.__timer.timeout.connect(self.__animate)
-        
+
         self.__currentFrame = 0
         self.__frames = 0
         self.__pixmap = None
         self.__pixmapHeight = 0
         self.__animationFile = ""
         self.__animationFileLoaded = False
-        
+
         self.__loadAnimationFile(animationFile)
-    
+
     def __loadAnimationFile(self, animationFile):
         """
         Private method to load an animation file.
-        
+
         @param animationFile path to the file containing the animation data
         @type str
         """
         self.__animationFile = animationFile
-        
+
         pixmap = UI.PixmapCache.getPixmap(animationFile)
         if not pixmap.isNull():
             self.__pixmap = pixmap
@@ -65,9 +66,9 @@
             self.__pixmapHeight = 0
             self.__frames = 0
             self.__animationFileLoaded = False
-        
+
         self.reset()
-    
+
     @pyqtSlot()
     def __animate(self):
         """
@@ -75,15 +76,17 @@
         """
         if self.__animationFileLoaded:
             self.__currentFrame = (self.__currentFrame + 1) % self.__frames
-            super().setPixmap(self.__pixmap.copy(
-                self.__currentFrame * self.__pixmapHeight,
-                0,
-                self.__pixmapHeight,
-                self.__pixmapHeight
-            ))
+            super().setPixmap(
+                self.__pixmap.copy(
+                    self.__currentFrame * self.__pixmapHeight,
+                    0,
+                    self.__pixmapHeight,
+                    self.__pixmapHeight,
+                )
+            )
         else:
             self.clear()
-    
+
     @pyqtSlot()
     def reset(self):
         """
@@ -91,7 +94,7 @@
         """
         self.__currentFrame = -1
         self.__animate()
-    
+
     @pyqtSlot()
     def start(self):
         """
@@ -99,27 +102,27 @@
         """
         if self.__animationFileLoaded:
             self.__timer.start()
-    
+
     @pyqtSlot()
     def stop(self):
         """
         Public slot to stop the animation.
         """
         self.__timer.stop()
-    
+
     def isActive(self):
         """
         Public method to check, if the animation is active.
-        
+
         @return flag indicating an active animation
         @rtype bool
         """
         return self.__timer.isActive() and self.__animationFileLoaded
-    
+
     def setAnimationFile(self, animationFile):
         """
         Public method to set the name of the animation file.
-        
+
         @param animationFile path to the file containing the animation data
         @type str
         """
@@ -128,51 +131,51 @@
         self.__loadAnimationFile(animationFile)
         if active and self.__animationFileLoaded:
             self.__timer.start()
-    
+
     def getAnimationFile(self):
         """
         Public method to get the name of the animation file.
-        
+
         @return path to the file containing the animation data
         @rtype str
         """
         return self.__animationFile
-    
+
     def isAnimationFileLoaded(self):
         """
         Public method to check, if the animation file was loaded.
-        
+
         @return flag indicating a successfully loaded animation file
         @rtype bool
         """
         return self.__animationFileLoaded
-    
+
     def setInterval(self, interval):
         """
         Public method to set the interval between the animated frames.
-        
+
         @param interval interval in milliseconds between animation frames
         @type int
         """
         self.__timer.setInterval(interval)
-    
+
     def getInterval(self):
         """
         Public method to get the interval between the animated frames.
-        
+
         @return interval in milliseconds between animation frames
         @rtype int
         """
         return self.__timer.interval()
-    
+
     def setPixmap(self, pixmap):
         """
         Public slot to set the pixmap of the label.
-        
+
         Setting a standard pixmap will stop the animation and set the given
         pixmap without animating it. Thereafter the animation has to be
         restarted with the start() method.
-        
+
         @param pixmap pixmap to be set
         @type QPixmap
         """

eric ide

mercurial