src/eric7/WebBrowser/UrlBar/FavIconLabel.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9473
3f23dbf37dbe
diff -r e9e7eca7efee -r bf71ee032bb4 src/eric7/WebBrowser/UrlBar/FavIconLabel.py
--- a/src/eric7/WebBrowser/UrlBar/FavIconLabel.py	Wed Jul 13 11:16:20 2022 +0200
+++ b/src/eric7/WebBrowser/UrlBar/FavIconLabel.py	Wed Jul 13 14:55:47 2022 +0200
@@ -16,81 +16,82 @@
     """
     Class implementing the label to show the web site icon.
     """
+
     def __init__(self, parent=None):
         """
         Constructor
-        
+
         @param parent reference to the parent widget (QWidget)
         """
         super().__init__(parent)
-        
+
         self.__browser = None
         self.__dragStartPos = QPoint()
-        
+
         self.setFocusPolicy(Qt.FocusPolicy.NoFocus)
         self.setCursor(Qt.CursorShape.ArrowCursor)
         self.setMinimumSize(16, 16)
         self.resize(16, 16)
-        
+
         self.__browserIconChanged()
-    
+
     def __browserIconChanged(self):
         """
         Private slot to set the icon.
         """
         if self.__browser:
-            self.setPixmap(
-                self.__browser.icon().pixmap(16, 16))
-    
+            self.setPixmap(self.__browser.icon().pixmap(16, 16))
+
     def __clearIcon(self):
         """
         Private slot to clear the icon.
         """
         self.setPixmap(QPixmap())
-    
+
     def setBrowser(self, browser):
         """
         Public method to set the browser connection.
-        
+
         @param browser reference to the browser widegt (HelpBrowser)
         """
         self.__browser = browser
         self.__browser.loadFinished.connect(self.__browserIconChanged)
         self.__browser.faviconChanged.connect(self.__browserIconChanged)
         self.__browser.loadStarted.connect(self.__clearIcon)
-    
+
     def mousePressEvent(self, evt):
         """
         Protected method to handle mouse press events.
-        
+
         @param evt reference to the mouse event (QMouseEvent)
         """
         if evt.button() == Qt.MouseButton.LeftButton:
             self.__dragStartPos = evt.position().toPoint()
         super().mousePressEvent(evt)
-    
+
     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.__showPopup(evt.globalPosition().toPoint())
         super().mouseReleaseEvent(evt)
-    
+
     def mouseMoveEvent(self, evt):
         """
         Protected method to handle mouse move events.
-        
+
         @param evt reference to the mouse event (QMouseEvent)
         """
         if (
-            evt.button() == Qt.MouseButton.LeftButton and (
-                (evt.position().toPoint() -
-                 self.__dragStartPos).manhattanLength() >
-                QApplication.startDragDistance()
-            ) and self.__browser is not None
+            evt.button() == Qt.MouseButton.LeftButton
+            and (
+                (evt.position().toPoint() - self.__dragStartPos).manhattanLength()
+                > QApplication.startDragDistance()
+            )
+            and self.__browser is not None
         ):
             drag = QDrag(self)
             mimeData = QMimeData()
@@ -104,20 +105,20 @@
                 drag.setPixmap(p)
             drag.setMimeData(mimeData)
             drag.exec()
-    
+
     def __showPopup(self, pos):
         """
         Private method to show the site info popup.
-        
+
         @param pos position the popup should be shown at
         @type QPoint
         """
         if self.__browser is None:
             return
-        
+
         url = self.__browser.url()
-        if url.isValid() and url.scheme() not in [
-                "eric", "about", "data", "chrome"]:
+        if url.isValid() and url.scheme() not in ["eric", "about", "data", "chrome"]:
             from ..SiteInfo.SiteInfoWidget import SiteInfoWidget
+
             info = SiteInfoWidget(self.__browser, self)
             info.showAt(pos)

eric ide

mercurial