I’d like to support custom protocol inside my pyside app but without success. So far I tried:
class MainWindow(QWebView):
def __init__(self, parent=None):
oldManager = self.page().networkAccessManager()
self.page().setNetworkAccessManager(NetworkAccessManager(self, oldManager))
#in another file
class NetworkAccessManager(QNetworkAccessManager):
def __init__(self, parent, oldManager):
QNetworkAccessManager.__init__(self)
self.oldManager = oldManager
self.setCache(oldManager.cache())
self.setCookieJar(oldManager.cookieJar())
self.setProxy(oldManager.proxy())
self.setProxyFactory(oldManager.proxyFactory())
print('There')
def createRequest(self, operation, request, data):
print('And there')
This results in a segmentation faultunder windows. I saw this :
It is currently not supported to change the network access manager after the PySide.QtWebKit.QWebPage has used it.
But I don’t see where it would be used in this case. I tried to set a web page object after setting the network manager and
the segmentation fault disappeared.
PS: none of the print statement is displayed inside the console.
If createRequest doesn’t return a reply it crahes. So the complete solution is:
Note: I don’t really know why but any error while the script is in the network manager or the reply results in a segmentation fault.
Based on this with some correction.