eric7/UI/SplashScreen.py

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

eric ide

mercurial