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

branch
eric7
changeset 8372
e0227a7c850e
child 8596
d64760b2da50
equal deleted inserted replaced
8371:d6062691d424 8372:e0227a7c850e
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.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>
22 <a NAME="top" ID="top"></a>
23 <h1>eric7.WebBrowser.AdBlock.AdBlockSubscription</h1>
24
25 <p>
26 Module implementing the AdBlock subscription class.
27 </p>
28 <h3>Global Attributes</h3>
29
30 <table>
31 <tr><td>None</td></tr>
32 </table>
33 <h3>Classes</h3>
34
35 <table>
36
37 <tr>
38 <td><a href="#AdBlockSubscription">AdBlockSubscription</a></td>
39 <td>Class implementing the AdBlock subscription.</td>
40 </tr>
41 </table>
42 <h3>Functions</h3>
43
44 <table>
45 <tr><td>None</td></tr>
46 </table>
47 <hr />
48 <hr />
49 <a NAME="AdBlockSubscription" ID="AdBlockSubscription"></a>
50 <h2>AdBlockSubscription</h2>
51
52 <p>
53 Class implementing the AdBlock subscription.
54 </p>
55 <h3>Signals</h3>
56 <dl>
57
58 <dt>changed()</dt>
59 <dd>
60 emitted after the subscription has changed
61 </dd>
62 <dt>enabledChanged(bool)</dt>
63 <dd>
64 emitted after the enabled state was changed
65 </dd>
66 <dt>rulesChanged()</dt>
67 <dd>
68 emitted after the subscription's rules have changed
69 </dd>
70 <dt>rulesEnabledChanged()</dt>
71 <dd>
72 emitted after a rule enabled state was
73 changed
74 </dd>
75 </dl>
76 <h3>Derived from</h3>
77 QObject
78 <h3>Class Attributes</h3>
79
80 <table>
81 <tr><td>None</td></tr>
82 </table>
83 <h3>Class Methods</h3>
84
85 <table>
86 <tr><td>None</td></tr>
87 </table>
88 <h3>Methods</h3>
89
90 <table>
91
92 <tr>
93 <td><a href="#AdBlockSubscription.__init__">AdBlockSubscription</a></td>
94 <td>Constructor</td>
95 </tr>
96 <tr>
97 <td><a href="#AdBlockSubscription.__loadRules">__loadRules</a></td>
98 <td>Private method to load the rules of the subscription.</td>
99 </tr>
100 <tr>
101 <td><a href="#AdBlockSubscription.__parseUrl">__parseUrl</a></td>
102 <td>Private method to parse the AdBlock URL for the subscription.</td>
103 </tr>
104 <tr>
105 <td><a href="#AdBlockSubscription.__rulesDownloaded">__rulesDownloaded</a></td>
106 <td>Private slot to deal with the downloaded rules.</td>
107 </tr>
108 <tr>
109 <td><a href="#AdBlockSubscription.__validateCheckSum">__validateCheckSum</a></td>
110 <td>Private method to check the subscription file's checksum.</td>
111 </tr>
112 <tr>
113 <td><a href="#AdBlockSubscription.addRule">addRule</a></td>
114 <td>Public method to add a rule.</td>
115 </tr>
116 <tr>
117 <td><a href="#AdBlockSubscription.allRules">allRules</a></td>
118 <td>Public method to get the list of rules.</td>
119 </tr>
120 <tr>
121 <td><a href="#AdBlockSubscription.canBeRemoved">canBeRemoved</a></td>
122 <td>Public method to check, if the subscription can be removed.</td>
123 </tr>
124 <tr>
125 <td><a href="#AdBlockSubscription.canEditRules">canEditRules</a></td>
126 <td>Public method to check, if rules can be edited.</td>
127 </tr>
128 <tr>
129 <td><a href="#AdBlockSubscription.checkForUpdate">checkForUpdate</a></td>
130 <td>Public method to check for an update.</td>
131 </tr>
132 <tr>
133 <td><a href="#AdBlockSubscription.isEnabled">isEnabled</a></td>
134 <td>Public method to check, if the subscription is enabled.</td>
135 </tr>
136 <tr>
137 <td><a href="#AdBlockSubscription.lastUpdate">lastUpdate</a></td>
138 <td>Public method to get the date and time of the last update.</td>
139 </tr>
140 <tr>
141 <td><a href="#AdBlockSubscription.location">location</a></td>
142 <td>Public method to get the subscription location.</td>
143 </tr>
144 <tr>
145 <td><a href="#AdBlockSubscription.removeRule">removeRule</a></td>
146 <td>Public method to remove a rule given the offset.</td>
147 </tr>
148 <tr>
149 <td><a href="#AdBlockSubscription.replaceRule">replaceRule</a></td>
150 <td>Public method to replace a rule given the offset.</td>
151 </tr>
152 <tr>
153 <td><a href="#AdBlockSubscription.requiresLocation">requiresLocation</a></td>
154 <td>Public method to get the location of a required subscription.</td>
155 </tr>
156 <tr>
157 <td><a href="#AdBlockSubscription.rule">rule</a></td>
158 <td>Public method to get a specific rule.</td>
159 </tr>
160 <tr>
161 <td><a href="#AdBlockSubscription.rulesFileName">rulesFileName</a></td>
162 <td>Public method to get the name of the rules file.</td>
163 </tr>
164 <tr>
165 <td><a href="#AdBlockSubscription.saveRules">saveRules</a></td>
166 <td>Public method to save the subscription rules.</td>
167 </tr>
168 <tr>
169 <td><a href="#AdBlockSubscription.setEnabled">setEnabled</a></td>
170 <td>Public method to set the enabled status.</td>
171 </tr>
172 <tr>
173 <td><a href="#AdBlockSubscription.setLocation">setLocation</a></td>
174 <td>Public method to set the subscription location.</td>
175 </tr>
176 <tr>
177 <td><a href="#AdBlockSubscription.setRuleEnabled">setRuleEnabled</a></td>
178 <td>Public method to enable a specific rule.</td>
179 </tr>
180 <tr>
181 <td><a href="#AdBlockSubscription.setTitle">setTitle</a></td>
182 <td>Public method to set the subscription title.</td>
183 </tr>
184 <tr>
185 <td><a href="#AdBlockSubscription.title">title</a></td>
186 <td>Public method to get the subscription title.</td>
187 </tr>
188 <tr>
189 <td><a href="#AdBlockSubscription.updateNow">updateNow</a></td>
190 <td>Public method to update the subscription immediately.</td>
191 </tr>
192 <tr>
193 <td><a href="#AdBlockSubscription.url">url</a></td>
194 <td>Public method to generate the URL for this subscription.</td>
195 </tr>
196 </table>
197 <h3>Static Methods</h3>
198
199 <table>
200 <tr><td>None</td></tr>
201 </table>
202
203 <a NAME="AdBlockSubscription.__init__" ID="AdBlockSubscription.__init__"></a>
204 <h4>AdBlockSubscription (Constructor)</h4>
205 <b>AdBlockSubscription</b>(<i>url, custom, parent=None, default=False</i>)
206
207 <p>
208 Constructor
209 </p>
210 <dl>
211
212 <dt><i>url</i></dt>
213 <dd>
214 AdBlock URL for the subscription (QUrl)
215 </dd>
216 <dt><i>custom</i></dt>
217 <dd>
218 flag indicating a custom subscription (boolean)
219 </dd>
220 <dt><i>parent</i></dt>
221 <dd>
222 reference to the parent object (QObject)
223 </dd>
224 <dt><i>default</i></dt>
225 <dd>
226 flag indicating a default subscription (boolean)
227 </dd>
228 </dl>
229 <a NAME="AdBlockSubscription.__loadRules" ID="AdBlockSubscription.__loadRules"></a>
230 <h4>AdBlockSubscription.__loadRules</h4>
231 <b>__loadRules</b>(<i></i>)
232
233 <p>
234 Private method to load the rules of the subscription.
235 </p>
236 <a NAME="AdBlockSubscription.__parseUrl" ID="AdBlockSubscription.__parseUrl"></a>
237 <h4>AdBlockSubscription.__parseUrl</h4>
238 <b>__parseUrl</b>(<i>url</i>)
239
240 <p>
241 Private method to parse the AdBlock URL for the subscription.
242 </p>
243 <dl>
244
245 <dt><i>url</i> (QUrl)</dt>
246 <dd>
247 AdBlock URL for the subscription
248 </dd>
249 </dl>
250 <a NAME="AdBlockSubscription.__rulesDownloaded" ID="AdBlockSubscription.__rulesDownloaded"></a>
251 <h4>AdBlockSubscription.__rulesDownloaded</h4>
252 <b>__rulesDownloaded</b>(<i>reply</i>)
253
254 <p>
255 Private slot to deal with the downloaded rules.
256 </p>
257 <dl>
258
259 <dt><i>reply</i> (QNetworkReply)</dt>
260 <dd>
261 reference to the network reply
262 </dd>
263 </dl>
264 <a NAME="AdBlockSubscription.__validateCheckSum" ID="AdBlockSubscription.__validateCheckSum"></a>
265 <h4>AdBlockSubscription.__validateCheckSum</h4>
266 <b>__validateCheckSum</b>(<i>fileName</i>)
267
268 <p>
269 Private method to check the subscription file's checksum.
270 </p>
271 <dl>
272
273 <dt><i>fileName</i> (str)</dt>
274 <dd>
275 name of the file containing the subscription
276 </dd>
277 </dl>
278 <dl>
279 <dt>Return:</dt>
280 <dd>
281 flag indicating a valid file. A file is considered
282 valid, if the checksum is OK, the file does not contain a
283 checksum (i.e. cannot be checked) or we are using the limited
284 EasyList (because we fiddled with the original).
285 </dd>
286 </dl>
287 <dl>
288 <dt>Return Type:</dt>
289 <dd>
290 bool
291 </dd>
292 </dl>
293 <a NAME="AdBlockSubscription.addRule" ID="AdBlockSubscription.addRule"></a>
294 <h4>AdBlockSubscription.addRule</h4>
295 <b>addRule</b>(<i>rule</i>)
296
297 <p>
298 Public method to add a rule.
299 </p>
300 <dl>
301
302 <dt><i>rule</i> (AdBlockRule)</dt>
303 <dd>
304 reference to the rule to add
305 </dd>
306 </dl>
307 <dl>
308 <dt>Return:</dt>
309 <dd>
310 offset of the rule
311 </dd>
312 </dl>
313 <dl>
314 <dt>Return Type:</dt>
315 <dd>
316 int
317 </dd>
318 </dl>
319 <a NAME="AdBlockSubscription.allRules" ID="AdBlockSubscription.allRules"></a>
320 <h4>AdBlockSubscription.allRules</h4>
321 <b>allRules</b>(<i></i>)
322
323 <p>
324 Public method to get the list of rules.
325 </p>
326 <dl>
327 <dt>Return:</dt>
328 <dd>
329 list of rules
330 </dd>
331 </dl>
332 <dl>
333 <dt>Return Type:</dt>
334 <dd>
335 list of AdBlockRule
336 </dd>
337 </dl>
338 <a NAME="AdBlockSubscription.canBeRemoved" ID="AdBlockSubscription.canBeRemoved"></a>
339 <h4>AdBlockSubscription.canBeRemoved</h4>
340 <b>canBeRemoved</b>(<i></i>)
341
342 <p>
343 Public method to check, if the subscription can be removed.
344 </p>
345 <dl>
346 <dt>Return:</dt>
347 <dd>
348 flag indicating removal is allowed
349 </dd>
350 </dl>
351 <dl>
352 <dt>Return Type:</dt>
353 <dd>
354 bool
355 </dd>
356 </dl>
357 <a NAME="AdBlockSubscription.canEditRules" ID="AdBlockSubscription.canEditRules"></a>
358 <h4>AdBlockSubscription.canEditRules</h4>
359 <b>canEditRules</b>(<i></i>)
360
361 <p>
362 Public method to check, if rules can be edited.
363 </p>
364 <dl>
365 <dt>Return:</dt>
366 <dd>
367 flag indicating rules may be edited
368 </dd>
369 </dl>
370 <dl>
371 <dt>Return Type:</dt>
372 <dd>
373 bool
374 </dd>
375 </dl>
376 <a NAME="AdBlockSubscription.checkForUpdate" ID="AdBlockSubscription.checkForUpdate"></a>
377 <h4>AdBlockSubscription.checkForUpdate</h4>
378 <b>checkForUpdate</b>(<i></i>)
379
380 <p>
381 Public method to check for an update.
382 </p>
383 <a NAME="AdBlockSubscription.isEnabled" ID="AdBlockSubscription.isEnabled"></a>
384 <h4>AdBlockSubscription.isEnabled</h4>
385 <b>isEnabled</b>(<i></i>)
386
387 <p>
388 Public method to check, if the subscription is enabled.
389 </p>
390 <dl>
391 <dt>Return:</dt>
392 <dd>
393 flag indicating the enabled status
394 </dd>
395 </dl>
396 <dl>
397 <dt>Return Type:</dt>
398 <dd>
399 bool
400 </dd>
401 </dl>
402 <a NAME="AdBlockSubscription.lastUpdate" ID="AdBlockSubscription.lastUpdate"></a>
403 <h4>AdBlockSubscription.lastUpdate</h4>
404 <b>lastUpdate</b>(<i></i>)
405
406 <p>
407 Public method to get the date and time of the last update.
408 </p>
409 <dl>
410 <dt>Return:</dt>
411 <dd>
412 date and time of the last update
413 </dd>
414 </dl>
415 <dl>
416 <dt>Return Type:</dt>
417 <dd>
418 QDateTime
419 </dd>
420 </dl>
421 <a NAME="AdBlockSubscription.location" ID="AdBlockSubscription.location"></a>
422 <h4>AdBlockSubscription.location</h4>
423 <b>location</b>(<i></i>)
424
425 <p>
426 Public method to get the subscription location.
427 </p>
428 <dl>
429 <dt>Return:</dt>
430 <dd>
431 URL of the subscription location
432 </dd>
433 </dl>
434 <dl>
435 <dt>Return Type:</dt>
436 <dd>
437 QUrl
438 </dd>
439 </dl>
440 <a NAME="AdBlockSubscription.removeRule" ID="AdBlockSubscription.removeRule"></a>
441 <h4>AdBlockSubscription.removeRule</h4>
442 <b>removeRule</b>(<i>offset</i>)
443
444 <p>
445 Public method to remove a rule given the offset.
446 </p>
447 <dl>
448
449 <dt><i>offset</i> (int)</dt>
450 <dd>
451 offset of the rule to remove
452 </dd>
453 </dl>
454 <a NAME="AdBlockSubscription.replaceRule" ID="AdBlockSubscription.replaceRule"></a>
455 <h4>AdBlockSubscription.replaceRule</h4>
456 <b>replaceRule</b>(<i>rule, offset</i>)
457
458 <p>
459 Public method to replace a rule given the offset.
460 </p>
461 <dl>
462
463 <dt><i>rule</i> (AdBlockRule)</dt>
464 <dd>
465 reference to the rule to set
466 </dd>
467 <dt><i>offset</i> (int)</dt>
468 <dd>
469 offset of the rule to remove
470 </dd>
471 </dl>
472 <dl>
473 <dt>Return:</dt>
474 <dd>
475 requested rule
476 </dd>
477 </dl>
478 <dl>
479 <dt>Return Type:</dt>
480 <dd>
481 AdBlockRule
482 </dd>
483 </dl>
484 <a NAME="AdBlockSubscription.requiresLocation" ID="AdBlockSubscription.requiresLocation"></a>
485 <h4>AdBlockSubscription.requiresLocation</h4>
486 <b>requiresLocation</b>(<i></i>)
487
488 <p>
489 Public method to get the location of a required subscription.
490 </p>
491 <dl>
492 <dt>Return:</dt>
493 <dd>
494 location of a required subscription
495 </dd>
496 </dl>
497 <dl>
498 <dt>Return Type:</dt>
499 <dd>
500 str
501 </dd>
502 </dl>
503 <a NAME="AdBlockSubscription.rule" ID="AdBlockSubscription.rule"></a>
504 <h4>AdBlockSubscription.rule</h4>
505 <b>rule</b>(<i>offset</i>)
506
507 <p>
508 Public method to get a specific rule.
509 </p>
510 <dl>
511
512 <dt><i>offset</i> (int)</dt>
513 <dd>
514 offset of the rule
515 </dd>
516 </dl>
517 <dl>
518 <dt>Return:</dt>
519 <dd>
520 requested rule
521 </dd>
522 </dl>
523 <dl>
524 <dt>Return Type:</dt>
525 <dd>
526 AdBlockRule
527 </dd>
528 </dl>
529 <a NAME="AdBlockSubscription.rulesFileName" ID="AdBlockSubscription.rulesFileName"></a>
530 <h4>AdBlockSubscription.rulesFileName</h4>
531 <b>rulesFileName</b>(<i></i>)
532
533 <p>
534 Public method to get the name of the rules file.
535 </p>
536 <dl>
537 <dt>Return:</dt>
538 <dd>
539 name of the rules file
540 </dd>
541 </dl>
542 <dl>
543 <dt>Return Type:</dt>
544 <dd>
545 str
546 </dd>
547 </dl>
548 <a NAME="AdBlockSubscription.saveRules" ID="AdBlockSubscription.saveRules"></a>
549 <h4>AdBlockSubscription.saveRules</h4>
550 <b>saveRules</b>(<i></i>)
551
552 <p>
553 Public method to save the subscription rules.
554 </p>
555 <a NAME="AdBlockSubscription.setEnabled" ID="AdBlockSubscription.setEnabled"></a>
556 <h4>AdBlockSubscription.setEnabled</h4>
557 <b>setEnabled</b>(<i>enabled</i>)
558
559 <p>
560 Public method to set the enabled status.
561 </p>
562 <dl>
563
564 <dt><i>enabled</i> (bool)</dt>
565 <dd>
566 flag indicating the enabled status
567 </dd>
568 </dl>
569 <a NAME="AdBlockSubscription.setLocation" ID="AdBlockSubscription.setLocation"></a>
570 <h4>AdBlockSubscription.setLocation</h4>
571 <b>setLocation</b>(<i>url</i>)
572
573 <p>
574 Public method to set the subscription location.
575 </p>
576 <dl>
577
578 <dt><i>url</i> (QUrl)</dt>
579 <dd>
580 URL of the subscription location
581 </dd>
582 </dl>
583 <a NAME="AdBlockSubscription.setRuleEnabled" ID="AdBlockSubscription.setRuleEnabled"></a>
584 <h4>AdBlockSubscription.setRuleEnabled</h4>
585 <b>setRuleEnabled</b>(<i>offset, enabled</i>)
586
587 <p>
588 Public method to enable a specific rule.
589 </p>
590 <dl>
591
592 <dt><i>offset</i> (int)</dt>
593 <dd>
594 offset of the rule
595 </dd>
596 <dt><i>enabled</i> (bool)</dt>
597 <dd>
598 new enabled state
599 </dd>
600 </dl>
601 <dl>
602 <dt>Return:</dt>
603 <dd>
604 reference to the changed rule
605 </dd>
606 </dl>
607 <dl>
608 <dt>Return Type:</dt>
609 <dd>
610 AdBlockRule
611 </dd>
612 </dl>
613 <a NAME="AdBlockSubscription.setTitle" ID="AdBlockSubscription.setTitle"></a>
614 <h4>AdBlockSubscription.setTitle</h4>
615 <b>setTitle</b>(<i>title</i>)
616
617 <p>
618 Public method to set the subscription title.
619 </p>
620 <dl>
621
622 <dt><i>title</i> (str)</dt>
623 <dd>
624 subscription title
625 </dd>
626 </dl>
627 <a NAME="AdBlockSubscription.title" ID="AdBlockSubscription.title"></a>
628 <h4>AdBlockSubscription.title</h4>
629 <b>title</b>(<i></i>)
630
631 <p>
632 Public method to get the subscription title.
633 </p>
634 <dl>
635 <dt>Return:</dt>
636 <dd>
637 subscription title
638 </dd>
639 </dl>
640 <dl>
641 <dt>Return Type:</dt>
642 <dd>
643 string
644 </dd>
645 </dl>
646 <a NAME="AdBlockSubscription.updateNow" ID="AdBlockSubscription.updateNow"></a>
647 <h4>AdBlockSubscription.updateNow</h4>
648 <b>updateNow</b>(<i></i>)
649
650 <p>
651 Public method to update the subscription immediately.
652 </p>
653 <a NAME="AdBlockSubscription.url" ID="AdBlockSubscription.url"></a>
654 <h4>AdBlockSubscription.url</h4>
655 <b>url</b>(<i></i>)
656
657 <p>
658 Public method to generate the URL for this subscription.
659 </p>
660 <dl>
661 <dt>Return:</dt>
662 <dd>
663 AdBlock URL for the subscription
664 </dd>
665 </dl>
666 <dl>
667 <dt>Return Type:</dt>
668 <dd>
669 QUrl
670 </dd>
671 </dl>
672 <div align="right"><a href="#top">Up</a></div>
673 <hr />
674 </body></html>

eric ide

mercurial