eric6/Documentation/Source/eric6.WebBrowser.GreaseMonkey.GreaseMonkeyScript.html

changeset 6942
2602857055c5
parent 6153
0b18c86c03a1
child 7232
0b840f7ed593
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.WebBrowser.GreaseMonkey.GreaseMonkeyScript</title>
4 <meta charset="UTF-8">
5 <style>
6 body {
7 background: #EDECE6;
8 margin: 0em 1em 10em 1em;
9 color: black;
10 }
11
12 h1 { color: white; background: #85774A; }
13 h2 { color: white; background: #85774A; }
14 h3 { color: white; background: #9D936E; }
15 h4 { color: white; background: #9D936E; }
16
17 a { color: #BA6D36; }
18
19 </style>
20 </head>
21 <body><a NAME="top" ID="top"></a>
22 <h1>eric6.WebBrowser.GreaseMonkey.GreaseMonkeyScript</h1>
23 <p>
24 Module implementing the GreaseMonkey script.
25 </p>
26 <h3>Global Attributes</h3>
27 <table>
28 <tr><td>None</td></tr>
29 </table>
30 <h3>Classes</h3>
31 <table>
32 <tr>
33 <td><a href="#GreaseMonkeyScript">GreaseMonkeyScript</a></td>
34 <td>Class implementing the GreaseMonkey script.</td>
35 </tr>
36 </table>
37 <h3>Functions</h3>
38 <table>
39 <tr><td>None</td></tr>
40 </table>
41 <hr /><hr />
42 <a NAME="GreaseMonkeyScript" ID="GreaseMonkeyScript"></a>
43 <h2>GreaseMonkeyScript</h2>
44 <p>
45 Class implementing the GreaseMonkey script.
46 </p><h3>Signals</h3>
47 <dl>
48 <dt>scriptChanged()</dt>
49 <dd>
50 emitted to indicate a script change
51 </dd><dt>updatingChanged(bool)</dt>
52 <dd>
53 emitted to indicate a change of the
54 updating state
55 </dd>
56 </dl>
57 <h3>Derived from</h3>
58 QObject
59 <h3>Class Attributes</h3>
60 <table>
61 <tr><td>DocumentEnd</td></tr><tr><td>DocumentIdle</td></tr><tr><td>DocumentStart</td></tr>
62 </table>
63 <h3>Class Methods</h3>
64 <table>
65 <tr><td>None</td></tr>
66 </table>
67 <h3>Methods</h3>
68 <table>
69 <tr>
70 <td><a href="#GreaseMonkeyScript.__init__">GreaseMonkeyScript</a></td>
71 <td>Constructor</td>
72 </tr><tr>
73 <td><a href="#GreaseMonkeyScript.__downloadIcon">__downloadIcon</a></td>
74 <td>Private slot to download the script icon.</td>
75 </tr><tr>
76 <td><a href="#GreaseMonkeyScript.__downloadRequires">__downloadRequires</a></td>
77 <td>Private method to download the required scripts.</td>
78 </tr><tr>
79 <td><a href="#GreaseMonkeyScript.__downloaderError">__downloaderError</a></td>
80 <td>Private slot to handle a downloader error.</td>
81 </tr><tr>
82 <td><a href="#GreaseMonkeyScript.__downloaderFinished">__downloaderFinished</a></td>
83 <td>Private slot to handle a finished download.</td>
84 </tr><tr>
85 <td><a href="#GreaseMonkeyScript.__iconDownloaded">__iconDownloaded</a></td>
86 <td>Private slot to handle a finished download of a script icon.</td>
87 </tr><tr>
88 <td><a href="#GreaseMonkeyScript.__parseScript">__parseScript</a></td>
89 <td>Private method to parse the given script and populate the data structure.</td>
90 </tr><tr>
91 <td><a href="#GreaseMonkeyScript.__reloadScript">__reloadScript</a></td>
92 <td>Private method to reload the script.</td>
93 </tr><tr>
94 <td><a href="#GreaseMonkeyScript.__requireDownloadError">__requireDownloadError</a></td>
95 <td>Private slot to handle a downloader error.</td>
96 </tr><tr>
97 <td><a href="#GreaseMonkeyScript.__requireDownloaded">__requireDownloaded</a></td>
98 <td>Private slot to handle a finished download of a required script.</td>
99 </tr><tr>
100 <td><a href="#GreaseMonkeyScript.__toJavaScriptList">__toJavaScriptList</a></td>
101 <td>Private method to convert a list of str to a string containing a valid JavaScript list definition.</td>
102 </tr><tr>
103 <td><a href="#GreaseMonkeyScript.__watchedFileChanged">__watchedFileChanged</a></td>
104 <td>Private slot handling changes of the script file.</td>
105 </tr><tr>
106 <td><a href="#GreaseMonkeyScript.description">description</a></td>
107 <td>Public method to get the description of the script.</td>
108 </tr><tr>
109 <td><a href="#GreaseMonkeyScript.downloadUrl">downloadUrl</a></td>
110 <td>Public method to get the download URL of the script.</td>
111 </tr><tr>
112 <td><a href="#GreaseMonkeyScript.exclude">exclude</a></td>
113 <td>Public method to get the list of excluded URLs.</td>
114 </tr><tr>
115 <td><a href="#GreaseMonkeyScript.fileName">fileName</a></td>
116 <td>Public method to get the path of the Javascript file.</td>
117 </tr><tr>
118 <td><a href="#GreaseMonkeyScript.fullName">fullName</a></td>
119 <td>Public method to get the full name of the script.</td>
120 </tr><tr>
121 <td><a href="#GreaseMonkeyScript.icon">icon</a></td>
122 <td>Public method to get the icon of the script.</td>
123 </tr><tr>
124 <td><a href="#GreaseMonkeyScript.iconUrl">iconUrl</a></td>
125 <td>Public method to get the icon URL of the script.</td>
126 </tr><tr>
127 <td><a href="#GreaseMonkeyScript.include">include</a></td>
128 <td>Public method to get the list of included URLs.</td>
129 </tr><tr>
130 <td><a href="#GreaseMonkeyScript.isEnabled">isEnabled</a></td>
131 <td>Public method to check, if the script is enabled.</td>
132 </tr><tr>
133 <td><a href="#GreaseMonkeyScript.isUpdating">isUpdating</a></td>
134 <td>Public method to get the updating flag.</td>
135 </tr><tr>
136 <td><a href="#GreaseMonkeyScript.isValid">isValid</a></td>
137 <td>Public method to check the validity of the script.</td>
138 </tr><tr>
139 <td><a href="#GreaseMonkeyScript.name">name</a></td>
140 <td>Public method to get the name of the script.</td>
141 </tr><tr>
142 <td><a href="#GreaseMonkeyScript.nameSpace">nameSpace</a></td>
143 <td>Public method to get the name space of the script.</td>
144 </tr><tr>
145 <td><a href="#GreaseMonkeyScript.noFrames">noFrames</a></td>
146 <td>Public method to get the noFrames flag.</td>
147 </tr><tr>
148 <td><a href="#GreaseMonkeyScript.require">require</a></td>
149 <td>Public method to get the list of required scripts.</td>
150 </tr><tr>
151 <td><a href="#GreaseMonkeyScript.setEnabled">setEnabled</a></td>
152 <td>Public method to enable a script.</td>
153 </tr><tr>
154 <td><a href="#GreaseMonkeyScript.startAt">startAt</a></td>
155 <td>Public method to get the start point of the script.</td>
156 </tr><tr>
157 <td><a href="#GreaseMonkeyScript.updateScript">updateScript</a></td>
158 <td>Public method to updated the script.</td>
159 </tr><tr>
160 <td><a href="#GreaseMonkeyScript.updateUrl">updateUrl</a></td>
161 <td>Public method to get the update URL of the script.</td>
162 </tr><tr>
163 <td><a href="#GreaseMonkeyScript.version">version</a></td>
164 <td>Public method to get the version of the script.</td>
165 </tr><tr>
166 <td><a href="#GreaseMonkeyScript.webScript">webScript</a></td>
167 <td>Public method to create a script object.</td>
168 </tr>
169 </table>
170 <h3>Static Methods</h3>
171 <table>
172 <tr><td>None</td></tr>
173 </table>
174 <a NAME="GreaseMonkeyScript.__init__" ID="GreaseMonkeyScript.__init__"></a>
175 <h4>GreaseMonkeyScript (Constructor)</h4>
176 <b>GreaseMonkeyScript</b>(<i>manager, path</i>)
177 <p>
178 Constructor
179 </p><dl>
180 <dt><i>manager</i></dt>
181 <dd>
182 reference to the manager object (GreaseMonkeyManager)
183 </dd><dt><i>path</i></dt>
184 <dd>
185 path of the Javascript file (string)
186 </dd>
187 </dl><a NAME="GreaseMonkeyScript.__downloadIcon" ID="GreaseMonkeyScript.__downloadIcon"></a>
188 <h4>GreaseMonkeyScript.__downloadIcon</h4>
189 <b>__downloadIcon</b>(<i></i>)
190 <p>
191 Private slot to download the script icon.
192 </p><a NAME="GreaseMonkeyScript.__downloadRequires" ID="GreaseMonkeyScript.__downloadRequires"></a>
193 <h4>GreaseMonkeyScript.__downloadRequires</h4>
194 <b>__downloadRequires</b>(<i></i>)
195 <p>
196 Private method to download the required scripts.
197 </p><a NAME="GreaseMonkeyScript.__downloaderError" ID="GreaseMonkeyScript.__downloaderError"></a>
198 <h4>GreaseMonkeyScript.__downloaderError</h4>
199 <b>__downloaderError</b>(<i>downloader</i>)
200 <p>
201 Private slot to handle a downloader error.
202 </p><dl>
203 <dt><i>downloader</i> (GreaseMonkeyDownloader)</dt>
204 <dd>
205 reference to the downloader object
206 </dd>
207 </dl><a NAME="GreaseMonkeyScript.__downloaderFinished" ID="GreaseMonkeyScript.__downloaderFinished"></a>
208 <h4>GreaseMonkeyScript.__downloaderFinished</h4>
209 <b>__downloaderFinished</b>(<i>downloader</i>)
210 <p>
211 Private slot to handle a finished download.
212 </p><dl>
213 <dt><i>downloader</i> (GreaseMonkeyDownloader)</dt>
214 <dd>
215 reference to the downloader object
216 </dd>
217 </dl><a NAME="GreaseMonkeyScript.__iconDownloaded" ID="GreaseMonkeyScript.__iconDownloaded"></a>
218 <h4>GreaseMonkeyScript.__iconDownloaded</h4>
219 <b>__iconDownloaded</b>(<i>reply</i>)
220 <p>
221 Private slot to handle a finished download of a script icon.
222 </p><dl>
223 <dt><i>reply</i> (QNetworkReply)</dt>
224 <dd>
225 reference to the network reply
226 </dd>
227 </dl><a NAME="GreaseMonkeyScript.__parseScript" ID="GreaseMonkeyScript.__parseScript"></a>
228 <h4>GreaseMonkeyScript.__parseScript</h4>
229 <b>__parseScript</b>(<i></i>)
230 <p>
231 Private method to parse the given script and populate the data
232 structure.
233 </p><a NAME="GreaseMonkeyScript.__reloadScript" ID="GreaseMonkeyScript.__reloadScript"></a>
234 <h4>GreaseMonkeyScript.__reloadScript</h4>
235 <b>__reloadScript</b>(<i></i>)
236 <p>
237 Private method to reload the script.
238 </p><a NAME="GreaseMonkeyScript.__requireDownloadError" ID="GreaseMonkeyScript.__requireDownloadError"></a>
239 <h4>GreaseMonkeyScript.__requireDownloadError</h4>
240 <b>__requireDownloadError</b>(<i>downloader</i>)
241 <p>
242 Private slot to handle a downloader error.
243 </p><dl>
244 <dt><i>downloader</i> (GreaseMonkeyDownloader)</dt>
245 <dd>
246 reference to the downloader object
247 </dd>
248 </dl><a NAME="GreaseMonkeyScript.__requireDownloaded" ID="GreaseMonkeyScript.__requireDownloaded"></a>
249 <h4>GreaseMonkeyScript.__requireDownloaded</h4>
250 <b>__requireDownloaded</b>(<i>downloader</i>)
251 <p>
252 Private slot to handle a finished download of a required script.
253 </p><dl>
254 <dt><i>downloader</i> (GreaseMonkeyDownloader)</dt>
255 <dd>
256 reference to the downloader object
257 </dd>
258 </dl><a NAME="GreaseMonkeyScript.__toJavaScriptList" ID="GreaseMonkeyScript.__toJavaScriptList"></a>
259 <h4>GreaseMonkeyScript.__toJavaScriptList</h4>
260 <b>__toJavaScriptList</b>(<i>patterns</i>)
261 <p>
262 Private method to convert a list of str to a string containing a valid
263 JavaScript list definition.
264 </p><dl>
265 <dt><i>patterns</i> (list of str)</dt>
266 <dd>
267 list of match patterns
268 </dd>
269 </dl><dl>
270 <dt>Returns:</dt>
271 <dd>
272 JavaScript script containing the list
273 </dd>
274 </dl><dl>
275 <dt>Return Type:</dt>
276 <dd>
277 str
278 </dd>
279 </dl><a NAME="GreaseMonkeyScript.__watchedFileChanged" ID="GreaseMonkeyScript.__watchedFileChanged"></a>
280 <h4>GreaseMonkeyScript.__watchedFileChanged</h4>
281 <b>__watchedFileChanged</b>(<i>fileName</i>)
282 <p>
283 Private slot handling changes of the script file.
284 </p><dl>
285 <dt><i>fileName</i> (str)</dt>
286 <dd>
287 path of the script file
288 </dd>
289 </dl><a NAME="GreaseMonkeyScript.description" ID="GreaseMonkeyScript.description"></a>
290 <h4>GreaseMonkeyScript.description</h4>
291 <b>description</b>(<i></i>)
292 <p>
293 Public method to get the description of the script.
294 </p><dl>
295 <dt>Returns:</dt>
296 <dd>
297 description of the script (string)
298 </dd>
299 </dl><a NAME="GreaseMonkeyScript.downloadUrl" ID="GreaseMonkeyScript.downloadUrl"></a>
300 <h4>GreaseMonkeyScript.downloadUrl</h4>
301 <b>downloadUrl</b>(<i></i>)
302 <p>
303 Public method to get the download URL of the script.
304 </p><dl>
305 <dt>Returns:</dt>
306 <dd>
307 download URL of the script (QUrl)
308 </dd>
309 </dl><a NAME="GreaseMonkeyScript.exclude" ID="GreaseMonkeyScript.exclude"></a>
310 <h4>GreaseMonkeyScript.exclude</h4>
311 <b>exclude</b>(<i></i>)
312 <p>
313 Public method to get the list of excluded URLs.
314 </p><dl>
315 <dt>Returns:</dt>
316 <dd>
317 list of excluded URLs (list of strings)
318 </dd>
319 </dl><a NAME="GreaseMonkeyScript.fileName" ID="GreaseMonkeyScript.fileName"></a>
320 <h4>GreaseMonkeyScript.fileName</h4>
321 <b>fileName</b>(<i></i>)
322 <p>
323 Public method to get the path of the Javascript file.
324 </p><dl>
325 <dt>Returns:</dt>
326 <dd>
327 path of the Javascript file (string)
328 </dd>
329 </dl><a NAME="GreaseMonkeyScript.fullName" ID="GreaseMonkeyScript.fullName"></a>
330 <h4>GreaseMonkeyScript.fullName</h4>
331 <b>fullName</b>(<i></i>)
332 <p>
333 Public method to get the full name of the script.
334 </p><dl>
335 <dt>Returns:</dt>
336 <dd>
337 full name of the script (string)
338 </dd>
339 </dl><a NAME="GreaseMonkeyScript.icon" ID="GreaseMonkeyScript.icon"></a>
340 <h4>GreaseMonkeyScript.icon</h4>
341 <b>icon</b>(<i></i>)
342 <p>
343 Public method to get the icon of the script.
344 </p><dl>
345 <dt>Returns:</dt>
346 <dd>
347 script icon
348 </dd>
349 </dl><dl>
350 <dt>Return Type:</dt>
351 <dd>
352 QIcon
353 </dd>
354 </dl><a NAME="GreaseMonkeyScript.iconUrl" ID="GreaseMonkeyScript.iconUrl"></a>
355 <h4>GreaseMonkeyScript.iconUrl</h4>
356 <b>iconUrl</b>(<i></i>)
357 <p>
358 Public method to get the icon URL of the script.
359 </p><dl>
360 <dt>Returns:</dt>
361 <dd>
362 icon URL of the script (QUrl)
363 </dd>
364 </dl><a NAME="GreaseMonkeyScript.include" ID="GreaseMonkeyScript.include"></a>
365 <h4>GreaseMonkeyScript.include</h4>
366 <b>include</b>(<i></i>)
367 <p>
368 Public method to get the list of included URLs.
369 </p><dl>
370 <dt>Returns:</dt>
371 <dd>
372 list of included URLs (list of strings)
373 </dd>
374 </dl><a NAME="GreaseMonkeyScript.isEnabled" ID="GreaseMonkeyScript.isEnabled"></a>
375 <h4>GreaseMonkeyScript.isEnabled</h4>
376 <b>isEnabled</b>(<i></i>)
377 <p>
378 Public method to check, if the script is enabled.
379 </p><dl>
380 <dt>Returns:</dt>
381 <dd>
382 flag indicating an enabled state (boolean)
383 </dd>
384 </dl><a NAME="GreaseMonkeyScript.isUpdating" ID="GreaseMonkeyScript.isUpdating"></a>
385 <h4>GreaseMonkeyScript.isUpdating</h4>
386 <b>isUpdating</b>(<i></i>)
387 <p>
388 Public method to get the updating flag.
389 </p><dl>
390 <dt>Returns:</dt>
391 <dd>
392 updating flag
393 </dd>
394 </dl><dl>
395 <dt>Return Type:</dt>
396 <dd>
397 bool
398 </dd>
399 </dl><a NAME="GreaseMonkeyScript.isValid" ID="GreaseMonkeyScript.isValid"></a>
400 <h4>GreaseMonkeyScript.isValid</h4>
401 <b>isValid</b>(<i></i>)
402 <p>
403 Public method to check the validity of the script.
404 </p><dl>
405 <dt>Returns:</dt>
406 <dd>
407 flag indicating a valid script (boolean)
408 </dd>
409 </dl><a NAME="GreaseMonkeyScript.name" ID="GreaseMonkeyScript.name"></a>
410 <h4>GreaseMonkeyScript.name</h4>
411 <b>name</b>(<i></i>)
412 <p>
413 Public method to get the name of the script.
414 </p><dl>
415 <dt>Returns:</dt>
416 <dd>
417 name of the script (string)
418 </dd>
419 </dl><a NAME="GreaseMonkeyScript.nameSpace" ID="GreaseMonkeyScript.nameSpace"></a>
420 <h4>GreaseMonkeyScript.nameSpace</h4>
421 <b>nameSpace</b>(<i></i>)
422 <p>
423 Public method to get the name space of the script.
424 </p><dl>
425 <dt>Returns:</dt>
426 <dd>
427 name space of the script (string)
428 </dd>
429 </dl><a NAME="GreaseMonkeyScript.noFrames" ID="GreaseMonkeyScript.noFrames"></a>
430 <h4>GreaseMonkeyScript.noFrames</h4>
431 <b>noFrames</b>(<i></i>)
432 <p>
433 Public method to get the noFrames flag.
434 </p><dl>
435 <dt>Returns:</dt>
436 <dd>
437 flag indicating to not run on sub frames
438 </dd>
439 </dl><dl>
440 <dt>Return Type:</dt>
441 <dd>
442 bool
443 </dd>
444 </dl><a NAME="GreaseMonkeyScript.require" ID="GreaseMonkeyScript.require"></a>
445 <h4>GreaseMonkeyScript.require</h4>
446 <b>require</b>(<i></i>)
447 <p>
448 Public method to get the list of required scripts.
449 </p><dl>
450 <dt>Returns:</dt>
451 <dd>
452 list of required scripts (list of strings)
453 </dd>
454 </dl><a NAME="GreaseMonkeyScript.setEnabled" ID="GreaseMonkeyScript.setEnabled"></a>
455 <h4>GreaseMonkeyScript.setEnabled</h4>
456 <b>setEnabled</b>(<i>enable</i>)
457 <p>
458 Public method to enable a script.
459 </p><dl>
460 <dt><i>enable</i></dt>
461 <dd>
462 flag indicating the new enabled state (boolean)
463 </dd>
464 </dl><a NAME="GreaseMonkeyScript.startAt" ID="GreaseMonkeyScript.startAt"></a>
465 <h4>GreaseMonkeyScript.startAt</h4>
466 <b>startAt</b>(<i></i>)
467 <p>
468 Public method to get the start point of the script.
469 </p><dl>
470 <dt>Returns:</dt>
471 <dd>
472 start point of the script (DocumentStart or DocumentEnd)
473 </dd>
474 </dl><a NAME="GreaseMonkeyScript.updateScript" ID="GreaseMonkeyScript.updateScript"></a>
475 <h4>GreaseMonkeyScript.updateScript</h4>
476 <b>updateScript</b>(<i></i>)
477 <p>
478 Public method to updated the script.
479 </p><a NAME="GreaseMonkeyScript.updateUrl" ID="GreaseMonkeyScript.updateUrl"></a>
480 <h4>GreaseMonkeyScript.updateUrl</h4>
481 <b>updateUrl</b>(<i></i>)
482 <p>
483 Public method to get the update URL of the script.
484 </p><dl>
485 <dt>Returns:</dt>
486 <dd>
487 update URL of the script (QUrl)
488 </dd>
489 </dl><a NAME="GreaseMonkeyScript.version" ID="GreaseMonkeyScript.version"></a>
490 <h4>GreaseMonkeyScript.version</h4>
491 <b>version</b>(<i></i>)
492 <p>
493 Public method to get the version of the script.
494 </p><dl>
495 <dt>Returns:</dt>
496 <dd>
497 version of the script (string)
498 </dd>
499 </dl><a NAME="GreaseMonkeyScript.webScript" ID="GreaseMonkeyScript.webScript"></a>
500 <h4>GreaseMonkeyScript.webScript</h4>
501 <b>webScript</b>(<i></i>)
502 <p>
503 Public method to create a script object.
504 </p><dl>
505 <dt>Returns:</dt>
506 <dd>
507 prepared script object
508 </dd>
509 </dl><dl>
510 <dt>Return Type:</dt>
511 <dd>
512 QWebEngineScript
513 </dd>
514 </dl><dl>
515 <dt>Raises <b>ValueError</b>:</dt>
516 <dd>
517 raised to indicate an unsupported start point
518 </dd>
519 </dl>
520 <div align="right"><a href="#top">Up</a></div>
521 <hr />
522 </body></html>

eric ide

mercurial