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

changeset 6942
2602857055c5
parent 6123
39cd368143db
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.Helpviewer.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.Helpviewer.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>reply</i>)
215 <p>
216 Private slot to deal with the downloaded rules.
217 </p><dl>
218 <dt><i>reply</i> (QNetworkReply)</dt>
219 <dd>
220 reference to the network reply
221 </dd>
222 </dl><a NAME="AdBlockSubscription.__validateCheckSum" ID="AdBlockSubscription.__validateCheckSum"></a>
223 <h4>AdBlockSubscription.__validateCheckSum</h4>
224 <b>__validateCheckSum</b>(<i>fileName</i>)
225 <p>
226 Private method to check the subscription file's checksum.
227 </p><dl>
228 <dt><i>fileName</i></dt>
229 <dd>
230 name of the file containing the subscription (string)
231 </dd>
232 </dl><dl>
233 <dt>Returns:</dt>
234 <dd>
235 flag indicating a valid file (boolean). A file is considered
236 valid, if the checksum is OK or the file does not contain a
237 checksum (i.e. cannot be checked).
238 </dd>
239 </dl><a NAME="AdBlockSubscription.adBlockDisabledForUrl" ID="AdBlockSubscription.adBlockDisabledForUrl"></a>
240 <h4>AdBlockSubscription.adBlockDisabledForUrl</h4>
241 <b>adBlockDisabledForUrl</b>(<i>url</i>)
242 <p>
243 Public method to check, if AdBlock is disabled for the given URL.
244 </p><dl>
245 <dt><i>url</i></dt>
246 <dd>
247 URL to check (QUrl)
248 </dd>
249 </dl><dl>
250 <dt>Returns:</dt>
251 <dd>
252 flag indicating disabled state (boolean)
253 </dd>
254 </dl><a NAME="AdBlockSubscription.addRule" ID="AdBlockSubscription.addRule"></a>
255 <h4>AdBlockSubscription.addRule</h4>
256 <b>addRule</b>(<i>rule</i>)
257 <p>
258 Public method to add a rule.
259 </p><dl>
260 <dt><i>rule</i></dt>
261 <dd>
262 reference to the rule to add (AdBlockRule)
263 </dd>
264 </dl><dl>
265 <dt>Returns:</dt>
266 <dd>
267 offset of the rule (integer)
268 </dd>
269 </dl><a NAME="AdBlockSubscription.allRules" ID="AdBlockSubscription.allRules"></a>
270 <h4>AdBlockSubscription.allRules</h4>
271 <b>allRules</b>(<i></i>)
272 <p>
273 Public method to get the list of rules.
274 </p><dl>
275 <dt>Returns:</dt>
276 <dd>
277 list of rules (list of AdBlockRule)
278 </dd>
279 </dl><a NAME="AdBlockSubscription.canBeRemoved" ID="AdBlockSubscription.canBeRemoved"></a>
280 <h4>AdBlockSubscription.canBeRemoved</h4>
281 <b>canBeRemoved</b>(<i></i>)
282 <p>
283 Public method to check, if the subscription can be removed.
284 </p><dl>
285 <dt>Returns:</dt>
286 <dd>
287 flag indicating removal is allowed (boolean)
288 </dd>
289 </dl><a NAME="AdBlockSubscription.canEditRules" ID="AdBlockSubscription.canEditRules"></a>
290 <h4>AdBlockSubscription.canEditRules</h4>
291 <b>canEditRules</b>(<i></i>)
292 <p>
293 Public method to check, if rules can be edited.
294 </p><dl>
295 <dt>Returns:</dt>
296 <dd>
297 flag indicating rules may be edited (boolean)
298 </dd>
299 </dl><a NAME="AdBlockSubscription.checkForUpdate" ID="AdBlockSubscription.checkForUpdate"></a>
300 <h4>AdBlockSubscription.checkForUpdate</h4>
301 <b>checkForUpdate</b>(<i></i>)
302 <p>
303 Public method to check for an update.
304 </p><a NAME="AdBlockSubscription.elemHideDisabledForUrl" ID="AdBlockSubscription.elemHideDisabledForUrl"></a>
305 <h4>AdBlockSubscription.elemHideDisabledForUrl</h4>
306 <b>elemHideDisabledForUrl</b>(<i>url</i>)
307 <p>
308 Public method to check, if element hiding is disabled for the given
309 URL.
310 </p><dl>
311 <dt><i>url</i></dt>
312 <dd>
313 URL to check (QUrl)
314 </dd>
315 </dl><dl>
316 <dt>Returns:</dt>
317 <dd>
318 flag indicating disabled state (boolean)
319 </dd>
320 </dl><a NAME="AdBlockSubscription.elementHidingRules" ID="AdBlockSubscription.elementHidingRules"></a>
321 <h4>AdBlockSubscription.elementHidingRules</h4>
322 <b>elementHidingRules</b>(<i></i>)
323 <p>
324 Public method to get the element hiding rules.
325 </p><dl>
326 <dt>Returns:</dt>
327 <dd>
328 element hiding rules (string)
329 </dd>
330 </dl><a NAME="AdBlockSubscription.elementHidingRulesForDomain" ID="AdBlockSubscription.elementHidingRulesForDomain"></a>
331 <h4>AdBlockSubscription.elementHidingRulesForDomain</h4>
332 <b>elementHidingRulesForDomain</b>(<i>domain</i>)
333 <p>
334 Public method to get the element hiding rules for the given domain.
335 </p><dl>
336 <dt><i>domain</i></dt>
337 <dd>
338 domain name (string)
339 </dd>
340 </dl><dl>
341 <dt>Returns:</dt>
342 <dd>
343 element hiding rules (string)
344 </dd>
345 </dl><a NAME="AdBlockSubscription.isEnabled" ID="AdBlockSubscription.isEnabled"></a>
346 <h4>AdBlockSubscription.isEnabled</h4>
347 <b>isEnabled</b>(<i></i>)
348 <p>
349 Public method to check, if the subscription is enabled.
350 </p><dl>
351 <dt>Returns:</dt>
352 <dd>
353 flag indicating the enabled status (boolean)
354 </dd>
355 </dl><a NAME="AdBlockSubscription.lastUpdate" ID="AdBlockSubscription.lastUpdate"></a>
356 <h4>AdBlockSubscription.lastUpdate</h4>
357 <b>lastUpdate</b>(<i></i>)
358 <p>
359 Public method to get the date and time of the last update.
360 </p><dl>
361 <dt>Returns:</dt>
362 <dd>
363 date and time of the last update (QDateTime)
364 </dd>
365 </dl><a NAME="AdBlockSubscription.location" ID="AdBlockSubscription.location"></a>
366 <h4>AdBlockSubscription.location</h4>
367 <b>location</b>(<i></i>)
368 <p>
369 Public method to get the subscription location.
370 </p><dl>
371 <dt>Returns:</dt>
372 <dd>
373 URL of the subscription location (QUrl)
374 </dd>
375 </dl><a NAME="AdBlockSubscription.match" ID="AdBlockSubscription.match"></a>
376 <h4>AdBlockSubscription.match</h4>
377 <b>match</b>(<i>req, urlDomain, urlString</i>)
378 <p>
379 Public method to check the subscription for a matching rule.
380 </p><dl>
381 <dt><i>req</i></dt>
382 <dd>
383 reference to the network request (QNetworkRequest)
384 </dd><dt><i>urlDomain</i></dt>
385 <dd>
386 domain of the URL (string)
387 </dd><dt><i>urlString</i></dt>
388 <dd>
389 URL (string)
390 </dd>
391 </dl><dl>
392 <dt>Returns:</dt>
393 <dd>
394 reference to the rule object or None (AdBlockRule)
395 </dd>
396 </dl><a NAME="AdBlockSubscription.removeRule" ID="AdBlockSubscription.removeRule"></a>
397 <h4>AdBlockSubscription.removeRule</h4>
398 <b>removeRule</b>(<i>offset</i>)
399 <p>
400 Public method to remove a rule given the offset.
401 </p><dl>
402 <dt><i>offset</i></dt>
403 <dd>
404 offset of the rule to remove (integer)
405 </dd>
406 </dl><a NAME="AdBlockSubscription.replaceRule" ID="AdBlockSubscription.replaceRule"></a>
407 <h4>AdBlockSubscription.replaceRule</h4>
408 <b>replaceRule</b>(<i>rule, offset</i>)
409 <p>
410 Public method to replace a rule given the offset.
411 </p><dl>
412 <dt><i>rule</i></dt>
413 <dd>
414 reference to the rule to set (AdBlockRule)
415 </dd><dt><i>offset</i></dt>
416 <dd>
417 offset of the rule to remove (integer)
418 </dd>
419 </dl><dl>
420 <dt>Returns:</dt>
421 <dd>
422 requested rule (AdBlockRule)
423 </dd>
424 </dl><a NAME="AdBlockSubscription.requiresLocation" ID="AdBlockSubscription.requiresLocation"></a>
425 <h4>AdBlockSubscription.requiresLocation</h4>
426 <b>requiresLocation</b>(<i></i>)
427 <p>
428 Public method to get the location of a required subscription.
429 </p><dl>
430 <dt>Returns:</dt>
431 <dd>
432 location of a required subscription (string)
433 </dd>
434 </dl><a NAME="AdBlockSubscription.rule" ID="AdBlockSubscription.rule"></a>
435 <h4>AdBlockSubscription.rule</h4>
436 <b>rule</b>(<i>offset</i>)
437 <p>
438 Public method to get a specific rule.
439 </p><dl>
440 <dt><i>offset</i></dt>
441 <dd>
442 offset of the rule (integer)
443 </dd>
444 </dl><dl>
445 <dt>Returns:</dt>
446 <dd>
447 requested rule (AdBlockRule)
448 </dd>
449 </dl><a NAME="AdBlockSubscription.rulesFileName" ID="AdBlockSubscription.rulesFileName"></a>
450 <h4>AdBlockSubscription.rulesFileName</h4>
451 <b>rulesFileName</b>(<i></i>)
452 <p>
453 Public method to get the name of the rules file.
454 </p><dl>
455 <dt>Returns:</dt>
456 <dd>
457 name of the rules file (string)
458 </dd>
459 </dl><a NAME="AdBlockSubscription.saveRules" ID="AdBlockSubscription.saveRules"></a>
460 <h4>AdBlockSubscription.saveRules</h4>
461 <b>saveRules</b>(<i></i>)
462 <p>
463 Public method to save the subscription rules.
464 </p><a NAME="AdBlockSubscription.setEnabled" ID="AdBlockSubscription.setEnabled"></a>
465 <h4>AdBlockSubscription.setEnabled</h4>
466 <b>setEnabled</b>(<i>enabled</i>)
467 <p>
468 Public method to set the enabled status.
469 </p><dl>
470 <dt><i>enabled</i></dt>
471 <dd>
472 flag indicating the enabled status (boolean)
473 </dd>
474 </dl><a NAME="AdBlockSubscription.setLocation" ID="AdBlockSubscription.setLocation"></a>
475 <h4>AdBlockSubscription.setLocation</h4>
476 <b>setLocation</b>(<i>url</i>)
477 <p>
478 Public method to set the subscription location.
479 </p><dl>
480 <dt><i>url</i></dt>
481 <dd>
482 URL of the subscription location (QUrl)
483 </dd>
484 </dl><a NAME="AdBlockSubscription.setRuleEnabled" ID="AdBlockSubscription.setRuleEnabled"></a>
485 <h4>AdBlockSubscription.setRuleEnabled</h4>
486 <b>setRuleEnabled</b>(<i>offset, enabled</i>)
487 <p>
488 Public method to enable a specific rule.
489 </p><dl>
490 <dt><i>offset</i></dt>
491 <dd>
492 offset of the rule (integer)
493 </dd><dt><i>enabled</i></dt>
494 <dd>
495 new enabled state (boolean)
496 </dd>
497 </dl><dl>
498 <dt>Returns:</dt>
499 <dd>
500 reference to the changed rule (AdBlockRule)
501 </dd>
502 </dl><a NAME="AdBlockSubscription.setTitle" ID="AdBlockSubscription.setTitle"></a>
503 <h4>AdBlockSubscription.setTitle</h4>
504 <b>setTitle</b>(<i>title</i>)
505 <p>
506 Public method to set the subscription title.
507 </p><dl>
508 <dt><i>title</i></dt>
509 <dd>
510 subscription title (string)
511 </dd>
512 </dl><a NAME="AdBlockSubscription.title" ID="AdBlockSubscription.title"></a>
513 <h4>AdBlockSubscription.title</h4>
514 <b>title</b>(<i></i>)
515 <p>
516 Public method to get the subscription title.
517 </p><dl>
518 <dt>Returns:</dt>
519 <dd>
520 subscription title (string)
521 </dd>
522 </dl><a NAME="AdBlockSubscription.updateNow" ID="AdBlockSubscription.updateNow"></a>
523 <h4>AdBlockSubscription.updateNow</h4>
524 <b>updateNow</b>(<i></i>)
525 <p>
526 Public method to update the subscription immediately.
527 </p><a NAME="AdBlockSubscription.url" ID="AdBlockSubscription.url"></a>
528 <h4>AdBlockSubscription.url</h4>
529 <b>url</b>(<i></i>)
530 <p>
531 Public method to generate the URL for this subscription.
532 </p><dl>
533 <dt>Returns:</dt>
534 <dd>
535 AdBlock URL for the subscription (QUrl)
536 </dd>
537 </dl>
538 <div align="right"><a href="#top">Up</a></div>
539 <hr />
540 </body></html>

eric ide

mercurial