eric6/WebBrowser/UrlBar/SslLabel.py

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

eric ide

mercurial