WebBrowser/GreaseMonkey/GreaseMonkeyManager.py

branch
QtWebEngine
changeset 4886
b56735d36159
parent 4767
0bace7c5ebc9
child 4905
09f38f85a3af
diff -r 362360f9a979 -r b56735d36159 WebBrowser/GreaseMonkey/GreaseMonkeyManager.py
--- a/WebBrowser/GreaseMonkey/GreaseMonkeyManager.py	Sun Mar 20 15:17:31 2016 +0100
+++ b/WebBrowser/GreaseMonkey/GreaseMonkeyManager.py	Sun Mar 20 20:13:29 2016 +0100
@@ -11,7 +11,8 @@
 
 import os
 
-from PyQt5.QtCore import pyqtSignal, QObject, QTimer, QFile, QDir, QSettings
+from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QObject, QTimer, QFile, QDir, \
+    QSettings, QMetaObject, QUrl, Q_ARG
 
 import Utilities
 import Preferences
@@ -41,7 +42,7 @@
         
         self.__interceptor = GreaseMonkeyUrlInterceptor(self)
         WebBrowserWindow.networkManager().installUrlInterceptor(
-            self.__interceptor)
+            GreaseMonkeyUrlInterceptor(self))
         
         QTimer.singleShot(0, self.__load)
     
@@ -70,10 +71,24 @@
         @param url URL to download script from
         @type QUrl
         """
+        QMetaObject.invokeMethod(
+            self, "doDownloadScript", Qt.QueuedConnection,
+            Q_ARG(QUrl, url))
+    
+    @pyqtSlot(QUrl)
+    def doDownloadScript(self, url):
         from .GreaseMonkeyDownloader import GreaseMonkeyDownloader
         downloader = GreaseMonkeyDownloader(url, self)
         downloader.finished.connect(self.__downloaderFinished)
         self.__downloaders.append(downloader)
+##void GM_Manager::downloadScript(const QUrl &url)
+##{
+##    QMetaObject::invokeMethod(this, "doDownloadScript", Qt::QueuedConnection, Q_ARG(QUrl, url));
+##}
+##void GM_Manager::doDownloadScript(const QUrl &url)
+##{
+##    new GM_Downloader(url, this);
+##}
     
     def __downloaderFinished(self):
         """

eric ide

mercurial