Example #1
0
class ProxyWebPage(QWebPage):
    """
    Custom web page implementation since we need to use
    the QGIS proxy settings if a proxy has been specified.
    """
    def __init__(self, parent=None):
        QWebPage.__init__(self, parent)
        self._manager = None

        # Set proxy in webpage
        proxy = getProxy()

        if proxy is not None:
            self._manager = QgsNetworkAccessManager()
            self._manager.setProxy(proxy)
            self.setNetworkAccessManager(self._manager)

    def javaScriptConsoleMessage(self, message, lineNumber, sourceID):
        # For debugging purposes
        logEntry = "%s[%d]: %s" % (sourceID, lineNumber, message)
        qDebug(logEntry)
        '''