5 |
5 |
6 """ |
6 """ |
7 Module implementing the AdBlock manager. |
7 Module implementing the AdBlock manager. |
8 """ |
8 """ |
9 |
9 |
|
10 import contextlib |
10 import os |
11 import os |
11 import contextlib |
12 |
12 |
13 from PyQt6.QtCore import QByteArray, QMutex, QObject, QUrl, QUrlQuery, pyqtSignal |
13 from PyQt6.QtCore import pyqtSignal, QObject, QUrl, QUrlQuery, QByteArray, QMutex |
|
14 from PyQt6.QtWebEngineCore import QWebEngineUrlRequestInfo |
14 from PyQt6.QtWebEngineCore import QWebEngineUrlRequestInfo |
15 |
15 |
|
16 from eric7 import Preferences, Utilities |
|
17 from eric7.EricUtilities.EricMutexLocker import EricMutexLocker |
16 from eric7.EricWidgets import EricMessageBox |
18 from eric7.EricWidgets import EricMessageBox |
17 |
19 from eric7.Utilities.AutoSaver import AutoSaver |
18 from eric7.EricUtilities.EricMutexLocker import EricMutexLocker |
20 |
19 |
21 from .AdBlockMatcher import AdBlockMatcher |
20 from .AdBlockSubscription import AdBlockSubscription |
22 from .AdBlockSubscription import AdBlockSubscription |
21 from .AdBlockUrlInterceptor import AdBlockUrlInterceptor |
23 from .AdBlockUrlInterceptor import AdBlockUrlInterceptor |
22 from .AdBlockMatcher import AdBlockMatcher |
|
23 |
|
24 from eric7.Utilities.AutoSaver import AutoSaver |
|
25 from eric7 import Preferences, Utilities |
|
26 |
24 |
27 |
25 |
28 class AdBlockManager(QObject): |
26 class AdBlockManager(QObject): |
29 """ |
27 """ |
30 Class implementing the AdBlock manager. |
28 Class implementing the AdBlock manager. |
345 self.tr( |
343 self.tr( |
346 """<p>Subscribe to this AdBlock subscription?</p>""" """<p>{0}</p>""" |
344 """<p>Subscribe to this AdBlock subscription?</p>""" """<p>{0}</p>""" |
347 ).format(title), |
345 ).format(title), |
348 ) |
346 ) |
349 if res: |
347 if res: |
|
348 from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow |
|
349 |
350 from .AdBlockSubscription import AdBlockSubscription |
350 from .AdBlockSubscription import AdBlockSubscription |
351 from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow |
|
352 |
351 |
353 dlg = WebBrowserWindow.adBlockManager().showDialog() |
352 dlg = WebBrowserWindow.adBlockManager().showDialog() |
354 subscription = AdBlockSubscription( |
353 subscription = AdBlockSubscription( |
355 url, False, WebBrowserWindow.adBlockManager() |
354 url, False, WebBrowserWindow.adBlockManager() |
356 ) |
355 ) |