eric6/WebBrowser/UrlBar/SslLabel.py

Sat, 27 Feb 2021 12:08:23 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Feb 2021 12:08:23 +0100
changeset 8138
169e65a6787c
parent 7923
91e843545d9a
child 8143
2c730d5fd177
permissions
-rw-r--r--

Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).

7766
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7781
diff changeset
3 # Copyright (c) 2020 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
7766
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the label to show some SSL info (if available).
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 from PyQt5.QtCore import Qt
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 from E5Gui.E5ClickableLabel import E5ClickableLabel
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 class SslLabel(E5ClickableLabel):
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 """
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 Class implementing the label to show some SSL info (if available).
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 """
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 okStyle = "QLabel { color : white; background-color : green; }"
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 nokStyle = "QLabel { color : white; background-color : red; }"
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 def __init__(self, parent=None):
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 """
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 Constructor
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 @param parent reference to the parent widget (QWidget)
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 """
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 super(SslLabel, self).__init__(parent)
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 self.setFocusPolicy(Qt.NoFocus)
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 def setValidity(self, valid):
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 Public method to set the validity indication.
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 @param valid flag indicating the certificate validity (boolean)
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 """
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 if valid:
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 self.setStyleSheet(SslLabel.okStyle)
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 else:
0af772bc14c4 Web Browser
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 self.setStyleSheet(SslLabel.nokStyle)

eric ide

mercurial