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