eric6/WebBrowser/AdBlock/AdBlockDialog.py

Sat, 27 Feb 2021 12:08:23 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Feb 2021 12:08:23 +0100
changeset 8138
169e65a6787c
parent 7923
91e843545d9a
child 8143
2c730d5fd177
permissions
-rw-r--r--

Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7781
diff changeset
3 # Copyright (c) 2009 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the AdBlock configuration dialog.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
4278
ccd1e13cb9bd Fixed issues where dialogs could not be minimized on some desktop environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
10 from PyQt5.QtCore import pyqtSlot, Qt, QTimer, QCoreApplication
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
11 from PyQt5.QtWidgets import QDialog, QMenu, QToolButton
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
13 from E5Gui import E5MessageBox
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
15 from .Ui_AdBlockDialog import Ui_AdBlockDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 import UI.PixmapCache
1854
191efdc54c62 Made the AdBlock update period configurable between 1 and 14 days.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1649
diff changeset
18 import Preferences
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
20
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 class AdBlockDialog(QDialog, Ui_AdBlockDialog):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 Class implementing the AdBlock configuration dialog.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 """
4859
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
25 def __init__(self, manager, parent=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 Constructor
2953
703452a2876f Started correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
28
6028
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
29 @param manager reference to the AdBlock manager
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
30 @type AdBlockManager
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
31 @param parent reference to the parent object
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
32 @type QWidget
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2403
diff changeset
34 super(AdBlockDialog, self).__init__(parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 self.setupUi(self)
4278
ccd1e13cb9bd Fixed issues where dialogs could not be minimized on some desktop environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
36 self.setWindowFlags(Qt.Window)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37
4859
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
38 self.__manager = manager
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
39
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
40 self.iconLabel.setPixmap(UI.PixmapCache.getPixmap("adBlockPlus48"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41
4859
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
42 self.updateSpinBox.setValue(
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
43 Preferences.getWebBrowser("AdBlockUpdatePeriod"))
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
44
4860
0a44aff88bfa Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
45 self.useLimitedEasyListCheckBox.setChecked(Preferences.getWebBrowser(
0a44aff88bfa Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
46 "AdBlockUseLimitedEasyList"))
1854
191efdc54c62 Made the AdBlock update period configurable between 1 and 14 days.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1649
diff changeset
47
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
48 self.searchEdit.setInactiveText(self.tr("Search..."))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
50 self.adBlockGroup.setChecked(self.__manager.isEnabled())
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
51 self.__manager.requiredSubscriptionLoaded.connect(self.addSubscription)
6028
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
52 self.__manager.enabledChanged.connect(self.__managerEnabledChanged)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
54 self.__currentTreeWidget = None
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
55 self.__currentSubscription = None
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
56 self.__loaded = False
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 menu = QMenu(self)
461
34528aaedf1c Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 134
diff changeset
59 menu.aboutToShow.connect(self.__aboutToShowActionMenu)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 self.actionButton.setMenu(menu)
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
61 self.actionButton.setIcon(UI.PixmapCache.getIcon("adBlockAction"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 self.actionButton.setPopupMode(QToolButton.InstantPopup)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
64 self.__load()
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
65
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
66 self.buttonBox.setFocus()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
68 def __loadSubscriptions(self):
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
69 """
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
70 Private slot to load the AdBlock subscription rules.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 """
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
72 for index in range(self.subscriptionsTabWidget.count()):
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
73 tree = self.subscriptionsTabWidget.widget(index)
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
74 tree.refresh()
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
75
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
76 def __load(self):
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
77 """
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
78 Private slot to populate the tab widget with subscriptions.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 """
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
80 if self.__loaded or not self.adBlockGroup.isChecked():
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
81 return
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
82
2403
e3d7a861547c Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
83 from .AdBlockTreeWidget import AdBlockTreeWidget
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
84 for subscription in self.__manager.subscriptions():
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
85 tree = AdBlockTreeWidget(subscription, self.subscriptionsTabWidget)
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
86 if subscription.isEnabled():
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
87 icon = UI.PixmapCache.getIcon("adBlockPlus")
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
88 else:
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
89 icon = UI.PixmapCache.getIcon("adBlockPlusDisabled")
3000
971d84f7a6d6 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
90 self.subscriptionsTabWidget.addTab(
971d84f7a6d6 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
91 tree, icon, subscription.title())
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
92
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
93 self.__loaded = True
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
94 QCoreApplication.processEvents()
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
95
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
96 QTimer.singleShot(50, self.__loadSubscriptions)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
98 def addSubscription(self, subscription, refresh=True):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 """
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
100 Public slot adding a subscription to the list.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
102 @param subscription reference to the subscription to be
6028
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
103 added
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
104 @type AdBlockSubscription
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
105 @param refresh flag indicating to refresh the tree
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
106 @type bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 """
2403
e3d7a861547c Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
108 from .AdBlockTreeWidget import AdBlockTreeWidget
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
109 tree = AdBlockTreeWidget(subscription, self.subscriptionsTabWidget)
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
110 index = self.subscriptionsTabWidget.insertTab(
3000
971d84f7a6d6 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
111 self.subscriptionsTabWidget.count() - 1, tree,
971d84f7a6d6 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
112 subscription.title())
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
113 self.subscriptionsTabWidget.setCurrentIndex(index)
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
114 QCoreApplication.processEvents()
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
115 if refresh:
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
116 tree.refresh()
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
117 self.__setSubscriptionEnabled(subscription, True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 def __aboutToShowActionMenu(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 Private slot to show the actions menu.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 """
7268
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
123 subscriptionEditable = (
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
124 self.__currentSubscription and
3035
36e9f388958b Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3022
diff changeset
125 self.__currentSubscription.canEditRules()
7268
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
126 )
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
127 subscriptionRemovable = (
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
128 self.__currentSubscription and
3035
36e9f388958b Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3022
diff changeset
129 self.__currentSubscription.canBeRemoved()
7268
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
130 )
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
131 subscriptionEnabled = (
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
132 self.__currentSubscription and
3035
36e9f388958b Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3022
diff changeset
133 self.__currentSubscription.isEnabled()
7268
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
134 )
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
135
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 menu = self.actionButton.menu()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 menu.clear()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138
7268
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
139 menu.addAction(
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
140 self.tr("Add Rule"), self.__addCustomRule
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
141 ).setEnabled(subscriptionEditable)
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
142 menu.addAction(
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
143 self.tr("Remove Rule"), self.__removeCustomRule
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
144 ).setEnabled(subscriptionEditable)
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
145 menu.addSeparator()
3000
971d84f7a6d6 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
146 menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
147 self.tr("Browse Subscriptions..."), self.__browseSubscriptions)
3000
971d84f7a6d6 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
148 menu.addAction(
7268
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
149 self.tr("Remove Subscription"), self.__removeSubscription
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
150 ).setEnabled(subscriptionRemovable)
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
151 if self.__currentSubscription:
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
152 menu.addSeparator()
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
153 if subscriptionEnabled:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
154 txt = self.tr("Disable Subscription")
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
155 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
156 txt = self.tr("Enable Subscription")
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
157 menu.addAction(txt, self.__switchSubscriptionEnabled)
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
158 menu.addSeparator()
3000
971d84f7a6d6 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
159 menu.addAction(
7268
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
160 self.tr("Update Subscription"), self.__updateSubscription
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
161 ).setEnabled(not subscriptionEditable)
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
162 menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
163 self.tr("Update All Subscriptions"),
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
164 self.__updateAllSubscriptions)
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
165 menu.addSeparator()
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
166 menu.addAction(self.tr("Learn more about writing rules..."),
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 self.__learnAboutWritingFilters)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168
5605
1950fe1a32c4 Finished fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
169 def addCustomRule(self, filterRule):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170 """
1972
5341662d6cfb Added support for AdBlock exceptions to the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1970
diff changeset
171 Public slot to add a custom AdBlock rule.
1973
c643c1d33c7b Fixed an issue in the new AdBlock code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1972
diff changeset
172
6028
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
173 @param filterRule filter to be added
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
174 @type string
1973
c643c1d33c7b Fixed an issue in the new AdBlock code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1972
diff changeset
175 """
c643c1d33c7b Fixed an issue in the new AdBlock code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1972
diff changeset
176 self.subscriptionsTabWidget.setCurrentIndex(
c643c1d33c7b Fixed an issue in the new AdBlock code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1972
diff changeset
177 self.subscriptionsTabWidget.count() - 1)
5605
1950fe1a32c4 Finished fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
178 self.__currentTreeWidget.addRule(filterRule)
1973
c643c1d33c7b Fixed an issue in the new AdBlock code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1972
diff changeset
179
c643c1d33c7b Fixed an issue in the new AdBlock code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1972
diff changeset
180 def __addCustomRule(self):
c643c1d33c7b Fixed an issue in the new AdBlock code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1972
diff changeset
181 """
c643c1d33c7b Fixed an issue in the new AdBlock code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1972
diff changeset
182 Private slot to add a custom AdBlock rule.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183 """
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
184 self.__currentTreeWidget.addRule()
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
185
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
186 def __removeCustomRule(self):
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
187 """
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
188 Private slot to remove a custom AdBlock rule.
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
189 """
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
190 self.__currentTreeWidget.removeRule()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 def __updateSubscription(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 Private slot to update the selected subscription.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 """
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
196 self.__currentSubscription.updateNow()
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
197
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
198 def __updateAllSubscriptions(self):
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
199 """
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
200 Private slot to update all subscriptions.
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
201 """
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
202 self.__manager.updateAllSubscriptions()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 def __browseSubscriptions(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206 Private slot to browse the list of available AdBlock subscriptions.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 """
4858
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
208 from WebBrowser.WebBrowserWindow import WebBrowserWindow
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
209 mw = WebBrowserWindow.mainWindow()
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
210 mw.newTab("http://adblockplus.org/en/subscriptions")
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
211 mw.raise_()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213 def __learnAboutWritingFilters(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215 Private slot to show the web page about how to write filters.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216 """
4858
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
217 from WebBrowser.WebBrowserWindow import WebBrowserWindow
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
218 mw = WebBrowserWindow.mainWindow()
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
219 mw.newTab("http://adblockplus.org/en/filters")
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
220 mw.raise_()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
222 def __removeSubscription(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 Private slot to remove the selected subscription.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
225 """
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
226 requiresTitles = []
7268
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
227 requiresSubscriptions = (
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
228 self.__manager.getRequiresSubscriptions(self.__currentSubscription)
7268
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
229 )
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
230 for subscription in requiresSubscriptions:
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
231 requiresTitles.append(subscription.title())
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
232 if requiresTitles:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
233 message = self.tr(
3000
971d84f7a6d6 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
234 "<p>Do you really want to remove subscription"
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
235 " <b>{0}</b> and all subscriptions requiring it?</p>"
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
236 "<ul><li>{1}</li></ul>").format(
3035
36e9f388958b Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3022
diff changeset
237 self.__currentSubscription.title(),
36e9f388958b Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3022
diff changeset
238 "</li><li>".join(requiresTitles))
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
239 else:
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
240 message = self.tr(
3000
971d84f7a6d6 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
241 "<p>Do you really want to remove subscription"
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
242 " <b>{0}</b>?</p>").format(self.__currentSubscription.title())
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3000
diff changeset
243 res = E5MessageBox.yesNo(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3000
diff changeset
244 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
245 self.tr("Remove Subscription"),
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
246 message)
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
247
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
248 if res:
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
249 removeSubscription = self.__currentSubscription
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
250 removeTrees = [self.__currentTreeWidget]
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
251 for index in range(self.subscriptionsTabWidget.count()):
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
252 tree = self.subscriptionsTabWidget.widget(index)
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
253 if tree.subscription() in requiresSubscriptions:
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
254 removeTrees.append(tree)
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
255 for tree in removeTrees:
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
256 self.subscriptionsTabWidget.removeTab(
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
257 self.subscriptionsTabWidget.indexOf(tree))
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
258 self.__manager.removeSubscription(removeSubscription)
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
259
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
260 def __switchSubscriptionEnabled(self):
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
261 """
2953
703452a2876f Started correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2403
diff changeset
262 Private slot to switch the enabled state of the selected subscription.
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
263 """
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
264 newState = not self.__currentSubscription.isEnabled()
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
265 self.__setSubscriptionEnabled(self.__currentSubscription, newState)
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
266
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
267 def __setSubscriptionEnabled(self, subscription, enable):
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
268 """
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
269 Private slot to set the enabled state of a subscription.
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
270
3000
971d84f7a6d6 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
271 @param subscription subscription to set the state for
6028
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
272 @type AdBlockSubscription
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
273 @param enable state to set to
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
274 @type bool
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
275 """
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
276 if enable:
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
277 # enable required one as well
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
278 sub = self.__manager.subscription(subscription.requiresLocation())
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
279 requiresSubscriptions = [] if sub is None else [sub]
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
280 icon = UI.PixmapCache.getIcon("adBlockPlus")
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
281 else:
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
282 # disable dependent ones as well
7268
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
283 requiresSubscriptions = (
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
284 self.__manager.getRequiresSubscriptions(subscription)
7268
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
285 )
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
286 icon = UI.PixmapCache.getIcon("adBlockPlusDisabled")
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
287 requiresSubscriptions.append(subscription)
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
288 for sub in requiresSubscriptions:
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
289 sub.setEnabled(enable)
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
290
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
291 for index in range(self.subscriptionsTabWidget.count()):
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
292 tree = self.subscriptionsTabWidget.widget(index)
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
293 if tree.subscription() in requiresSubscriptions:
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
294 self.subscriptionsTabWidget.setTabIcon(
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
295 self.subscriptionsTabWidget.indexOf(tree), icon)
1854
191efdc54c62 Made the AdBlock update period configurable between 1 and 14 days.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1649
diff changeset
296
191efdc54c62 Made the AdBlock update period configurable between 1 and 14 days.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1649
diff changeset
297 @pyqtSlot(int)
191efdc54c62 Made the AdBlock update period configurable between 1 and 14 days.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1649
diff changeset
298 def on_updateSpinBox_valueChanged(self, value):
191efdc54c62 Made the AdBlock update period configurable between 1 and 14 days.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1649
diff changeset
299 """
191efdc54c62 Made the AdBlock update period configurable between 1 and 14 days.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1649
diff changeset
300 Private slot to handle changes of the update period.
191efdc54c62 Made the AdBlock update period configurable between 1 and 14 days.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1649
diff changeset
301
6028
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
302 @param value update period
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
303 @type int
1854
191efdc54c62 Made the AdBlock update period configurable between 1 and 14 days.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1649
diff changeset
304 """
4858
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
305 if value != Preferences.getWebBrowser("AdBlockUpdatePeriod"):
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
306 Preferences.setWebBrowser("AdBlockUpdatePeriod", value)
1854
191efdc54c62 Made the AdBlock update period configurable between 1 and 14 days.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1649
diff changeset
307
4858
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
308 from WebBrowser.WebBrowserWindow import WebBrowserWindow
19dff9c9cf26 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
309 manager = WebBrowserWindow.adBlockManager()
1854
191efdc54c62 Made the AdBlock update period configurable between 1 and 14 days.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1649
diff changeset
310 for subscription in manager.subscriptions():
191efdc54c62 Made the AdBlock update period configurable between 1 and 14 days.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1649
diff changeset
311 subscription.checkForUpdate()
1963
9c5b3235abf9 Added an icon to the status bar to give direct access to AdBlock.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1854
diff changeset
312
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
313 @pyqtSlot(int)
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
314 def on_subscriptionsTabWidget_currentChanged(self, index):
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
315 """
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
316 Private slot handling the selection of another tab.
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
317
6028
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
318 @param index index of the new current tab
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
319 @type int
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
320 """
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
321 if index != -1:
7268
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
322 self.__currentTreeWidget = (
3000
971d84f7a6d6 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
323 self.subscriptionsTabWidget.widget(index)
7268
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
324 )
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
325 self.__currentSubscription = (
3000
971d84f7a6d6 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
326 self.__currentTreeWidget.subscription()
7268
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
327 )
4859
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
328
7268
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
329 isEasyList = (
4859
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
330 self.__currentSubscription.url().toString().startswith(
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
331 self.__manager.getDefaultSubscriptionUrl())
7268
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
332 )
4859
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
333 self.useLimitedEasyListCheckBox.setVisible(isEasyList)
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
334
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
335 @pyqtSlot(str)
5605
1950fe1a32c4 Finished fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
336 def on_searchEdit_textChanged(self, filterRule):
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
337 """
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
338 Private slot to set a new filter on the current widget.
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
339
6028
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
340 @param filterRule filter to be set
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
341 @type str
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
342 """
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
343 if self.__currentTreeWidget and self.adBlockGroup.isChecked():
5605
1950fe1a32c4 Finished fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
344 self.__currentTreeWidget.filterString(filterRule)
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
345
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
346 @pyqtSlot(bool)
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
347 def on_adBlockGroup_toggled(self, state):
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
348 """
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
349 Private slot handling the enabling/disabling of AdBlock.
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
350
6028
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
351 @param state state of the toggle
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
352 @type bool
1970
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
353 """
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
354 self.__manager.setEnabled(state)
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
355
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
356 if state:
02cf3bac079b Rewrote huge part of AdBlock to speed up and added support for dependent AdBlock subscriptions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1963
diff changeset
357 self.__load()
4859
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
358
4860
0a44aff88bfa Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
359 @pyqtSlot(bool)
0a44aff88bfa Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
360 def on_useLimitedEasyListCheckBox_clicked(self, checked):
4859
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
361 """
4860
0a44aff88bfa Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
362 Private slot handling the selection of the limited EasyList.
4859
36c4b21c9f7b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4858
diff changeset
363
4860
0a44aff88bfa Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
364 @param checked flag indicating the state of the check box
0a44aff88bfa Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
365 @type bool
0a44aff88bfa Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
366 """
0a44aff88bfa Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
367 self.__manager.setUseLimitedEasyList(
0a44aff88bfa Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4859
diff changeset
368 self.useLimitedEasyListCheckBox.isChecked())
6028
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
369
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
370 @pyqtSlot(bool)
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
371 def __managerEnabledChanged(self, enabled):
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
372 """
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
373 Private slot handling a change of the AdBlock manager enabled state.
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
374
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
375 @param enabled flag indicating the enabled state
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
376 @type bool
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
377 """
859f6894eed9 Reworked the AdBlock stuff of web browser NG.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5605
diff changeset
378 self.adBlockGroup.setChecked(enabled)

eric ide

mercurial