eric6/WebBrowser/UrlBar/SslLabel.py

Wed, 07 Oct 2020 19:14:36 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 07 Oct 2020 19:14:36 +0200
changeset 7766
0af772bc14c4
child 7781
607a6098cb44
permissions
-rw-r--r--

Web Browser
-- added a SSL information page to the site info dialog
-- added a clickable SSL info label to the URL entry

# -*- coding: utf-8 -*-

# Copyright (c) 2020 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing the label to show some SSL info (if available).
"""

from __future__ import unicode_literals

from PyQt5.QtCore import Qt

from E5Gui.E5ClickableLabel import E5ClickableLabel


class SslLabel(E5ClickableLabel):
    """
    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(SslLabel, self).__init__(parent)
        
        self.setFocusPolicy(Qt.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