diff -r e9e7eca7efee -r bf71ee032bb4 src/eric7/WebBrowser/SafeBrowsing/SafeBrowsingLabel.py --- a/src/eric7/WebBrowser/SafeBrowsing/SafeBrowsingLabel.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/WebBrowser/SafeBrowsing/SafeBrowsingLabel.py Wed Jul 13 14:55:47 2022 +0200 @@ -14,54 +14,55 @@ class SafeBrowsingLabel(QLabel): """ Class implementing a label to show some Safe Browsing info. - + @signal clicked(pos) emitted to indicate a click of the label (QPoint) """ + clicked = pyqtSignal(QPoint) - + 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) self.setCursor(Qt.CursorShape.PointingHandCursor) - + self.setStyleSheet(SafeBrowsingLabel.nokStyle) - + self.__threatType = "" self.__threatMessages = "" - + self.__deafultText = self.tr("Malicious Site") self.__updateLabel() - + def mouseReleaseEvent(self, evt): """ Protected method to handle mouse release events. - + @param evt reference to the mouse event (QMouseEvent) """ if evt.button() == Qt.MouseButton.LeftButton: self.clicked.emit(evt.globalPosition().toPoint()) else: super().mouseReleaseEvent(evt) - + def mouseDoubleClickEvent(self, evt): """ Protected method to handle mouse double click events. - + @param evt reference to the mouse event (QMouseEvent) """ if evt.button() == Qt.MouseButton.LeftButton: self.clicked.emit(evt.globalPosition().toPoint()) else: super().mouseDoubleClickEvent(evt) - + @pyqtSlot() def __updateLabel(self): """ @@ -71,12 +72,12 @@ self.setText(self.__threatType) else: self.setText(self.__deafultText) - + @pyqtSlot(str, str) def setThreatInfo(self, threatType, threatMessages): """ Public slot to set threat information. - + @param threatType threat type @type str @param threatMessages more verbose info about detected threats @@ -84,13 +85,13 @@ """ self.__threatType = threatType self.__threatMessages = threatMessages - + self.__updateLabel() - + def getThreatInfo(self): """ Public method to get the threat info text. - + @return threat info text @rtype str """