Web Browser: removed some obsolete code and fixed a few not yet ported places. eric7

Sun, 05 Sep 2021 18:07:03 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 05 Sep 2021 18:07:03 +0200
branch
eric7
changeset 8582
ae6032e4b4ef
parent 8581
a6c893c8b7af
child 8583
aac629a05f8b

Web Browser: removed some obsolete code and fixed a few not yet ported places.

eric7/Preferences/__init__.py file | annotate | diff | comparison | revisions
eric7/WebBrowser/Tools/WebHitTestResult.py file | annotate | diff | comparison | revisions
eric7/WebBrowser/WebBrowserView.py file | annotate | diff | comparison | revisions
eric7/WebBrowser/WebBrowserWindow.py file | annotate | diff | comparison | revisions
eric7/eric7.py file | annotate | diff | comparison | revisions
--- a/eric7/Preferences/__init__.py	Sun Sep 05 16:30:19 2021 +0200
+++ b/eric7/Preferences/__init__.py	Sun Sep 05 18:07:03 2021 +0200
@@ -948,9 +948,9 @@
         "SslExceptionsDB": "{}",    # empty JSON dictionary
         "AlwaysRejectFaultyCertificates": False,
         "DoNotTrack": False,
-        "RefererSendReferer": 2,        # send always
-        "RefererDefaultPolicy": 3,      # don't send a referer when downgrading
-        "RefererTrimmingPolicy": 0,     # send full URL (no trimming)
+        "RefererSendReferer": 0,      # never send a referrer
+        "RefererDefaultPolicy": 3,    # don't send a referrer when downgrading
+        "RefererTrimmingPolicy": 0,   # send full URL (no trimming)
         "SendRefererWhitelist": ["qt-apps.org", "kde-apps.org"],
         "AcceptCookies": 2,         # CookieJar.AcceptOnlyFromSitesNavigatedTo
         "KeepCookiesUntil": 0,      # CookieJar.KeepUntilExpire
--- a/eric7/WebBrowser/Tools/WebHitTestResult.py	Sun Sep 05 16:30:19 2021 +0200
+++ b/eric7/WebBrowser/Tools/WebHitTestResult.py	Sun Sep 05 18:07:03 2021 +0200
@@ -115,10 +115,10 @@
         menu event.
         
         @param data context menu data
-        @type QWebEngineContextMenuData
+        @type QWebEngineContextMenuRequest
         """
-        from PyQt6.QtWebEngineCore import QWebEngineContextMenuData
-        if not data.isValid() or data.position().toPoint() != self.__pos:
+        from PyQt6.QtWebEngineCore import QWebEngineContextMenuRequest
+        if data.position() != self.__pos:
             return
         
         self.__linkTitle = data.linkText()
@@ -128,12 +128,12 @@
         
         if (
             data.mediaType() ==
-            QWebEngineContextMenuData.MediaType.MediaTypeImage
+            QWebEngineContextMenuRequest.MediaType.MediaTypeImage
         ):
             self.__imageUrl = data.mediaUrl()
         elif data.mediaType() in [
-            QWebEngineContextMenuData.MediaType.MediaTypeAudio,
-            QWebEngineContextMenuData.MediaType.MediaTypeVideo
+            QWebEngineContextMenuRequest.MediaType.MediaTypeAudio,
+            QWebEngineContextMenuRequest.MediaType.MediaTypeVideo
         ]:
             self.__mediaUrl = data.mediaUrl()
     
--- a/eric7/WebBrowser/WebBrowserView.py	Sun Sep 05 16:30:19 2021 +0200
+++ b/eric7/WebBrowser/WebBrowserView.py	Sun Sep 05 18:07:03 2021 +0200
@@ -585,7 +585,7 @@
         @type WebHitTestResult
         """
         spellCheckActionCount = 0
-        contextMenuData = self.page().contextMenuData()
+        contextMenuData = self.lastContextMenuRequest()
         hitTest.updateWithContextMenuData(contextMenuData)
         
         if bool(contextMenuData.misspelledWord()):
@@ -1160,7 +1160,10 @@
         
         if isinstance(data, QUrl):
             data = data.toString()
