| Home | Trees | Indices | Help |
|
|---|
|
|
1 # ==================================================================================
2 #
3 # Copyright (C) 2007-2008 Conceptive Engineering bvba. All rights reserved.
4 # www.conceptive.be / project-camelot@conceptive.be
5 #
6 # This file is part of the Camelot Library.
7 #
8 # This file may be used under the terms of the GNU General Public
9 # License version 2.0 as published by the Free Software Foundation
10 # and appearing in the file LICENSE.GPL included in the packaging of
11 # this file. Please review the following information to ensure GNU
12 # General Public Licensing requirements will be met:
13 # http://www.trolltech.com/products/qt/opensource.html
14 #
15 # If you are unsure which license is appropriate for your use, please
16 # review the following information:
17 # http://www.trolltech.com/products/qt/licensing.html or contact
18 # project-camelot@conceptive.be.
19 #
20 # This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
21 # WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22 #
23 # For use of this library in commercial applications, please contact
24 # project-camelot@conceptive.be
25 #
26 # ==================================================================================
27
28 import logging
29
30 logger = logging.getLogger('animation')
31
32 from PyQt4 import QtGui
33 from PyQt4 import QtCore
34 from PyQt4.QtCore import Qt
35
36 from camelot.view import art
37
39 """Simulates a QMovie using a QLabel"""
40
42 logger.debug('creating movie widget')
43 super(MovieWidget, self).__init__(parent)
44 self.current_frame = 0
45 self.last_frame = len(icons) - 1
46 self.pixmaps = self._create_pixmaps(icons)
47 self.started = False
48
50 result = []
51 for ic in icons:
52 px = QtGui.QPixmap(ic)
53 # scale to 16 x 16
54 #px = px.scaled(16, 16, Qt.KeepAspectRatio)
55 result.append(px)
56 return result
57
59 # logger.debug('movie started')
60 # if self.started:
61 # return
62 # self.timerId = self.startTimer(80) # 80 milliseconds
63 # self.started = True
64 #@attention: movie stuff was turned off, because it seems to crash the application sometimes,
65 # according to google this could be a bug in QT 4.4, VLC seems to suffer the same
66 # problem
67 pass
68
70 # logger.debug('movie stopped')
71 # if self.started:
72 # self.killTimer(self.timerId)
73 # self.started = False
74 pass
75
77 #logger.debug('changing movie frame')
78 self.setPixmap(self.pixmaps[self.current_frame])
79 self.current_frame += 1
80 if self.current_frame > self.last_frame:
81 self.current_frame = 0
82
84 """Spinning widget subclassing MovieWidget"""
85
87 logger.debug('creating throbber')
88
89 icons = [art.file_('Throbber-small-anim1.png'),
90 art.file_('Throbber-small-anim2.png'),
91 art.file_('Throbber-small-anim3.png'),
92 art.file_('Throbber-small-anim4.png'),
93 art.file_('Throbber-small-anim5.png'),
94 art.file_('Throbber-small-anim6.png'),
95 art.file_('Throbber-small-anim7.png'),
96 art.file_('Throbber-small-anim8.png')]
97
98 super(Throbber, self).__init__(icons, parent)
99
100 self.idle_pixmap = QtGui.QPixmap(art.file_('Throbber-small.png'))
101 self._idle_state()
102 parent.resize(parent.size())
103
105 self.setPixmap(self.idle_pixmap)
106
110
115
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Sat Jan 31 18:50:04 2009 | http://epydoc.sourceforge.net |