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

changeset 4918
71caf42a13d8
child 4990
2bca10fcfe80
equal deleted inserted replaced
4917:682750cc7bd5 4918:71caf42a13d8
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.WebBrowser.AdBlock.AdBlockManager</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.AdBlockManager</h1>
23 <p>
24 Module implementing the AdBlock manager.
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="#AdBlockManager">AdBlockManager</a></td>
34 <td>Class implementing the AdBlock manager.</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="AdBlockManager" ID="AdBlockManager"></a>
43 <h2>AdBlockManager</h2>
44 <p>
45 Class implementing the AdBlock manager.
46 </p><h3>Signals</h3>
47 <dl>
48 <dt>rulesChanged()</dt>
49 <dd>
50 emitted after some rule has changed
51 </dd>
52 </dl>
53 <h3>Derived from</h3>
54 QObject
55 <h3>Class Attributes</h3>
56 <table>
57 <tr><td>None</td></tr>
58 </table>
59 <h3>Class Methods</h3>
60 <table>
61 <tr><td>None</td></tr>
62 </table>
63 <h3>Methods</h3>
64 <table>
65 <tr>
66 <td><a href="#AdBlockManager.__init__">AdBlockManager</a></td>
67 <td>Constructor</td>
68 </tr><tr>
69 <td><a href="#AdBlockManager.__canRunOnScheme">__canRunOnScheme</a></td>
70 <td>Private method to check, if AdBlock can be performed on the scheme.</td>
71 </tr><tr>
72 <td><a href="#AdBlockManager.__customSubscriptionLocation">__customSubscriptionLocation</a></td>
73 <td>Private method to generate the path for custom subscriptions.</td>
74 </tr><tr>
75 <td><a href="#AdBlockManager.__customSubscriptionUrl">__customSubscriptionUrl</a></td>
76 <td>Private method to generate the URL for custom subscriptions.</td>
77 </tr><tr>
78 <td><a href="#AdBlockManager.__loadSubscriptions">__loadSubscriptions</a></td>
79 <td>Private method to load the set of subscriptions.</td>
80 </tr><tr>
81 <td><a href="#AdBlockManager.__rulesChanged">__rulesChanged</a></td>
82 <td>Private slot handling a change of the AdBlock rules.</td>
83 </tr><tr>
84 <td><a href="#AdBlockManager.addException">addException</a></td>
85 <td>Public method to add an exception.</td>
86 </tr><tr>
87 <td><a href="#AdBlockManager.addSubscription">addSubscription</a></td>
88 <td>Public method to add an AdBlock subscription.</td>
89 </tr><tr>
90 <td><a href="#AdBlockManager.addSubscriptionFromUrl">addSubscriptionFromUrl</a></td>
91 <td>Public method to ad an AdBlock subscription given the abp URL.</td>
92 </tr><tr>
93 <td><a href="#AdBlockManager.block">block</a></td>
94 <td>Public method to check, if a request should be blocked.</td>
95 </tr><tr>
96 <td><a href="#AdBlockManager.close">close</a></td>
97 <td>Public method to close the open search engines manager.</td>
98 </tr><tr>
99 <td><a href="#AdBlockManager.customRules">customRules</a></td>
100 <td>Public method to get a subscription for custom rules.</td>
101 </tr><tr>
102 <td><a href="#AdBlockManager.elementHidingRules">elementHidingRules</a></td>
103 <td>Public method to get the element hiding rules.</td>
104 </tr><tr>
105 <td><a href="#AdBlockManager.elementHidingRulesForDomain">elementHidingRulesForDomain</a></td>
106 <td>Public method to get the element hiding rules for a domain.</td>
107 </tr><tr>
108 <td><a href="#AdBlockManager.exceptions">exceptions</a></td>
109 <td>Public method to get a list of excepted hosts.</td>
110 </tr><tr>
111 <td><a href="#AdBlockManager.getDefaultSubscriptionUrl">getDefaultSubscriptionUrl</a></td>
112 <td>Public method to get the default subscription URL.</td>
113 </tr><tr>
114 <td><a href="#AdBlockManager.getRequiresSubscriptions">getRequiresSubscriptions</a></td>
115 <td>Public method to get a list of subscriptions, that require the given one.</td>
116 </tr><tr>
117 <td><a href="#AdBlockManager.isEnabled">isEnabled</a></td>
118 <td>Public method to check, if blocking ads is enabled.</td>
119 </tr><tr>
120 <td><a href="#AdBlockManager.isHostExcepted">isHostExcepted</a></td>
121 <td>Public slot to check, if a host is excepted.</td>
122 </tr><tr>
123 <td><a href="#AdBlockManager.load">load</a></td>
124 <td>Public method to load the AdBlock subscriptions.</td>
125 </tr><tr>
126 <td><a href="#AdBlockManager.loadRequiredSubscription">loadRequiredSubscription</a></td>
127 <td>Public method to load a subscription required by another one.</td>
128 </tr><tr>
129 <td><a href="#AdBlockManager.page">page</a></td>
130 <td>Public method to get a reference to the page block object.</td>
131 </tr><tr>
132 <td><a href="#AdBlockManager.removeException">removeException</a></td>
133 <td>Public method to remove an exception.</td>
134 </tr><tr>
135 <td><a href="#AdBlockManager.removeSubscription">removeSubscription</a></td>
136 <td>Public method to remove an AdBlock subscription.</td>
137 </tr><tr>
138 <td><a href="#AdBlockManager.save">save</a></td>
139 <td>Public method to save the AdBlock subscriptions.</td>
140 </tr><tr>
141 <td><a href="#AdBlockManager.setEnabled">setEnabled</a></td>
142 <td>Public slot to set the enabled state.</td>
143 </tr><tr>
144 <td><a href="#AdBlockManager.setExceptions">setExceptions</a></td>
145 <td>Public method to set the list of excepted hosts.</td>
146 </tr><tr>
147 <td><a href="#AdBlockManager.setUseLimitedEasyList">setUseLimitedEasyList</a></td>
148 <td>Public method to set the limited EasyList flag.</td>
149 </tr><tr>
150 <td><a href="#AdBlockManager.showDialog">showDialog</a></td>
151 <td>Public slot to show the AdBlock subscription management dialog.</td>
152 </tr><tr>
153 <td><a href="#AdBlockManager.showExceptionsDialog">showExceptionsDialog</a></td>
154 <td>Public method to show the AdBlock Exceptions dialog.</td>
155 </tr><tr>
156 <td><a href="#AdBlockManager.subscription">subscription</a></td>
157 <td>Public method to get a subscription based on its location.</td>
158 </tr><tr>
159 <td><a href="#AdBlockManager.subscriptions">subscriptions</a></td>
160 <td>Public method to get all subscriptions.</td>
161 </tr><tr>
162 <td><a href="#AdBlockManager.updateAllSubscriptions">updateAllSubscriptions</a></td>
163 <td>Public method to update all subscriptions.</td>
164 </tr><tr>
165 <td><a href="#AdBlockManager.useLimitedEasyList">useLimitedEasyList</a></td>
166 <td>Public method to test, if limited EasyList rules shall be used.</td>
167 </tr>
168 </table>
169 <h3>Static Methods</h3>
170 <table>
171 <tr><td>None</td></tr>
172 </table>
173 <a NAME="AdBlockManager.__init__" ID="AdBlockManager.__init__"></a>
174 <h4>AdBlockManager (Constructor)</h4>
175 <b>AdBlockManager</b>(<i>parent=None</i>)
176 <p>
177 Constructor
178 </p><dl>
179 <dt><i>parent</i></dt>
180 <dd>
181 reference to the parent object (QObject)
182 </dd>
183 </dl><a NAME="AdBlockManager.__canRunOnScheme" ID="AdBlockManager.__canRunOnScheme"></a>
184 <h4>AdBlockManager.__canRunOnScheme</h4>
185 <b>__canRunOnScheme</b>(<i>scheme</i>)
186 <p>
187 Private method to check, if AdBlock can be performed on the scheme.
188 </p><dl>
189 <dt><i>scheme</i></dt>
190 <dd>
191 scheme to check (string)
192 </dd>
193 </dl><dl>
194 <dt>Returns:</dt>
195 <dd>
196 flag indicating, that AdBlock can be performed (boolean)
197 </dd>
198 </dl><a NAME="AdBlockManager.__customSubscriptionLocation" ID="AdBlockManager.__customSubscriptionLocation"></a>
199 <h4>AdBlockManager.__customSubscriptionLocation</h4>
200 <b>__customSubscriptionLocation</b>(<i></i>)
201 <p>
202 Private method to generate the path for custom subscriptions.
203 </p><dl>
204 <dt>Returns:</dt>
205 <dd>
206 URL for custom subscriptions (QUrl)
207 </dd>
208 </dl><a NAME="AdBlockManager.__customSubscriptionUrl" ID="AdBlockManager.__customSubscriptionUrl"></a>
209 <h4>AdBlockManager.__customSubscriptionUrl</h4>
210 <b>__customSubscriptionUrl</b>(<i></i>)
211 <p>
212 Private method to generate the URL for custom subscriptions.
213 </p><dl>
214 <dt>Returns:</dt>
215 <dd>
216 URL for custom subscriptions (QUrl)
217 </dd>
218 </dl><a NAME="AdBlockManager.__loadSubscriptions" ID="AdBlockManager.__loadSubscriptions"></a>
219 <h4>AdBlockManager.__loadSubscriptions</h4>
220 <b>__loadSubscriptions</b>(<i></i>)
221 <p>
222 Private method to load the set of subscriptions.
223 </p><a NAME="AdBlockManager.__rulesChanged" ID="AdBlockManager.__rulesChanged"></a>
224 <h4>AdBlockManager.__rulesChanged</h4>
225 <b>__rulesChanged</b>(<i></i>)
226 <p>
227 Private slot handling a change of the AdBlock rules.
228 </p><a NAME="AdBlockManager.addException" ID="AdBlockManager.addException"></a>
229 <h4>AdBlockManager.addException</h4>
230 <b>addException</b>(<i>host</i>)
231 <p>
232 Public method to add an exception.
233 </p><dl>
234 <dt><i>host</i></dt>
235 <dd>
236 to be excepted (string)
237 </dd>
238 </dl><a NAME="AdBlockManager.addSubscription" ID="AdBlockManager.addSubscription"></a>
239 <h4>AdBlockManager.addSubscription</h4>
240 <b>addSubscription</b>(<i>subscription</i>)
241 <p>
242 Public method to add an AdBlock subscription.
243 </p><dl>
244 <dt><i>subscription</i></dt>
245 <dd>
246 AdBlock subscription to be added
247 (AdBlockSubscription)
248 </dd>
249 </dl><a NAME="AdBlockManager.addSubscriptionFromUrl" ID="AdBlockManager.addSubscriptionFromUrl"></a>
250 <h4>AdBlockManager.addSubscriptionFromUrl</h4>
251 <b>addSubscriptionFromUrl</b>(<i>url</i>)
252 <p>
253 Public method to ad an AdBlock subscription given the abp URL.
254 </p><dl>
255 <dt><i>url</i> (QUrl)</dt>
256 <dd>
257 URL to subscribe an AdBlock subscription
258 </dd>
259 </dl><dl>
260 <dt>Returns:</dt>
261 <dd>
262 flag indicating success
263 </dd>
264 </dl><dl>
265 <dt>Return Type:</dt>
266 <dd>
267 bool
268 </dd>
269 </dl><a NAME="AdBlockManager.block" ID="AdBlockManager.block"></a>
270 <h4>AdBlockManager.block</h4>
271 <b>block</b>(<i>info</i>)
272 <p>
273 Public method to check, if a request should be blocked.
274 </p><dl>
275 <dt><i>info</i> (QWebEngineUrlRequestInfo)</dt>
276 <dd>
277 request info aobject
278 </dd>
279 </dl><dl>
280 <dt>Returns:</dt>
281 <dd>
282 flag indicating to block the request
283 </dd>
284 </dl><dl>
285 <dt>Return Type:</dt>
286 <dd>
287 bool
288 </dd>
289 </dl><a NAME="AdBlockManager.close" ID="AdBlockManager.close"></a>
290 <h4>AdBlockManager.close</h4>
291 <b>close</b>(<i></i>)
292 <p>
293 Public method to close the open search engines manager.
294 </p><a NAME="AdBlockManager.customRules" ID="AdBlockManager.customRules"></a>
295 <h4>AdBlockManager.customRules</h4>
296 <b>customRules</b>(<i></i>)
297 <p>
298 Public method to get a subscription for custom rules.
299 </p><dl>
300 <dt>Returns:</dt>
301 <dd>
302 subscription object for custom rules (AdBlockSubscription)
303 </dd>
304 </dl><a NAME="AdBlockManager.elementHidingRules" ID="AdBlockManager.elementHidingRules"></a>
305 <h4>AdBlockManager.elementHidingRules</h4>
306 <b>elementHidingRules</b>(<i></i>)
307 <p>
308 Public method to get the element hiding rules.
309 </p><dl>
310 <dt>Returns:</dt>
311 <dd>
312 element hiding rules (string)
313 </dd>
314 </dl><a NAME="AdBlockManager.elementHidingRulesForDomain" ID="AdBlockManager.elementHidingRulesForDomain"></a>
315 <h4>AdBlockManager.elementHidingRulesForDomain</h4>
316 <b>elementHidingRulesForDomain</b>(<i>url</i>)
317 <p>
318 Public method to get the element hiding rules for a domain.
319 </p><dl>
320 <dt><i>url</i></dt>
321 <dd>
322 URL to get hiding rules for (QUrl)
323 </dd>
324 </dl><dl>
325 <dt>Returns:</dt>
326 <dd>
327 element hiding rules (string)
328 </dd>
329 </dl><a NAME="AdBlockManager.exceptions" ID="AdBlockManager.exceptions"></a>
330 <h4>AdBlockManager.exceptions</h4>
331 <b>exceptions</b>(<i></i>)
332 <p>
333 Public method to get a list of excepted hosts.
334 </p><dl>
335 <dt>Returns:</dt>
336 <dd>
337 list of excepted hosts (list of string)
338 </dd>
339 </dl><a NAME="AdBlockManager.getDefaultSubscriptionUrl" ID="AdBlockManager.getDefaultSubscriptionUrl"></a>
340 <h4>AdBlockManager.getDefaultSubscriptionUrl</h4>
341 <b>getDefaultSubscriptionUrl</b>(<i></i>)
342 <p>
343 Public method to get the default subscription URL.
344 </p><dl>
345 <dt>Returns:</dt>
346 <dd>
347 default subscription URL
348 </dd>
349 </dl><dl>
350 <dt>Return Type:</dt>
351 <dd>
352 str
353 </dd>
354 </dl><a NAME="AdBlockManager.getRequiresSubscriptions" ID="AdBlockManager.getRequiresSubscriptions"></a>
355 <h4>AdBlockManager.getRequiresSubscriptions</h4>
356 <b>getRequiresSubscriptions</b>(<i>subscription</i>)
357 <p>
358 Public method to get a list of subscriptions, that require the given
359 one.
360 </p><dl>
361 <dt><i>subscription</i></dt>
362 <dd>
363 subscription to check for (AdBlockSubscription)
364 </dd>
365 </dl><dl>
366 <dt>Returns:</dt>
367 <dd>
368 list of subscription requiring the given one (list of
369 AdBlockSubscription)
370 </dd>
371 </dl><a NAME="AdBlockManager.isEnabled" ID="AdBlockManager.isEnabled"></a>
372 <h4>AdBlockManager.isEnabled</h4>
373 <b>isEnabled</b>(<i></i>)
374 <p>
375 Public method to check, if blocking ads is enabled.
376 </p><dl>
377 <dt>Returns:</dt>
378 <dd>
379 flag indicating the enabled state (boolean)
380 </dd>
381 </dl><a NAME="AdBlockManager.isHostExcepted" ID="AdBlockManager.isHostExcepted"></a>
382 <h4>AdBlockManager.isHostExcepted</h4>
383 <b>isHostExcepted</b>(<i>host</i>)
384 <p>
385 Public slot to check, if a host is excepted.
386 </p><dl>
387 <dt><i>host</i></dt>
388 <dd>
389 host to check (string)
390 </dd>
391 </dl><dl>
392 <dt>Returns:</dt>
393 <dd>
394 flag indicating an exception (boolean)
395 </dd>
396 </dl><a NAME="AdBlockManager.load" ID="AdBlockManager.load"></a>
397 <h4>AdBlockManager.load</h4>
398 <b>load</b>(<i></i>)
399 <p>
400 Public method to load the AdBlock subscriptions.
401 </p><a NAME="AdBlockManager.loadRequiredSubscription" ID="AdBlockManager.loadRequiredSubscription"></a>
402 <h4>AdBlockManager.loadRequiredSubscription</h4>
403 <b>loadRequiredSubscription</b>(<i>location, title</i>)
404 <p>
405 Public method to load a subscription required by another one.
406 </p><dl>
407 <dt><i>location</i></dt>
408 <dd>
409 location of the required subscription (string)
410 </dd><dt><i>title</i></dt>
411 <dd>
412 title of the required subscription (string)
413 </dd>
414 </dl><a NAME="AdBlockManager.page" ID="AdBlockManager.page"></a>
415 <h4>AdBlockManager.page</h4>
416 <b>page</b>(<i></i>)
417 <p>
418 Public method to get a reference to the page block object.
419 </p><dl>
420 <dt>Returns:</dt>
421 <dd>
422 reference to the page block object (AdBlockPage)
423 </dd>
424 </dl><a NAME="AdBlockManager.removeException" ID="AdBlockManager.removeException"></a>
425 <h4>AdBlockManager.removeException</h4>
426 <b>removeException</b>(<i>host</i>)
427 <p>
428 Public method to remove an exception.
429 </p><dl>
430 <dt><i>host</i></dt>
431 <dd>
432 to be removed from the list of exceptions (string)
433 </dd>
434 </dl><a NAME="AdBlockManager.removeSubscription" ID="AdBlockManager.removeSubscription"></a>
435 <h4>AdBlockManager.removeSubscription</h4>
436 <b>removeSubscription</b>(<i>subscription, emitSignal=True</i>)
437 <p>
438 Public method to remove an AdBlock subscription.
439 </p><dl>
440 <dt><i>subscription</i></dt>
441 <dd>
442 AdBlock subscription to be removed
443 (AdBlockSubscription)
444 </dd><dt><i>emitSignal</i></dt>
445 <dd>
446 flag indicating to send a signal (boolean)
447 </dd>
448 </dl><a NAME="AdBlockManager.save" ID="AdBlockManager.save"></a>
449 <h4>AdBlockManager.save</h4>
450 <b>save</b>(<i></i>)
451 <p>
452 Public method to save the AdBlock subscriptions.
453 </p><a NAME="AdBlockManager.setEnabled" ID="AdBlockManager.setEnabled"></a>
454 <h4>AdBlockManager.setEnabled</h4>
455 <b>setEnabled</b>(<i>enabled</i>)
456 <p>
457 Public slot to set the enabled state.
458 </p><dl>
459 <dt><i>enabled</i></dt>
460 <dd>
461 flag indicating the enabled state (boolean)
462 </dd>
463 </dl><a NAME="AdBlockManager.setExceptions" ID="AdBlockManager.setExceptions"></a>
464 <h4>AdBlockManager.setExceptions</h4>
465 <b>setExceptions</b>(<i>hosts</i>)
466 <p>
467 Public method to set the list of excepted hosts.
468 </p><dl>
469 <dt><i>hosts</i></dt>
470 <dd>
471 list of excepted hosts (list of string)
472 </dd>
473 </dl><a NAME="AdBlockManager.setUseLimitedEasyList" ID="AdBlockManager.setUseLimitedEasyList"></a>
474 <h4>AdBlockManager.setUseLimitedEasyList</h4>
475 <b>setUseLimitedEasyList</b>(<i>limited</i>)
476 <p>
477 Public method to set the limited EasyList flag.
478 </p><dl>
479 <dt><i>limited</i> (bool)</dt>
480 <dd>
481 flag indicating to use limited EasyList
482 </dd>
483 </dl><a NAME="AdBlockManager.showDialog" ID="AdBlockManager.showDialog"></a>
484 <h4>AdBlockManager.showDialog</h4>
485 <b>showDialog</b>(<i></i>)
486 <p>
487 Public slot to show the AdBlock subscription management dialog.
488 </p><dl>
489 <dt>Returns:</dt>
490 <dd>
491 reference to the dialog (AdBlockDialog)
492 </dd>
493 </dl><a NAME="AdBlockManager.showExceptionsDialog" ID="AdBlockManager.showExceptionsDialog"></a>
494 <h4>AdBlockManager.showExceptionsDialog</h4>
495 <b>showExceptionsDialog</b>(<i></i>)
496 <p>
497 Public method to show the AdBlock Exceptions dialog.
498 </p><dl>
499 <dt>Returns:</dt>
500 <dd>
501 reference to the exceptions dialog (AdBlockExceptionsDialog)
502 </dd>
503 </dl><a NAME="AdBlockManager.subscription" ID="AdBlockManager.subscription"></a>
504 <h4>AdBlockManager.subscription</h4>
505 <b>subscription</b>(<i>location</i>)
506 <p>
507 Public method to get a subscription based on its location.
508 </p><dl>
509 <dt><i>location</i></dt>
510 <dd>
511 location of the subscription to search for (string)
512 </dd>
513 </dl><dl>
514 <dt>Returns:</dt>
515 <dd>
516 subscription or None (AdBlockSubscription)
517 </dd>
518 </dl><a NAME="AdBlockManager.subscriptions" ID="AdBlockManager.subscriptions"></a>
519 <h4>AdBlockManager.subscriptions</h4>
520 <b>subscriptions</b>(<i></i>)
521 <p>
522 Public method to get all subscriptions.
523 </p><dl>
524 <dt>Returns:</dt>
525 <dd>
526 list of subscriptions (list of AdBlockSubscription)
527 </dd>
528 </dl><a NAME="AdBlockManager.updateAllSubscriptions" ID="AdBlockManager.updateAllSubscriptions"></a>
529 <h4>AdBlockManager.updateAllSubscriptions</h4>
530 <b>updateAllSubscriptions</b>(<i></i>)
531 <p>
532 Public method to update all subscriptions.
533 </p><a NAME="AdBlockManager.useLimitedEasyList" ID="AdBlockManager.useLimitedEasyList"></a>
534 <h4>AdBlockManager.useLimitedEasyList</h4>
535 <b>useLimitedEasyList</b>(<i></i>)
536 <p>
537 Public method to test, if limited EasyList rules shall be used.
538 </p><dl>
539 <dt>Returns:</dt>
540 <dd>
541 flag indicating limited EasyList rules
542 </dd>
543 </dl><dl>
544 <dt>Return Type:</dt>
545 <dd>
546 bool
547 </dd>
548 </dl>
549 <div align="right"><a href="#top">Up</a></div>
550 <hr />
551 </body></html>

eric ide

mercurial