Helpviewer/AdBlock/AdBlockDialog.py

changeset 2403
e3d7a861547c
parent 2302
f29e9405c851
child 2525
8b507a9a2d40
child 2953
703452a2876f
equal deleted inserted replaced
2402:304fcefd3b04 2403:e3d7a861547c
10 from PyQt4.QtCore import pyqtSlot, QTimer, QCoreApplication 10 from PyQt4.QtCore import pyqtSlot, QTimer, QCoreApplication
11 from PyQt4.QtGui import QDialog, QMenu, QToolButton 11 from PyQt4.QtGui import QDialog, QMenu, QToolButton
12 12
13 from E5Gui import E5MessageBox 13 from E5Gui import E5MessageBox
14 14
15 import Helpviewer.HelpWindow
16
17 from .Ui_AdBlockDialog import Ui_AdBlockDialog 15 from .Ui_AdBlockDialog import Ui_AdBlockDialog
18
19 from .AdBlockTreeWidget import AdBlockTreeWidget
20 16
21 import UI.PixmapCache 17 import UI.PixmapCache
22 import Preferences 18 import Preferences
23 19
24 20
37 33
38 self.updateSpinBox.setValue(Preferences.getHelp("AdBlockUpdatePeriod")) 34 self.updateSpinBox.setValue(Preferences.getHelp("AdBlockUpdatePeriod"))
39 35
40 self.searchEdit.setInactiveText(self.trUtf8("Search...")) 36 self.searchEdit.setInactiveText(self.trUtf8("Search..."))
41 37
38 import Helpviewer.HelpWindow
42 self.__manager = Helpviewer.HelpWindow.HelpWindow.adBlockManager() 39 self.__manager = Helpviewer.HelpWindow.HelpWindow.adBlockManager()
43 self.adBlockGroup.setChecked(self.__manager.isEnabled()) 40 self.adBlockGroup.setChecked(self.__manager.isEnabled())
44 self.__manager.requiredSubscriptionLoaded.connect(self.addSubscription) 41 self.__manager.requiredSubscriptionLoaded.connect(self.addSubscription)
45 42
46 self.__currentTreeWidget = None 43 self.__currentTreeWidget = None
70 Private slot to populate the tab widget with subscriptions. 67 Private slot to populate the tab widget with subscriptions.
71 """ 68 """
72 if self.__loaded or not self.adBlockGroup.isChecked(): 69 if self.__loaded or not self.adBlockGroup.isChecked():
73 return 70 return
74 71
72 from .AdBlockTreeWidget import AdBlockTreeWidget
75 for subscription in self.__manager.subscriptions(): 73 for subscription in self.__manager.subscriptions():
76 tree = AdBlockTreeWidget(subscription, self.subscriptionsTabWidget) 74 tree = AdBlockTreeWidget(subscription, self.subscriptionsTabWidget)
77 if subscription.isEnabled(): 75 if subscription.isEnabled():
78 icon = UI.PixmapCache.getIcon("adBlockPlus.png") 76 icon = UI.PixmapCache.getIcon("adBlockPlus.png")
79 else: 77 else:
91 89
92 @param subscription reference to the subscription to be 90 @param subscription reference to the subscription to be
93 added (AdBlockSubscription) 91 added (AdBlockSubscription)
94 @param refresh flag indicating to refresh the tree (boolean) 92 @param refresh flag indicating to refresh the tree (boolean)
95 """ 93 """
94 from .AdBlockTreeWidget import AdBlockTreeWidget
96 tree = AdBlockTreeWidget(subscription, self.subscriptionsTabWidget) 95 tree = AdBlockTreeWidget(subscription, self.subscriptionsTabWidget)
97 index = self.subscriptionsTabWidget.insertTab( 96 index = self.subscriptionsTabWidget.insertTab(
98 self.subscriptionsTabWidget.count() - 1, tree, subscription.title()) 97 self.subscriptionsTabWidget.count() - 1, tree, subscription.title())
99 self.subscriptionsTabWidget.setCurrentIndex(index) 98 self.subscriptionsTabWidget.setCurrentIndex(index)
100 QCoreApplication.processEvents() 99 QCoreApplication.processEvents()
176 175
177 def __browseSubscriptions(self): 176 def __browseSubscriptions(self):
178 """ 177 """
179 Private slot to browse the list of available AdBlock subscriptions. 178 Private slot to browse the list of available AdBlock subscriptions.
180 """ 179 """
180 import Helpviewer.HelpWindow
181 mw = Helpviewer.HelpWindow.HelpWindow.mainWindow() 181 mw = Helpviewer.HelpWindow.HelpWindow.mainWindow()
182 mw.newTab("http://adblockplus.org/en/subscriptions") 182 mw.newTab("http://adblockplus.org/en/subscriptions")
183 mw.raise_() 183 mw.raise_()
184 184
185 def __learnAboutWritingFilters(self): 185 def __learnAboutWritingFilters(self):
186 """ 186 """
187 Private slot to show the web page about how to write filters. 187 Private slot to show the web page about how to write filters.
188 """ 188 """
189 import Helpviewer.HelpWindow
189 mw = Helpviewer.HelpWindow.HelpWindow.mainWindow() 190 mw = Helpviewer.HelpWindow.HelpWindow.mainWindow()
190 mw.newTab("http://adblockplus.org/en/filters") 191 mw.newTab("http://adblockplus.org/en/filters")
191 mw.raise_() 192 mw.raise_()
192 193
193 def __removeSubscription(self): 194 def __removeSubscription(self):
266 @param value update period (integer) 267 @param value update period (integer)
267 """ 268 """
268 if value != Preferences.getHelp("AdBlockUpdatePeriod"): 269 if value != Preferences.getHelp("AdBlockUpdatePeriod"):
269 Preferences.setHelp("AdBlockUpdatePeriod", value) 270 Preferences.setHelp("AdBlockUpdatePeriod", value)
270 271
272 import Helpviewer.HelpWindow
271 manager = Helpviewer.HelpWindow.HelpWindow.adBlockManager() 273 manager = Helpviewer.HelpWindow.HelpWindow.adBlockManager()
272 for subscription in manager.subscriptions(): 274 for subscription in manager.subscriptions():
273 subscription.checkForUpdate() 275 subscription.checkForUpdate()
274 276
275 @pyqtSlot(int) 277 @pyqtSlot(int)

eric ide

mercurial