WebBrowserPage: fixed an AttributeError caused by using PyQtWebEngine 5.14 with older Qt variants.

Wed, 15 Apr 2020 19:17:07 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 15 Apr 2020 19:17:07 +0200
changeset 7540
7a44cb47054b
parent 7539
d6d4d83dad4c
child 7541
b265a2d0a797

WebBrowserPage: fixed an AttributeError caused by using PyQtWebEngine 5.14 with older Qt variants.

eric6/WebBrowser/WebBrowserPage.py file | annotate | diff | comparison | revisions
diff -r d6d4d83dad4c -r 7a44cb47054b eric6/WebBrowser/WebBrowserPage.py
--- a/eric6/WebBrowser/WebBrowserPage.py	Tue Apr 14 18:51:04 2020 +0200
+++ b/eric6/WebBrowser/WebBrowserPage.py	Wed Apr 15 19:17:07 2020 +0200
@@ -130,12 +130,13 @@
                 return False
         
         # GreaseMonkey
-        if PYQT_WEBENGINE_VERSION >= 0x50e00:       # PyQtWebEngine >= 5.14.0
+        try:
+            # PyQtWebEngine >= 5.14.0
             navigationType = type_ in [
                 QWebEnginePage.NavigationTypeLinkClicked,
                 QWebEnginePage.NavigationTypeRedirect
             ]
-        else:
+        except AttributeError:
             navigationType = type_ == QWebEnginePage.NavigationTypeLinkClicked
         if navigationType and url.toString().endswith(".user.js"):
             WebBrowserWindow.greaseMonkeyManager().downloadScript(url)

eric ide

mercurial