296 side = QTabBar.RightSide |
296 side = QTabBar.RightSide |
297 else: |
297 else: |
298 side = QTabBar.LeftSide |
298 side = QTabBar.LeftSide |
299 return side |
299 return side |
300 |
300 |
301 def animationLabel(self, index, animationFile): |
301 def animationLabel(self, index, animationFile, speed=100): |
302 """ |
302 """ |
303 Public slot to set an animated icon. |
303 Public slot to set an animated icon. |
304 |
304 |
305 @param index tab index (integer) |
305 @param index tab index (integer) |
306 @param animationFile name of the file containing the animation (string) |
306 @param animationFile name of the file containing the animation (string) |
|
307 @param speed animation speed of the icon in percent of the original |
|
308 icon's speed (integer) |
307 @return reference to the created label (QLabel) |
309 @return reference to the created label (QLabel) |
308 """ |
310 """ |
309 if index == -1: |
311 if index == -1: |
310 return None |
312 return None |
311 |
313 |
312 if hasattr(self.__tabBar, 'setTabButton'): |
314 if hasattr(self.__tabBar, 'setTabButton'): |
313 side = self.__freeSide() |
315 side = self.__freeSide() |
314 animation = QLabel(self) |
316 animation = QLabel(self) |
315 if animationFile and not animation.movie(): |
317 if animationFile and not animation.movie(): |
316 movie = QMovie(animationFile, QByteArray(), animation) |
318 movie = QMovie(animationFile, QByteArray(), animation) |
317 movie.setSpeed(50) |
319 movie.setSpeed(speed) |
318 animation.setMovie(movie) |
320 animation.setMovie(movie) |
319 movie.start() |
321 movie.start() |
320 self.__tabBar.setTabButton(index, side, None) |
322 self.__tabBar.setTabButton(index, side, None) |
321 self.__tabBar.setTabButton(index, side, animation) |
323 self.__tabBar.setTabButton(index, side, animation) |
322 return animation |
324 return animation |