Wed, 26 Apr 2017 19:06:23 +0200
Improved installion of GreaseMonkey user scripts.
--- a/APIs/Python3/eric6.api Tue Apr 25 19:20:18 2017 +0200 +++ b/APIs/Python3/eric6.api Wed Apr 26 19:06:23 2017 +0200 @@ -10124,8 +10124,6 @@ eric6.WebBrowser.GreaseMonkey.GreaseMonkeyScript.GreaseMonkeyScript.version?4() eric6.WebBrowser.GreaseMonkey.GreaseMonkeyScript.GreaseMonkeyScript.webScript?4() eric6.WebBrowser.GreaseMonkey.GreaseMonkeyScript.GreaseMonkeyScript?1(manager, path) -eric6.WebBrowser.GreaseMonkey.GreaseMonkeyUrlInterceptor.GreaseMonkeyUrlInterceptor.interceptRequest?4(info) -eric6.WebBrowser.GreaseMonkey.GreaseMonkeyUrlInterceptor.GreaseMonkeyUrlInterceptor?1(manager) eric6.WebBrowser.History.HistoryCompleter.HistoryCompleter.pathFromIndex?4(idx) eric6.WebBrowser.History.HistoryCompleter.HistoryCompleter.splitPath?4(path) eric6.WebBrowser.History.HistoryCompleter.HistoryCompleter?1(model, parent=None)
--- a/APIs/Python3/eric6.bas Tue Apr 25 19:20:18 2017 +0200 +++ b/APIs/Python3/eric6.bas Wed Apr 26 19:06:23 2017 +0200 @@ -306,7 +306,6 @@ GreaseMonkeyDownloader QObject GreaseMonkeyManager QObject GreaseMonkeyScript QObject -GreaseMonkeyUrlInterceptor UrlInterceptor HelpAppearancePage ConfigurationPageBase Ui_HelpAppearancePage HelpBrowser QWebView HelpClearPrivateDataDialog QDialog Ui_HelpClearPrivateDataDialog
--- a/Documentation/Help/source.qhp Tue Apr 25 19:20:18 2017 +0200 +++ b/Documentation/Help/source.qhp Wed Apr 26 19:06:23 2017 +0200 @@ -1155,7 +1155,6 @@ <section title="eric6.WebBrowser.GreaseMonkey.GreaseMonkeyJavaScript" ref="eric6.WebBrowser.GreaseMonkey.GreaseMonkeyJavaScript.html" /> <section title="eric6.WebBrowser.GreaseMonkey.GreaseMonkeyManager" ref="eric6.WebBrowser.GreaseMonkey.GreaseMonkeyManager.html" /> <section title="eric6.WebBrowser.GreaseMonkey.GreaseMonkeyScript" ref="eric6.WebBrowser.GreaseMonkey.GreaseMonkeyScript.html" /> - <section title="eric6.WebBrowser.GreaseMonkey.GreaseMonkeyUrlInterceptor" ref="eric6.WebBrowser.GreaseMonkey.GreaseMonkeyUrlInterceptor.html" /> </section> <section title="eric6.WebBrowser.History" ref="index-eric6.WebBrowser.History.html"> <section title="eric6.WebBrowser.History.HistoryCompleter" ref="eric6.WebBrowser.History.HistoryCompleter.html" /> @@ -6247,7 +6246,6 @@ <keyword name="GreaseMonkeyManager (Constructor)" id="GreaseMonkeyManager (Constructor)" ref="eric6.WebBrowser.GreaseMonkey.GreaseMonkeyManager.html#GreaseMonkeyManager.__init__" /> <keyword name="GreaseMonkeyManager (Module)" id="GreaseMonkeyManager (Module)" ref="eric6.Helpviewer.GreaseMonkey.GreaseMonkeyManager.html" /> <keyword name="GreaseMonkeyManager (Module)" id="GreaseMonkeyManager (Module)" ref="eric6.WebBrowser.GreaseMonkey.GreaseMonkeyManager.html" /> - <keyword name="GreaseMonkeyManager.__del__" id="GreaseMonkeyManager.__del__" ref="eric6.WebBrowser.GreaseMonkey.GreaseMonkeyManager.html#GreaseMonkeyManager.__del__" /> <keyword name="GreaseMonkeyManager.__downloaderFinished" id="GreaseMonkeyManager.__downloaderFinished" ref="eric6.Helpviewer.GreaseMonkey.GreaseMonkeyManager.html#GreaseMonkeyManager.__downloaderFinished" /> <keyword name="GreaseMonkeyManager.__downloaderFinished" id="GreaseMonkeyManager.__downloaderFinished" ref="eric6.WebBrowser.GreaseMonkey.GreaseMonkeyManager.html#GreaseMonkeyManager.__downloaderFinished" /> <keyword name="GreaseMonkeyManager.__load" id="GreaseMonkeyManager.__load" ref="eric6.Helpviewer.GreaseMonkey.GreaseMonkeyManager.html#GreaseMonkeyManager.__load" /> @@ -6333,10 +6331,6 @@ <keyword name="GreaseMonkeyScript.version" id="GreaseMonkeyScript.version" ref="eric6.Helpviewer.GreaseMonkey.GreaseMonkeyScript.html#GreaseMonkeyScript.version" /> <keyword name="GreaseMonkeyScript.version" id="GreaseMonkeyScript.version" ref="eric6.WebBrowser.GreaseMonkey.GreaseMonkeyScript.html#GreaseMonkeyScript.version" /> <keyword name="GreaseMonkeyScript.webScript" id="GreaseMonkeyScript.webScript" ref="eric6.WebBrowser.GreaseMonkey.GreaseMonkeyScript.html#GreaseMonkeyScript.webScript" /> - <keyword name="GreaseMonkeyUrlInterceptor" id="GreaseMonkeyUrlInterceptor" ref="eric6.WebBrowser.GreaseMonkey.GreaseMonkeyUrlInterceptor.html#GreaseMonkeyUrlInterceptor" /> - <keyword name="GreaseMonkeyUrlInterceptor (Constructor)" id="GreaseMonkeyUrlInterceptor (Constructor)" ref="eric6.WebBrowser.GreaseMonkey.GreaseMonkeyUrlInterceptor.html#GreaseMonkeyUrlInterceptor.__init__" /> - <keyword name="GreaseMonkeyUrlInterceptor (Module)" id="GreaseMonkeyUrlInterceptor (Module)" ref="eric6.WebBrowser.GreaseMonkey.GreaseMonkeyUrlInterceptor.html" /> - <keyword name="GreaseMonkeyUrlInterceptor.interceptRequest" id="GreaseMonkeyUrlInterceptor.interceptRequest" ref="eric6.WebBrowser.GreaseMonkey.GreaseMonkeyUrlInterceptor.html#GreaseMonkeyUrlInterceptor.interceptRequest" /> <keyword name="GreaseMonkeyUrlMatcher" id="GreaseMonkeyUrlMatcher" ref="eric6.Helpviewer.GreaseMonkey.GreaseMonkeyUrlMatcher.html#GreaseMonkeyUrlMatcher" /> <keyword name="GreaseMonkeyUrlMatcher (Constructor)" id="GreaseMonkeyUrlMatcher (Constructor)" ref="eric6.Helpviewer.GreaseMonkey.GreaseMonkeyUrlMatcher.html#GreaseMonkeyUrlMatcher.__init__" /> <keyword name="GreaseMonkeyUrlMatcher (Module)" id="GreaseMonkeyUrlMatcher (Module)" ref="eric6.Helpviewer.GreaseMonkey.GreaseMonkeyUrlMatcher.html" /> @@ -18047,7 +18041,6 @@ <file>eric6.WebBrowser.GreaseMonkey.GreaseMonkeyJavaScript.html</file> <file>eric6.WebBrowser.GreaseMonkey.GreaseMonkeyManager.html</file> <file>eric6.WebBrowser.GreaseMonkey.GreaseMonkeyScript.html</file> - <file>eric6.WebBrowser.GreaseMonkey.GreaseMonkeyUrlInterceptor.html</file> <file>eric6.WebBrowser.History.HistoryCompleter.html</file> <file>eric6.WebBrowser.History.HistoryDialog.html</file> <file>eric6.WebBrowser.History.HistoryFilterModel.html</file>
--- a/Documentation/Source/eric6.WebBrowser.GreaseMonkey.GreaseMonkeyManager.html Tue Apr 25 19:20:18 2017 +0200 +++ b/Documentation/Source/eric6.WebBrowser.GreaseMonkey.GreaseMonkeyManager.html Wed Apr 26 19:06:23 2017 +0200 @@ -60,9 +60,6 @@ <td><a href="#GreaseMonkeyManager.__init__">GreaseMonkeyManager</a></td> <td>Constructor</td> </tr><tr> -<td><a href="#GreaseMonkeyManager.__del__">__del__</a></td> -<td>Special method called during object destruction.</td> -</tr><tr> <td><a href="#GreaseMonkeyManager.__downloaderFinished">__downloaderFinished</a></td> <td>Private slot to handle the completion of a script download.</td> </tr><tr> @@ -129,12 +126,7 @@ <dd> reference to the parent object (QObject) </dd> -</dl><a NAME="GreaseMonkeyManager.__del__" ID="GreaseMonkeyManager.__del__"></a> -<h4>GreaseMonkeyManager.__del__</h4> -<b>__del__</b>(<i></i>) -<p> - Special method called during object destruction. -</p><a NAME="GreaseMonkeyManager.__downloaderFinished" ID="GreaseMonkeyManager.__downloaderFinished"></a> +</dl><a NAME="GreaseMonkeyManager.__downloaderFinished" ID="GreaseMonkeyManager.__downloaderFinished"></a> <h4>GreaseMonkeyManager.__downloaderFinished</h4> <b>__downloaderFinished</b>(<i>fileName</i>) <p>
--- a/Documentation/Source/eric6.WebBrowser.GreaseMonkey.GreaseMonkeyUrlInterceptor.html Tue Apr 25 19:20:18 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -<!DOCTYPE html> -<html><head> -<title>eric6.WebBrowser.GreaseMonkey.GreaseMonkeyUrlInterceptor</title> -<meta charset="UTF-8"> -<style> -body { - background: #EDECE6; - margin: 0em 1em 10em 1em; - color: black; -} - -h1 { color: white; background: #85774A; } -h2 { color: white; background: #85774A; } -h3 { color: white; background: #9D936E; } -h4 { color: white; background: #9D936E; } - -a { color: #BA6D36; } - -</style> -</head> -<body><a NAME="top" ID="top"></a> -<h1>eric6.WebBrowser.GreaseMonkey.GreaseMonkeyUrlInterceptor</h1> -<p> -Module implementing a handler for GreaseMonkey related URLs. -</p> -<h3>Global Attributes</h3> -<table> -<tr><td>None</td></tr> -</table> -<h3>Classes</h3> -<table> -<tr> -<td><a href="#GreaseMonkeyUrlInterceptor">GreaseMonkeyUrlInterceptor</a></td> -<td>Class implementing a handler for GreaseMonkey related URLs.</td> -</tr> -</table> -<h3>Functions</h3> -<table> -<tr><td>None</td></tr> -</table> -<hr /><hr /> -<a NAME="GreaseMonkeyUrlInterceptor" ID="GreaseMonkeyUrlInterceptor"></a> -<h2>GreaseMonkeyUrlInterceptor</h2> -<p> - Class implementing a handler for GreaseMonkey related URLs. -</p> -<h3>Derived from</h3> -UrlInterceptor -<h3>Class Attributes</h3> -<table> -<tr><td>None</td></tr> -</table> -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> -<h3>Methods</h3> -<table> -<tr> -<td><a href="#GreaseMonkeyUrlInterceptor.__init__">GreaseMonkeyUrlInterceptor</a></td> -<td>Constructor</td> -</tr><tr> -<td><a href="#GreaseMonkeyUrlInterceptor.interceptRequest">interceptRequest</a></td> -<td>Public method to handle a GreaseMonkey request.</td> -</tr> -</table> -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> -<a NAME="GreaseMonkeyUrlInterceptor.__init__" ID="GreaseMonkeyUrlInterceptor.__init__"></a> -<h4>GreaseMonkeyUrlInterceptor (Constructor)</h4> -<b>GreaseMonkeyUrlInterceptor</b>(<i>manager</i>) -<p> - Constructor -</p><dl> -<dt><i>manager</i> (GreaseMonkeyManager)</dt> -<dd> -reference to the GreaseMonkey manager -</dd> -</dl><a NAME="GreaseMonkeyUrlInterceptor.interceptRequest" ID="GreaseMonkeyUrlInterceptor.interceptRequest"></a> -<h4>GreaseMonkeyUrlInterceptor.interceptRequest</h4> -<b>interceptRequest</b>(<i>info</i>) -<p> - Public method to handle a GreaseMonkey request. -</p><dl> -<dt><i>info</i> (QWebEngineUrlRequestInfo)</dt> -<dd> -request info object -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -</body></html> \ No newline at end of file
--- a/Documentation/Source/index-eric6.WebBrowser.GreaseMonkey.html Tue Apr 25 19:20:18 2017 +0200 +++ b/Documentation/Source/index-eric6.WebBrowser.GreaseMonkey.html Wed Apr 26 19:06:23 2017 +0200 @@ -49,9 +49,6 @@ </tr><tr> <td><a href="eric6.WebBrowser.GreaseMonkey.GreaseMonkeyScript.html">GreaseMonkeyScript</a></td> <td>Module implementing the GreaseMonkey script.</td> -</tr><tr> -<td><a href="eric6.WebBrowser.GreaseMonkey.GreaseMonkeyUrlInterceptor.html">GreaseMonkeyUrlInterceptor</a></td> -<td>Module implementing a handler for GreaseMonkey related URLs.</td> </tr> </table> </body></html> \ No newline at end of file
--- a/WebBrowser/GreaseMonkey/GreaseMonkeyManager.py Tue Apr 25 19:20:18 2017 +0200 +++ b/WebBrowser/GreaseMonkey/GreaseMonkeyManager.py Wed Apr 26 19:06:23 2017 +0200 @@ -21,7 +21,6 @@ import Preferences from WebBrowser.WebBrowserWindow import WebBrowserWindow -from .GreaseMonkeyUrlInterceptor import GreaseMonkeyUrlInterceptor class GreaseMonkeyManager(QObject): @@ -42,19 +41,8 @@ self.__scripts = [] self.__downloaders = [] - self.__interceptor = GreaseMonkeyUrlInterceptor(self) - WebBrowserWindow.networkManager().installUrlInterceptor( - GreaseMonkeyUrlInterceptor(self)) - QTimer.singleShot(0, self.__load) - def __del__(self): - """ - Special method called during object destruction. - """ - WebBrowserWindow.networkManager().removeUrlInterceptor( - self.__interceptor) - def showConfigurationDialog(self, parent=None): """ Public method to show the configuration dialog.
--- a/WebBrowser/GreaseMonkey/GreaseMonkeyUrlInterceptor.py Tue Apr 25 19:20:18 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright (c) 2016 - 2017 Detlev Offenbach <detlev@die-offenbachs.de> -# - -""" -Module implementing a handler for GreaseMonkey related URLs. -""" - -from __future__ import unicode_literals - -from PyQt5.QtWebEngineCore import QWebEngineUrlRequestInfo - -from ..Network.UrlInterceptor import UrlInterceptor - - -class GreaseMonkeyUrlInterceptor(UrlInterceptor): - """ - Class implementing a handler for GreaseMonkey related URLs. - """ - def __init__(self, manager): - """ - Constructor - - @param manager reference to the GreaseMonkey manager - @type GreaseMonkeyManager - """ - super(GreaseMonkeyUrlInterceptor, self).__init__(manager) - - self.__manager = manager - - def interceptRequest(self, info): - """ - Public method to handle a GreaseMonkey request. - - @param info request info object - @type QWebEngineUrlRequestInfo - """ - if info.navigationType() != \ - QWebEngineUrlRequestInfo.NavigationTypeLink: - return - - if info.requestUrl().toString().endswith(".user.js"): - self.__manager.downloadScript(info.requestUrl()) - info.block(True)
--- a/WebBrowser/WebBrowserPage.py Tue Apr 25 19:20:18 2017 +0200 +++ b/WebBrowser/WebBrowserPage.py Wed Apr 26 19:06:23 2017 +0200 @@ -89,6 +89,12 @@ if WebBrowserWindow.adBlockManager().addSubscriptionFromUrl(url): return False + # GreaseMonkey + if type_ == QWebEnginePage.NavigationTypeLinkClicked and \ + url.toString().endswith(".user.js"): + WebBrowserWindow.greaseMonkeyManager().downloadScript(url) + return False + return QWebEnginePage.acceptNavigationRequest(self, url, type_, isMainFrame)
--- a/eric6.e4p Tue Apr 25 19:20:18 2017 +0200 +++ b/eric6.e4p Wed Apr 26 19:06:23 2017 +0200 @@ -1343,7 +1343,6 @@ <Source>WebBrowser/GreaseMonkey/GreaseMonkeyJavaScript.py</Source> <Source>WebBrowser/GreaseMonkey/GreaseMonkeyManager.py</Source> <Source>WebBrowser/GreaseMonkey/GreaseMonkeyScript.py</Source> - <Source>WebBrowser/GreaseMonkey/GreaseMonkeyUrlInterceptor.py</Source> <Source>WebBrowser/GreaseMonkey/__init__.py</Source> <Source>WebBrowser/History/HistoryCompleter.py</Source> <Source>WebBrowser/History/HistoryDialog.py</Source>