Some more fixes for the web browser NG.

Sat, 21 Oct 2017 19:22:16 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 21 Oct 2017 19:22:16 +0200
changeset 5921
d4797da58218
parent 5920
e47dd106c3d6
child 5922
4ee909600092

Some more fixes for the web browser NG.

WebBrowser/AdBlock/AdBlockRule.py file | annotate | diff | comparison | revisions
WebBrowser/WebBrowserView.py file | annotate | diff | comparison | revisions
--- a/WebBrowser/AdBlock/AdBlockRule.py	Sat Oct 21 19:17:27 2017 +0200
+++ b/WebBrowser/AdBlock/AdBlockRule.py	Sat Oct 21 19:22:16 2017 +0200
@@ -11,7 +11,7 @@
 
 import re
 
-from PyQt5.QtCore import Qt, QRegExp
+from PyQt5.QtCore import PYQT_VERSION, Qt, QRegExp
 from PyQt5.QtWebEngineCore import QWebEngineUrlRequestInfo
 
 from Globals import qVersionTuple
@@ -534,7 +534,7 @@
         match = (
             req.resourceType() ==
             QWebEngineUrlRequestInfo.ResourceTypeSubResource)
-        if qVersionTuple() >= (5, 7, 0):
+        if qVersionTuple() >= (5, 7, 0) and PYQT_VERSION >= 0x50700:
             match = match or (
                 req.resourceType() ==
                 QWebEngineUrlRequestInfo.ResourceTypePluginResource)
--- a/WebBrowser/WebBrowserView.py	Sat Oct 21 19:17:27 2017 +0200
+++ b/WebBrowser/WebBrowserView.py	Sat Oct 21 19:22:16 2017 +0200
@@ -362,9 +362,10 @@
         """
         Public slot to clear the current selection.
         """
-        if qVersionTuple() >= (5, 7, 0):
+        try:
             self.triggerPageAction(QWebEnginePage.Unselect)
-        else:
+        except AttributeError:
+            # prior to 5.7.0
             self.page().runJavaScript(
                 "window.getSelection().empty()",
                 WebBrowserPage.SafeJsWorld)
@@ -545,7 +546,7 @@
         @type WebHitTestResult
         """
         spellCheckActionCount = 0
-        if qVersionTuple() >= (5, 7, 0):
+        if qVersionTuple() >= (5, 7, 0) and PYQT_VERSION >= 0x50700:
             contextMenuData = self.page().contextMenuData()
             hitTest.updateWithContextMenuData(contextMenuData)
             

eric ide

mercurial