-        QApplication.clipboard().setText(data)
+        
+        # copy the URL to both clipboard areas
+        QApplication.clipboard().setText(data, QClipboard.Mode.Clipboard)
+        QApplication.clipboard().setText(data, QClipboard.Mode.Selection)
     
     def __downloadLink(self):
         """
@@ -1385,16 +1388,6 @@
         if WebBrowserWindow.autoScroller().mousePress(self, evt):
             evt.accept()
             return
-        
-        self.__mw.setEventMouseButtons(evt.buttons())
-        self.__mw.setEventKeyboardModifiers(evt.modifiers())
-        
-        if evt.button() == Qt.MouseButton.XButton1:
-            self.pageAction(QWebEnginePage.WebAction.Back).trigger()
-            evt.accept()
-        elif evt.button() == Qt.MouseButton.XButton2:
-            self.pageAction(QWebEnginePage.WebAction.Forward).trigger()
-            evt.accept()
     
     def _mouseReleaseEvent(self, evt):
         """
@@ -1410,7 +1403,7 @@
         self.__page.event(evt)
         if (
             not evt.isAccepted() and
-            self.__mw.eventMouseButtons() & Qt.MouseButton.MiddleButton
+            evt.button() == Qt.MouseButton.MiddleButton
         ):
             url = QUrl(QApplication.clipboard().text(
                 QClipboard.Mode.Selection))
@@ -1419,9 +1412,6 @@
                 url.isValid() and
                 url.scheme() != ""
             ):
-                self.__mw.setEventMouseButtons(Qt.MouseButton.NoButton)
-                self.__mw.setEventKeyboardModifiers(
-                    Qt.KeyboardModifier.NoModifier)
                 self.setSource(url)
         evt.setAccepted(accepted)
     
--- a/eric7/WebBrowser/WebBrowserWindow.py	Sun Sep 05 16:30:19 2021 +0200
+++ b/eric7/WebBrowser/WebBrowserWindow.py	Sun Sep 05 18:07:03 2021 +0200
@@ -163,9 +163,6 @@
         
         self.__shortcutsDialog = None
         
-        self.__eventMouseButtons = Qt.MouseButton.NoButton
-        self.__eventKeyboardModifiers = Qt.KeyboardModifier.NoModifier
-        
         WebBrowserWindow.setUseQtHelp(qthelp or bool(searchWord))
         
         self.webProfile(private)
@@ -4409,53 +4406,6 @@
         
         Preferences.setWebBrowser("StatusBarVisible", visible)
     
-    def eventMouseButtons(self):
-        """
-        Public method to get the last recorded mouse buttons.
-        
-        @return mouse buttons (Qt.MouseButtons)
-        """
-        return self.__eventMouseButtons
-    
-    def eventKeyboardModifiers(self):
-        """
-        Public method to get the last recorded keyboard modifiers.
-        
-        @return keyboard modifiers (Qt.KeyboardModifiers)
-        """
-        return self.__eventKeyboardModifiers
-    
-    def setEventMouseButtons(self, buttons):
-        """
-        Public method to record mouse buttons.
-        
-        @param buttons mouse buttons to record (Qt.MouseButtons)
-        """
-        self.__eventMouseButtons = buttons
-    
-    def setEventKeyboardModifiers(self, modifiers):
-        """
-        Public method to record keyboard modifiers.
-        
-        @param modifiers keyboard modifiers to record (Qt.KeyboardModifiers)
-        """
-        self.__eventKeyboardModifiers = modifiers
-    
-    def mousePressEvent(self, evt):
-        """
-        Protected method called by a mouse press event.
-        
-        @param evt reference to the mouse event (QMouseEvent)
-        """
-        if evt.button() == Qt.MouseButton.XButton1:
-            self.currentBrowser().triggerPageAction(
-                QWebEnginePage.WebAction.Back)
-        elif evt.button() == Qt.MouseButton.XButton2:
-            self.currentBrowser().triggerPageAction(
-                QWebEnginePage.WebAction.Forward)
-        else:
-            super().mousePressEvent(evt)
-    
     @classmethod
     def feedsManager(cls):
         """
--- a/eric7/eric7.py	Sun Sep 05 16:30:19 2021 +0200
+++ b/eric7/eric7.py	Sun Sep 05 18:07:03 2021 +0200
@@ -426,7 +426,6 @@
 # TODO: make the sidebars more modern with big icons and colored background
 # TODO: add an embedded help viewer based on QWebEngineView (right side)
 # TODO: make VCS status an embedded view (left side)
-# TODO: add a VCS diff view in the central area (view manager)
-# TODO: add a progress bar to show the record fetch status
+# TODO: add a VCS diff view in the central area (view manager) (?)
 # TODO: add plug-in repository as embedded view (right side)
 # TODO: add virtual environment manager as embedded view (right side)

eric ide

mercurial