|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2006 - 2009 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing a splashscreen for eric4. |
|
8 """ |
|
9 |
|
10 import os.path |
|
11 import logging |
|
12 |
|
13 from PyQt4.QtCore import Qt |
|
14 from PyQt4.QtGui import QApplication, QPixmap, QSplashScreen, QColor |
|
15 |
|
16 from eric4config import getConfig |
|
17 |
|
18 class SplashScreen(QSplashScreen): |
|
19 """ |
|
20 Class implementing a splashscreen for eric4. |
|
21 """ |
|
22 def __init__(self): |
|
23 """ |
|
24 Constructor |
|
25 """ |
|
26 ericPic = QPixmap(os.path.join(getConfig('ericPixDir'), 'ericSplash.png')) |
|
27 self.labelAlignment = \ |
|
28 Qt.Alignment(Qt.AlignBottom | Qt.AlignRight | Qt.AlignAbsolute) |
|
29 QSplashScreen.__init__(self, ericPic) |
|
30 self.show() |
|
31 QApplication.flush() |
|
32 |
|
33 def showMessage(self, msg): |
|
34 """ |
|
35 Public method to show a message in the bottom part of the splashscreen. |
|
36 |
|
37 @param msg message to be shown (string) |
|
38 """ |
|
39 logging.debug(msg) |
|
40 QSplashScreen.showMessage(self, msg, self.labelAlignment, QColor(Qt.white)) |
|
41 QApplication.processEvents() |
|
42 |
|
43 def clearMessage(self): |
|
44 """ |
|
45 Public method to clear the message shown. |
|
46 """ |
|
47 QSplashScreen.clearMessage(self) |
|
48 QApplication.processEvents() |
|
49 |
|
50 class NoneSplashScreen(object): |
|
51 """ |
|
52 Class implementing a "None" splashscreen for eric4. |
|
53 |
|
54 This class implements the same interface as the real splashscreen, |
|
55 but simply does nothing. |
|
56 """ |
|
57 def __init__(self): |
|
58 """ |
|
59 Constructor |
|
60 """ |
|
61 pass |
|
62 |
|
63 def showMessage(self, msg): |
|
64 """ |
|
65 Public method to show a message in the bottom part of the splashscreen. |
|
66 |
|
67 @param msg message to be shown (string) |
|
68 """ |
|
69 logging.debug(msg) |
|
70 |
|
71 def clearMessage(self): |
|
72 """ |
|
73 Public method to clear the message shown. |
|
74 """ |
|
75 pass |
|
76 |
|
77 def finish(self, widget): |
|
78 """ |
|
79 Public method to finish the splash screen. |
|
80 |
|
81 @param widget widget to wait for (QWidget) |
|
82 """ |
|
83 pass |