-
Notifications
You must be signed in to change notification settings - Fork 2
/
flogger_moviesplash.py
53 lines (36 loc) · 1.21 KB
/
flogger_moviesplash.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#import sys, time
#from PyQt4.QtCore import Qt, QTimer
from PyQt4.QtGui import *
class MovieSplashScreen(QSplashScreen):
def __init__(self, movie, parent = None):
movie.jumpToFrame(0)
pixmap = QPixmap(movie.frameRect().size())
QSplashScreen.__init__(self, pixmap)
self.movie = movie
self.movie.frameChanged.connect(self.repaint)
def showEvent(self, event):
self.movie.start()
def hideEvent(self, event):
self.movie.stop()
def paintEvent(self, event):
painter = QPainter(self)
pixmap = self.movie.currentPixmap()
self.setMask(pixmap.mask())
painter.drawPixmap(0, 0, pixmap)
def sizeHint(self):
return self.movie.scaledSize()
'''
if __name__ == "__main__":
app = QApplication(sys.argv)
# movie = QMovie("animation.gif")
movie = QMovie("ogn-logo-ani.gif")
splash = MovieSplashScreen(movie)
splash.show()
start = time.time()
while movie.state() == QMovie.Running and time.time() < start + 10:
app.processEvents()
window = QWidget()
window.show()
splash.finish(window)
sys.exit(app.exec_())
'''