Documentation/Source/eric6.WebBrowser.AdBlock.AdBlockSubscription.html

changeset 4918
71caf42a13d8
child 6028
859f6894eed9
equal deleted inserted replaced
4917:682750cc7bd5 4918:71caf42a13d8
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.WebBrowser.AdBlock.AdBlockSubscription</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.AdBlock.AdBlockSubscription</h1>
23 <p>
24 Module implementing the AdBlock subscription class.
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="#AdBlockSubscription">AdBlockSubscription</a></td>
34 <td>Class implementing the AdBlock subscription.</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="AdBlockSubscription" ID="AdBlockSubscription"></a>
43 <h2>AdBlockSubscription</h2>
44 <p>
45 Class implementing the AdBlock subscription.
46 </p><h3>Signals</h3>
47 <dl>
48 <dt>changed()</dt>
49 <dd>
50 emitted after the subscription has changed
51 </dd><dt>enabledChanged(bool)</dt>
52 <dd>
53 emitted after the enabled state was changed
54 </dd><dt>rulesChanged()</dt>
55 <dd>
56 emitted after the subscription's rules have changed
57 </dd>
58 </dl>
59 <h3>Derived from</h3>
60 QObject
61 <h3>Class Attributes</h3>
62 <table>
63 <tr><td>None</td></tr>
64 </table>
65 <h3>Class Methods</h3>
66 <table>
67 <tr><td>None</td></tr>
68 </table>
69 <h3>Methods</h3>
70 <table>
71 <tr>
72 <td><a href="#AdBlockSubscription.__init__">AdBlockSubscription</a></td>
73 <td>Constructor</td>
74 </tr><tr>
75 <td><a href="#AdBlockSubscription.__loadRules">__loadRules</a></td>
76 <td>Private method to load the rules of the subscription.</td>
77 </tr><tr>
78 <td><a href="#AdBlockSubscription.__parseUrl">__parseUrl</a></td>
79 <td>Private method to parse the AdBlock URL for the subscription.</td>
80 </tr><tr>
81 <td><a href="#AdBlockSubscription.__populateCache">__populateCache</a></td>
82 <td>Private method to populate the various rule caches.</td>
83 </tr><tr>
84 <td><a href="#AdBlockSubscription.__rulesDownloaded">__rulesDownloaded</a></td>
85 <td>Private slot to deal with the downloaded rules.</td>
86 </tr><tr>
87 <td><a href="#AdBlockSubscription.__validateCheckSum">__validateCheckSum</a></td>
88 <td>Private method to check the subscription file's checksum.</td>
89 </tr><tr>
90 <td><a href="#AdBlockSubscription.adBlockDisabledForUrl">adBlockDisabledForUrl</a></td>
91 <td>Public method to check, if AdBlock is disabled for the given URL.</td>
92 </tr><tr>
93 <td><a href="#AdBlockSubscription.addRule">addRule</a></td>
94 <td>Public method to add a rule.</td>
95 </tr><tr>
96 <td><a href="#AdBlockSubscription.allRules">allRules</a></td>
97 <td>Public method to get the list of rules.</td>
98 </tr><tr>
99 <td><a href="#AdBlockSubscription.canBeRemoved">canBeRemoved</a></td>
100 <td>Public method to check, if the subscription can be removed.</td>
101 </tr><tr>
102 <td><a href="#AdBlockSubscription.canEditRules">canEditRules</a></td>
103 <td>Public method to check, if rules can be edited.</td>
104 </tr><tr>
105 <td><a href="#AdBlockSubscription.checkForUpdate">checkForUpdate</a></td>
106 <td>Public method to check for an update.</td>
107 </tr><tr>
108 <td><a href="#AdBlockSubscription.elemHideDisabledForUrl">elemHideDisabledForUrl</a></td>
109 <td>Public method to check, if element hiding is disabled for the given URL.</td>
110 </tr><tr>
111 <td><a href="#AdBlockSubscription.elementHidingRules">elementHidingRules</a></td>
112 <td>Public method to get the element hiding rules.</td>
113 </tr><tr>
114 <td><a href="#AdBlockSubscription.elementHidingRulesForDomain">elementHidingRulesForDomain</a></td>
115 <td>Public method to get the element hiding rules for the given domain.</td>
116 </tr><tr>
117 <td><a href="#AdBlockSubscription.isEnabled">isEnabled</a></td>
118 <td>Public method to check, if the subscription is enabled.</td>
119 </tr><tr>
120 <td><a href="#AdBlockSubscription.lastUpdate">lastUpdate</a></td>
121 <td>Public method to get the date and time of the last update.</td>
122 </tr><tr>
123 <td><a href="#AdBlockSubscription.location">location</a></td>
124 <td>Public method to get the subscription location.</td>
125 </tr><tr>
126 <td><a href="#AdBlockSubscription.match">match</a></td>
127 <td>Public method to check the subscription for a matching rule.</td>
128 </tr><tr>
129 <td><a href="#AdBlockSubscription.removeRule">removeRule</a></td>
130 <td>Public method to remove a rule given the offset.</td>
131 </tr><tr>
132 <td><a href="#AdBlockSubscription.replaceRule">replaceRule</a></td>
133 <td>Public method to replace a rule given the offset.</td>
134 </tr><tr>
135 <td><a href="#AdBlockSubscription.requiresLocation">requiresLocation</a></td>
136 <td>Public method to get the location of a required subscription.</td>
137 </tr><tr>
138 <td><a href="#AdBlockSubscription.rule">rule</a></td>
139 <td>Public method to get a specific rule.</td>
140 </tr><tr>
141 <td><a href="#AdBlockSubscription.rulesFileName">rulesFileName</a></td>
142 <td>Public method to get the name of the rules file.</td>
143 </tr><tr>
144 <td><a href="#AdBlockSubscription.saveRules">saveRules</a></td>
145 <td>Public method to save the subscription rules.</td>
146 </tr><tr>
147 <td><a href="#AdBlockSubscription.setEnabled">setEnabled</a></td>
148 <td>Public method to set the enabled status.</td>
149 </tr><tr>
150 <td><a href="#AdBlockSubscription.setLocation">setLocation</a></td>
151 <td>Public method to set the subscription location.</td>
152 </tr><tr>
153 <td><a href="#AdBlockSubscription.setRuleEnabled">setRuleEnabled</a></td>
154 <td>Public method to enable a specific rule.</td>
155 </tr><tr>
156 <td><a href="#AdBlockSubscription.setTitle">setTitle</a></td>
157 <td>Public method to set the subscription title.</td>
158 </tr><tr>
159 <td><a href="#AdBlockSubscription.title">title</a></td>
160 <td>Public method to get the subscription title.</td>
161 </tr><tr>
162 <td><a href="#AdBlockSubscription.updateNow">updateNow</a></td>
163 <td>Public method to update the subscription immediately.</td>
164 </tr><tr>
165 <td><a href="#AdBlockSubscription.url">url</a></td>
166 <td>Public method to generate the URL for this subscription.</td>
167 </tr>
168 </table>
169 <h3>Static Methods</h3>
170 <table>
171 <tr><td>None</td></tr>
172 </table>
173 <a NAME="AdBlockSubscription.__init__" ID="AdBlockSubscription.__init__"></a>
174 <h4>AdBlockSubscription (Constructor)</h4>
175 <b>AdBlockSubscription</b>(<i>url, custom, parent=None, default=False</i>)
176 <p>
177 Constructor
178 </p><dl>
179 <dt><i>url</i></dt>
180 <dd>
181 AdBlock URL for the subscription (QUrl)
182 </dd><dt><i>custom</i></dt>
183 <dd>
184 flag indicating a custom subscription (boolean)
185 </dd><dt><i>parent</i></dt>
186 <dd>
187 reference to the parent object (QObject)
188 </dd><dt><i>default</i></dt>
189 <dd>
190 flag indicating a default subscription (boolean)
191 </dd>
192 </dl><a NAME="AdBlockSubscription.__loadRules" ID="AdBlockSubscription.__loadRules"></a>
193 <h4>AdBlockSubscription.__loadRules</h4>
194 <b>__loadRules</b>(<i></i>)
195 <p>
196 Private method to load the rules of the subscription.
197 </p><a NAME="AdBlockSubscription.__parseUrl" ID="AdBlockSubscription.__parseUrl"></a>
198 <h4>AdBlockSubscription.__parseUrl</h4>
199 <b>__parseUrl</b>(<i>url</i>)
200 <p>
201 Private method to parse the AdBlock URL for the subscription.
202 </p><dl>
203 <dt><i>url</i></dt>
204 <dd>
205 AdBlock URL for the subscription (QUrl)
206 </dd>
207 </dl><a NAME="AdBlockSubscription.__populateCache" ID="AdBlockSubscription.__populateCache"></a>
208 <h4>AdBlockSubscription.__populateCache</h4>
209 <b>__populateCache</b>(<i></i>)
210 <p>
211 Private method to populate the various rule caches.
212 </p><a NAME="AdBlockSubscription.__rulesDownloaded" ID="AdBlockSubscription.__rulesDownloaded"></a>
213 <h4>AdBlockSubscription.__rulesDownloaded</h4>
214 <b>__rulesDownloaded</b>(<i></i>)
215 <p>
216 Private slot to deal with the downloaded rules.
217 </p><a NAME="AdBlockSubscription.__validateCheckSum" ID="AdBlockSubscription.__validateCheckSum"></a>
218 <h4>AdBlockSubscription.__validateCheckSum</h4>
219 <b>__validateCheckSum</b>(<i>fileName</i>)
220 <p>
221 Private method to check the subscription file's checksum.
222 </p><dl>
223 <dt><i>fileName</i></dt>
224 <dd>
225 name of the file containing the subscription (string)
226 </dd>
227 </dl><dl>
228 <dt>Returns:</dt>
229 <dd>
230 flag indicating a valid file (boolean). A file is considered
231 valid, if the checksum is OK, the file does not contain a
232 checksum (i.e. cannot be checked) or we are using the limited
233 EasyList (because we fiddled with the original).
234 </dd>
235 </dl><a NAME="AdBlockSubscription.adBlockDisabledForUrl" ID="AdBlockSubscription.adBlockDisabledForUrl"></a>
236 <h4>AdBlockSubscription.adBlockDisabledForUrl</h4>
237 <b>adBlockDisabledForUrl</b>(<i>url</i>)
238 <p>
239 Public method to check, if AdBlock is disabled for the given URL.
240 </p><dl>
241 <dt><i>url</i></dt>
242 <dd>
243 URL to check (QUrl)
244 </dd>
245 </dl><dl>
246 <dt>Returns:</dt>
247 <dd>
248 flag indicating disabled state (boolean)
249 </dd>
250 </dl><a NAME="AdBlockSubscription.addRule" ID="AdBlockSubscription.addRule"></a>
251 <h4>AdBlockSubscription.addRule</h4>
252 <b>addRule</b>(<i>rule</i>)
253 <p>
254 Public method to add a rule.
255 </p><dl>
256 <dt><i>rule</i></dt>
257 <dd>
258 reference to the rule to add (AdBlockRule)
259 </dd>
260 </dl><dl>
261 <dt>Returns:</dt>
262 <dd>
263 offset of the rule (integer)
264 </dd>
265 </dl><a NAME="AdBlockSubscription.allRules" ID="AdBlockSubscription.allRules"></a>
266 <h4>AdBlockSubscription.allRules</h4>
267 <b>allRules</b>(<i></i>)
268 <p>
269 Public method to get the list of rules.
270 </p><dl>
271 <dt>Returns:</dt>
272 <dd>
273 list of rules (list of AdBlockRule)
274 </dd>
275 </dl><a NAME="AdBlockSubscription.canBeRemoved" ID="AdBlockSubscription.canBeRemoved"></a>
276 <h4>AdBlockSubscription.canBeRemoved</h4>
277 <b>canBeRemoved</b>(<i></i>)
278 <p>
279 Public method to check, if the subscription can be removed.
280 </p><dl>
281 <dt>Returns:</dt>
282 <dd>
283 flag indicating removal is allowed (boolean)
284 </dd>
285 </dl><a NAME="AdBlockSubscription.canEditRules" ID="AdBlockSubscription.canEditRules"></a>
286 <h4>AdBlockSubscription.canEditRules</h4>
287 <b>canEditRules</b>(<i></i>)
288 <p>
289 Public method to check, if rules can be edited.
290 </p><dl>
291 <dt>Returns:</dt>
292 <dd>
293 flag indicating rules may be edited (boolean)
294 </dd>
295 </dl><a NAME="AdBlockSubscription.checkForUpdate" ID="AdBlockSubscription.checkForUpdate"></a>
296 <h4>AdBlockSubscription.checkForUpdate</h4>
297 <b>checkForUpdate</b>(<i></i>)
298 <p>
299 Public method to check for an update.
300 </p><a NAME="AdBlockSubscription.elemHideDisabledForUrl" ID="AdBlockSubscription.elemHideDisabledForUrl"></a>
301 <h4>AdBlockSubscription.elemHideDisabledForUrl</h4>
302 <b>elemHideDisabledForUrl</b>(<i>url</i>)
303 <p>
304 Public method to check, if element hiding is disabled for the given
305 URL.
306 </p><dl>
307 <dt><i>url</i></dt>
308 <dd>
309 URL to check (QUrl)
310 </dd>
311 </dl><dl>
312 <dt>Returns:</dt>
313 <dd>
314 flag indicating disabled state (boolean)
315 </dd>
316 </dl><a NAME="AdBlockSubscription.elementHidingRules" ID="AdBlockSubscription.elementHidingRules"></a>
317 <h4>AdBlockSubscription.elementHidingRules</h4>
318 <b>elementHidingRules</b>(<i></i>)
319 <p>
320 Public method to get the element hiding rules.
321 </p><dl>
322 <dt>Returns:</dt>
323 <dd>
324 element hiding rules (string)
325 </dd>
326 </dl><a NAME="AdBlockSubscription.elementHidingRulesForDomain" ID="AdBlockSubscription.elementHidingRulesForDomain"></a>
327 <h4>AdBlockSubscription.elementHidingRulesForDomain</h4>
328 <b>elementHidingRulesForDomain</b>(<i>domain</i>)
329 <p>
330 Public method to get the element hiding rules for the given domain.
331 </p><dl>
332 <dt><i>domain</i></dt>
333 <dd>
334 domain name (string)
335 </dd>
336 </dl><dl>
337 <dt>Returns:</dt>
338 <dd>
339 element hiding rules (string)
340 </dd>
341 </dl><a NAME="AdBlockSubscription.isEnabled" ID="AdBlockSubscription.isEnabled"></a>
342 <h4>AdBlockSubscription.isEnabled</h4>
343 <b>isEnabled</b>(<i></i>)
344 <p>
345 Public method to check, if the subscription is enabled.
346 </p><dl>
347 <dt>Returns:</dt>
348 <dd>
349 flag indicating the enabled status (boolean)
350 </dd>
351 </dl><a NAME="AdBlockSubscription.lastUpdate" ID="AdBlockSubscription.lastUpdate"></a>
352 <h4>AdBlockSubscription.lastUpdate</h4>
353 <b>lastUpdate</b>(<i></i>)
354 <p>
355 Public method to get the date and time of the last update.
356 </p><dl>
357 <dt>Returns:</dt>
358 <dd>
359 date and time of the last update (QDateTime)
360 </dd>
361 </dl><a NAME="AdBlockSubscription.location" ID="AdBlockSubscription.location"></a>
362 <h4>AdBlockSubscription.location</h4>
363 <b>location</b>(<i></i>)
364 <p>
365 Public method to get the subscription location.
366 </p><dl>
367 <dt>Returns:</dt>
368 <dd>
369 URL of the subscription location (QUrl)
370 </dd>
371 </dl><a NAME="AdBlockSubscription.match" ID="AdBlockSubscription.match"></a>
372 <h4>AdBlockSubscription.match</h4>
373 <b>match</b>(<i>req, urlDomain, urlString</i>)
374 <p>
375 Public method to check the subscription for a matching rule.
376 </p><dl>
377 <dt><i>req</i></dt>
378 <dd>
379 reference to the network request (QWebEngineUrlRequestInfo)
380 </dd><dt><i>urlDomain</i></dt>
381 <dd>
382 domain of the URL (string)
383 </dd><dt><i>urlString</i></dt>
384 <dd>
385 URL (string)
386 </dd>
387 </dl><dl>
388 <dt>Returns:</dt>
389 <dd>
390 reference to the rule object or None (AdBlockRule)
391 </dd>
392 </dl><a NAME="AdBlockSubscription.removeRule" ID="AdBlockSubscription.removeRule"></a>
393 <h4>AdBlockSubscription.removeRule</h4>
394 <b>removeRule</b>(<i>offset</i>)
395 <p>
396 Public method to remove a rule given the offset.
397 </p><dl>
398 <dt><i>offset</i></dt>
399 <dd>
400 offset of the rule to remove (integer)
401 </dd>
402 </dl><a NAME="AdBlockSubscription.replaceRule" ID="AdBlockSubscription.replaceRule"></a>
403 <h4>AdBlockSubscription.replaceRule</h4>
404 <b>replaceRule</b>(<i>rule, offset</i>)
405 <p>
406 Public method to replace a rule given the offset.
407 </p><dl>
408 <dt><i>rule</i></dt>
409 <dd>
410 reference to the rule to set (AdBlockRule)
411 </dd><dt><i>offset</i></dt>
412 <dd>
413 offset of the rule to remove (integer)
414 </dd>
415 </dl><dl>
416 <dt>Returns:</dt>
417 <dd>
418 requested rule (AdBlockRule)
419 </dd>
420 </dl><a NAME="AdBlockSubscription.requiresLocation" ID="AdBlockSubscription.requiresLocation"></a>
421 <h4>AdBlockSubscription.requiresLocation</h4>
422 <b>requiresLocation</b>(<i></i>)
423 <p>
424 Public method to get the location of a required subscription.
425 </p><dl>
426 <dt>Returns:</dt>
427 <dd>
428 location of a required subscription (string)
429 </dd>
430 </dl><a NAME="AdBlockSubscription.rule" ID="AdBlockSubscription.rule"></a>
431 <h4>AdBlockSubscription.rule</h4>
432 <b>rule</b>(<i>offset</i>)
433 <p>
434 Public method to get a specific rule.
435 </p><dl>
436 <dt><i>offset</i></dt>
437 <dd>
438 offset of the rule (integer)
439 </dd>
440 </dl><dl>
441 <dt>Returns:</dt>
442 <dd>
443 requested rule (AdBlockRule)
444 </dd>
445 </dl><a NAME="AdBlockSubscription.rulesFileName" ID="AdBlockSubscription.rulesFileName"></a>
446 <h4>AdBlockSubscription.rulesFileName</h4>
447 <b>rulesFileName</b>(<i></i>)
448 <p>
449 Public method to get the name of the rules file.
450 </p><dl>
451 <dt>Returns:</dt>
452 <dd>
453 name of the rules file (string)
454 </dd>
455 </dl><a NAME="AdBlockSubscription.saveRules" ID="AdBlockSubscription.saveRules"></a>
456 <h4>AdBlockSubscription.saveRules</h4>
457 <b>saveRules</b>(<i></i>)
458 <p>
459 Public method to save the subscription rules.
460 </p><a NAME="AdBlockSubscription.setEnabled" ID="AdBlockSubscription.setEnabled"></a>
461 <h4>AdBlockSubscription.setEnabled</h4>
462 <b>setEnabled</b>(<i>enabled</i>)
463 <p>
464 Public method to set the enabled status.
465 </p><dl>
466 <dt><i>enabled</i></dt>
467 <dd>
468 flag indicating the enabled status (boolean)
469 </dd>
470 </dl><a NAME="AdBlockSubscription.setLocation" ID="AdBlockSubscription.setLocation"></a>
471 <h4>AdBlockSubscription.setLocation</h4>
472 <b>setLocation</b>(<i>url</i>)
473 <p>
474 Public method to set the subscription location.
475 </p><dl>
476 <dt><i>url</i></dt>
477 <dd>
478 URL of the subscription location (QUrl)
479 </dd>
480 </dl><a NAME="AdBlockSubscription.setRuleEnabled" ID="AdBlockSubscription.setRuleEnabled"></a>
481 <h4>AdBlockSubscription.setRuleEnabled</h4>
482 <b>setRuleEnabled</b>(<i>offset, enabled</i>)
483 <p>
484 Public method to enable a specific rule.
485 </p><dl>
486 <dt><i>offset</i></dt>
487 <dd>
488 offset of the rule (integer)
489 </dd><dt><i>enabled</i></dt>
490 <dd>
491 new enabled state (boolean)
492 </dd>
493 </dl><dl>
494 <dt>Returns:</dt>
495 <dd>
496 reference to the changed rule (AdBlockRule)
497 </dd>
498 </dl><a NAME="AdBlockSubscription.setTitle" ID="AdBlockSubscription.setTitle"></a>
499 <h4>AdBlockSubscription.setTitle</h4>
500 <b>setTitle</b>(<i>title</i>)
501 <p>
502 Public method to set the subscription title.
503 </p><dl>
504 <dt><i>title</i></dt>
505 <dd>
506 subscription title (string)
507 </dd>
508 </dl><a NAME="AdBlockSubscription.title" ID="AdBlockSubscription.title"></a>
509 <h4>AdBlockSubscription.title</h4>
510 <b>title</b>(<i></i>)
511 <p>
512 Public method to get the subscription title.
513 </p><dl>
514 <dt>Returns:</dt>
515 <dd>
516 subscription title (string)
517 </dd>
518 </dl><a NAME="AdBlockSubscription.updateNow" ID="AdBlockSubscription.updateNow"></a>
519 <h4>AdBlockSubscription.updateNow</h4>
520 <b>updateNow</b>(<i></i>)
521 <p>
522 Public method to update the subscription immediately.
523 </p><a NAME="AdBlockSubscription.url" ID="AdBlockSubscription.url"></a>
524 <h4>AdBlockSubscription.url</h4>
525 <b>url</b>(<i></i>)
526 <p>
527 Public method to generate the URL for this subscription.
528 </p><dl>
529 <dt>Returns:</dt>
530 <dd>
531 AdBlock URL for the subscription (QUrl)
532 </dd>
533 </dl>
534 <div align="right"><a href="#top">Up</a></div>
535 <hr />
536 </body></html>

eric ide

mercurial