2 from PyQt4.QtGui import QLabel,QPixmap,QMatrix,QPainter
5 def __init__(self,resource,parent=None,steps=20,width=15,height=15):
6 QLabel.__init__(self,parent)
12 self._progressTimeLine.setFrameRange(0, self.
_steps)
13 self._progressTimeLine.setLoopCount(0)
20 for i
in range(self.
_steps+1):
21 angle = int(i * 360.0 / self.
_steps)
24 if pixmap.size().
width()==0:
27 rotate_matrix = QMatrix()
28 rotate_matrix.rotate(angle)
29 pixmap_rotated = pixmap.transformed(rotate_matrix)
30 pixmap_moved = QPixmap(pixmap.size())
31 pixmap_moved.fill(Qt.transparent)
33 painter.begin(pixmap_moved)
34 painter.drawPixmap((pixmap_moved.width() - pixmap_rotated.width()) / 2.0, (pixmap_moved.height() - pixmap_rotated.height()) / 2.0, pixmap_rotated)
40 self.setPixmap(self.
_pixmaps[progress])
44 self._progressTimeLine.start()
47 self._progressTimeLine.stop()