WebBrowserPage: fixed a TypeError caused by code specific to Qt 5.12 and newer.

Sun, 17 Feb 2019 15:42:05 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 17 Feb 2019 15:42:05 +0100
changeset 6776
298b03ba2990
parent 6775
a84449ccb414
child 6777
348fa6a367f6
child 6778
6cb3483b8b45

WebBrowserPage: fixed a TypeError caused by code specific to Qt 5.12 and newer.

WebBrowser/WebBrowserPage.py file | annotate | diff | comparison | revisions
--- a/WebBrowser/WebBrowserPage.py	Sun Feb 17 12:57:26 2019 +0100
+++ b/WebBrowser/WebBrowserPage.py	Sun Feb 17 15:42:05 2019 +0100
@@ -550,22 +550,26 @@
     ## Methods below implement protocol handler related functions
     #############################################################
     
-    @pyqtSlot("QWebEngineRegisterProtocolHandlerRequest")
-    def __registerProtocolHandlerRequested(self, request):
-        """
-        Private slot to handle the registration of a custom protocol handler.
-        
-        @param request reference to the registration request
-        @type QWebEngineRegisterProtocolHandlerRequest
-        """
-        from PyQt5.QtWebEngineCore import \
-            QWebEngineRegisterProtocolHandlerRequest
-        
-        if self.__registerProtocolHandlerRequest:
-            del self.__registerProtocolHandlerRequest
-            self.__registerProtocolHandlerRequest = None
-        self.__registerProtocolHandlerRequest = \
-            QWebEngineRegisterProtocolHandlerRequest(request)
+    try:
+        @pyqtSlot("QWebEngineRegisterProtocolHandlerRequest")
+        def __registerProtocolHandlerRequested(self, request):
+            """
+            Private slot to handle the registration of a custom protocol handler.
+            
+            @param request reference to the registration request
+            @type QWebEngineRegisterProtocolHandlerRequest
+            """
+            from PyQt5.QtWebEngineCore import \
+                QWebEngineRegisterProtocolHandlerRequest
+            
+            if self.__registerProtocolHandlerRequest:
+                del self.__registerProtocolHandlerRequest
+                self.__registerProtocolHandlerRequest = None
+            self.__registerProtocolHandlerRequest = \
+                QWebEngineRegisterProtocolHandlerRequest(request)
+    except TypeError:
+        # this is supported with Qt 5.12 and later
+        pass
     
     def registerProtocolHandlerRequestUrl(self):
         """

eric ide

mercurial