CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
Vispa.Main.RotatingIcon.RotatingIcon Class Reference
Inheritance diagram for Vispa.Main.RotatingIcon.RotatingIcon:

Public Member Functions

def __init__ (self, resource, parent=None, steps=20, width=15, height=15)
 
def setProgress (self, progress)
 
def start (self)
 
def stop (self)
 

Private Member Functions

def _renderPixmaps (self)
 

Private Attributes

 _height
 
 _pixmaps
 
 _progressTimeLine
 
 _resource
 
 _steps
 
 _width
 

Detailed Description

Definition at line 5 of file RotatingIcon.py.

Constructor & Destructor Documentation

def Vispa.Main.RotatingIcon.RotatingIcon.__init__ (   self,
  resource,
  parent = None,
  steps = 20,
  width = 15,
  height = 15 
)

Definition at line 6 of file RotatingIcon.py.

6  def __init__(self,resource,parent=None,steps=20,width=15,height=15):
7  QLabel.__init__(self,parent)
8  self._resource=resource
9  self._steps=steps
10  self._width=width
11  self._height=height
12  self._progressTimeLine = QTimeLine(1000, self)
13  self._progressTimeLine.setFrameRange(0, self._steps)
14  self._progressTimeLine.setLoopCount(0)
15  self.connect(self._progressTimeLine, SIGNAL("frameChanged(int)"), self.setProgress)
16  self._renderPixmaps()
17  self.setProgress(0)
18 
def __init__(self, resource, parent=None, steps=20, width=15, height=15)
Definition: RotatingIcon.py:6

Member Function Documentation

def Vispa.Main.RotatingIcon.RotatingIcon._renderPixmaps (   self)
private

Definition at line 19 of file RotatingIcon.py.

19  def _renderPixmaps(self):
20  self._pixmaps=[]
21  for i in range(self._steps+1):
22  angle = int(i * 360.0 / self._steps)
23  pixmap = QPixmap(self._resource)
24  # if problem with loading png
25  if pixmap.size().width()==0:
26  self._pixmaps=None
27  return
28  rotate_matrix = QMatrix()
29  rotate_matrix.rotate(angle)
30  pixmap_rotated = pixmap.transformed(rotate_matrix)
31  pixmap_moved = QPixmap(pixmap.size())
32  pixmap_moved.fill(Qt.transparent)
33  painter = QPainter()
34  painter.begin(pixmap_moved)
35  painter.drawPixmap((pixmap_moved.width() - pixmap_rotated.width()) / 2.0, (pixmap_moved.height() - pixmap_rotated.height()) / 2.0, pixmap_rotated)
36  painter.end()
37  self._pixmaps+=[pixmap_moved.scaled(self._width, self._height)]
38 
def Vispa.Main.RotatingIcon.RotatingIcon.setProgress (   self,
  progress 
)

Definition at line 39 of file RotatingIcon.py.

References Vispa.Main.RotatingIcon.RotatingIcon._pixmaps.

Referenced by Vispa.Main.RotatingIcon.RotatingIcon.start().

39  def setProgress(self, progress):
40  if self._pixmaps!=None:
41  self.setPixmap(self._pixmaps[progress])
42 
def Vispa.Main.RotatingIcon.RotatingIcon.start (   self)

Definition at line 43 of file RotatingIcon.py.

References Vispa.Main.RotatingIcon.RotatingIcon.setProgress().

Referenced by progressbar.ProgressBar.__next__(), Types.LuminosityBlockRange.cppID(), and Types.EventRange.cppID().

43  def start(self):
44  self.setProgress(0)
45  self._progressTimeLine.start()
46 
def Vispa.Main.RotatingIcon.RotatingIcon.stop (   self)

Definition at line 47 of file RotatingIcon.py.

47  def stop(self):
48  self._progressTimeLine.stop()

Member Data Documentation

Vispa.Main.RotatingIcon.RotatingIcon._height
private

Definition at line 11 of file RotatingIcon.py.

Vispa.Main.RotatingIcon.RotatingIcon._pixmaps
private

Definition at line 20 of file RotatingIcon.py.

Referenced by Vispa.Main.RotatingIcon.RotatingIcon.setProgress().

Vispa.Main.RotatingIcon.RotatingIcon._progressTimeLine
private

Definition at line 12 of file RotatingIcon.py.

Vispa.Main.RotatingIcon.RotatingIcon._resource
private

Definition at line 8 of file RotatingIcon.py.

Vispa.Main.RotatingIcon.RotatingIcon._steps
private

Definition at line 9 of file RotatingIcon.py.

Vispa.Main.RotatingIcon.RotatingIcon._width
private

Definition at line 10 of file RotatingIcon.py.