src/eric7/WebBrowser/UrlBar/SslLabel.py

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8881
54e42bc2437a
child 9221
bf71ee032bb4
diff -r 3fc8dfeb6ebe -r b99e7fd55fd3 src/eric7/WebBrowser/UrlBar/SslLabel.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/eric7/WebBrowser/UrlBar/SslLabel.py	Thu Jul 07 11:23:56 2022 +0200
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2020 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing the label to show some SSL info (if available).
+"""
+
+from PyQt6.QtCore import Qt
+
+from EricWidgets.EricClickableLabel import EricClickableLabel
+
+
+class SslLabel(EricClickableLabel):
+    """
+    Class implementing the label to show some SSL info (if available).
+    """
+    okStyle = "QLabel { color : white; background-color : green; }"
+    nokStyle = "QLabel { color : white; background-color : red; }"
+    
+    def __init__(self, parent=None):
+        """
+        Constructor
+        
+        @param parent reference to the parent widget (QWidget)
+        """
+        super().__init__(parent)
+        
+        self.setFocusPolicy(Qt.FocusPolicy.NoFocus)
+    
+    def setValidity(self, valid):
+        """
+        Public method to set the validity indication.
+        
+        @param valid flag indicating the certificate validity (boolean)
+        """
+        if valid:
+            self.setStyleSheet(SslLabel.okStyle)
+        else:
+            self.setStyleSheet(SslLabel.nokStyle)

eric ide

mercurial