Helpviewer/AdBlock/AdBlockManager.py

changeset 2403
e3d7a861547c
parent 2302
f29e9405c851
child 2525
8b507a9a2d40
child 2763
e4794166ad70
equal deleted inserted replaced
2402:304fcefd3b04 2403:e3d7a861547c
9 9
10 import os 10 import os
11 11
12 from PyQt4.QtCore import pyqtSignal, QObject, QUrl, QFile 12 from PyQt4.QtCore import pyqtSignal, QObject, QUrl, QFile
13 13
14 from .AdBlockNetwork import AdBlockNetwork
15 from .AdBlockPage import AdBlockPage
16 from .AdBlockSubscription import AdBlockSubscription 14 from .AdBlockSubscription import AdBlockSubscription
17 from .AdBlockDialog import AdBlockDialog
18 from .AdBlockExceptionsDialog import AdBlockExceptionsDialog
19
20 import Helpviewer.HelpWindow
21 15
22 from Utilities.AutoSaver import AutoSaver 16 from Utilities.AutoSaver import AutoSaver
23 import Utilities 17 import Utilities
24 import Preferences 18 import Preferences
25 19
87 @param enabled flag indicating the enabled state (boolean) 81 @param enabled flag indicating the enabled state (boolean)
88 """ 82 """
89 if self.isEnabled() == enabled: 83 if self.isEnabled() == enabled:
90 return 84 return
91 85
86 import Helpviewer.HelpWindow
92 self.__enabled = enabled 87 self.__enabled = enabled
93 for mainWindow in Helpviewer.HelpWindow.HelpWindow.mainWindows(): 88 for mainWindow in Helpviewer.HelpWindow.HelpWindow.mainWindows():
94 mainWindow.adBlockIcon().setEnabled(enabled) 89 mainWindow.adBlockIcon().setEnabled(enabled)
95 if enabled: 90 if enabled:
96 self.__loadSubscriptions() 91 self.__loadSubscriptions()
101 Public method to get a reference to the network block object. 96 Public method to get a reference to the network block object.
102 97
103 @return reference to the network block object (AdBlockNetwork) 98 @return reference to the network block object (AdBlockNetwork)
104 """ 99 """
105 if self.__adBlockNetwork is None: 100 if self.__adBlockNetwork is None:
101 from .AdBlockNetwork import AdBlockNetwork
106 self.__adBlockNetwork = AdBlockNetwork(self) 102 self.__adBlockNetwork = AdBlockNetwork(self)
107 return self.__adBlockNetwork 103 return self.__adBlockNetwork
108 104
109 def page(self): 105 def page(self):
110 """ 106 """
111 Public method to get a reference to the page block object. 107 Public method to get a reference to the page block object.
112 108
113 @return reference to the page block object (AdBlockPage) 109 @return reference to the page block object (AdBlockPage)
114 """ 110 """
115 if self.__adBlockPage is None: 111 if self.__adBlockPage is None:
112 from .AdBlockPage import AdBlockPage
116 self.__adBlockPage = AdBlockPage(self) 113 self.__adBlockPage = AdBlockPage(self)
117 return self.__adBlockPage 114 return self.__adBlockPage
118 115
119 def __customSubscriptionLocation(self): 116 def __customSubscriptionLocation(self):
120 """ 117 """
344 Public slot to show the AdBlock subscription management dialog. 341 Public slot to show the AdBlock subscription management dialog.
345 342
346 @return reference to the dialog (AdBlockDialog) 343 @return reference to the dialog (AdBlockDialog)
347 """ 344 """
348 if self.__adBlockDialog is None: 345 if self.__adBlockDialog is None:
346 from .AdBlockDialog import AdBlockDialog
349 self.__adBlockDialog = AdBlockDialog() 347 self.__adBlockDialog = AdBlockDialog()
350 348
351 self.__adBlockDialog.show() 349 self.__adBlockDialog.show()
352 return self.__adBlockDialog 350 return self.__adBlockDialog
353 351
456 Public method to show the AdBlock Exceptions dialog. 454 Public method to show the AdBlock Exceptions dialog.
457 455
458 @return reference to the exceptions dialog (AdBlockExceptionsDialog) 456 @return reference to the exceptions dialog (AdBlockExceptionsDialog)
459 """ 457 """
460 if self.__adBlockExceptionsDialog is None: 458 if self.__adBlockExceptionsDialog is None:
459 from .AdBlockExceptionsDialog import AdBlockExceptionsDialog
461 self.__adBlockExceptionsDialog = AdBlockExceptionsDialog() 460 self.__adBlockExceptionsDialog = AdBlockExceptionsDialog()
462 461
463 self.__adBlockExceptionsDialog.load(self.__exceptedHosts) 462 self.__adBlockExceptionsDialog.load(self.__exceptedHosts)
464 self.__adBlockExceptionsDialog.show() 463 self.__adBlockExceptionsDialog.show()
465 return self.__adBlockExceptionsDialog 464 return self.__adBlockExceptionsDialog

eric ide

mercurial