|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2020 - 2022 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 PyQt6.QtCore import Qt |
|
11 |
|
12 from EricWidgets.EricClickableLabel import EricClickableLabel |
|
13 |
|
14 |
|
15 class SslLabel(EricClickableLabel): |
|
16 """ |
|
17 Class implementing the label to show some SSL info (if available). |
|
18 """ |
|
19 okStyle = "QLabel { color : white; background-color : green; }" |
|
20 nokStyle = "QLabel { color : white; background-color : red; }" |
|
21 |
|
22 def __init__(self, parent=None): |
|
23 """ |
|
24 Constructor |
|
25 |
|
26 @param parent reference to the parent widget (QWidget) |
|
27 """ |
|
28 super().__init__(parent) |
|
29 |
|
30 self.setFocusPolicy(Qt.FocusPolicy.NoFocus) |
|
31 |
|
32 def setValidity(self, valid): |
|
33 """ |
|
34 Public method to set the validity indication. |
|
35 |
|
36 @param valid flag indicating the certificate validity (boolean) |
|
37 """ |
|
38 if valid: |
|
39 self.setStyleSheet(SslLabel.okStyle) |
|
40 else: |
|
41 self.setStyleSheet(SslLabel.nokStyle) |