src/eric7/UI/SplashScreen.py

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8881
54e42bc2437a
child 9221
bf71ee032bb4
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2006 - 2022 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 PyQt6.QtCore import Qt
14 from PyQt6.QtGui import QPixmap, QColor
15 from PyQt6.QtWidgets import QApplication, QSplashScreen
16
17 from eric7config 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 = (
31 Qt.AlignmentFlag.AlignBottom |
32 Qt.AlignmentFlag.AlignRight |
33 Qt.AlignmentFlag.AlignAbsolute
34 )
35 super().__init__(ericPic)
36 self.show()
37 QApplication.processEvents()
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