Helpviewer/HelpWindow.py

changeset 4359
ac1dda9f3f19
parent 4355
40ec6bef4c22
child 4362
1a171c85b275
equal deleted inserted replaced
4357:815d1f3116ff 4359:ac1dda9f3f19
87 _speedDial = None 87 _speedDial = None
88 _personalInformationManager = None 88 _personalInformationManager = None
89 _greaseMonkeyManager = None 89 _greaseMonkeyManager = None
90 _notification = None 90 _notification = None
91 _featurePermissionManager = None 91 _featurePermissionManager = None
92 _flashCookieManager = None
92 93
93 def __init__(self, home, path, parent, name, fromEric=False, 94 def __init__(self, home, path, parent, name, fromEric=False,
94 initShortcutsOnly=False, searchWord=None): 95 initShortcutsOnly=False, searchWord=None):
95 """ 96 """
96 Constructor 97 Constructor
285 self.__virusTotalFileScanReport) 286 self.__virusTotalFileScanReport)
286 287
287 self.__previewer = None 288 self.__previewer = None
288 self.__shutdownCalled = False 289 self.__shutdownCalled = False
289 290
291 self.flashCookieManager()
292
290 if self.useQtHelp: 293 if self.useQtHelp:
291 QTimer.singleShot(0, self.__lookForNewDocumentation) 294 QTimer.singleShot(0, self.__lookForNewDocumentation)
292 if self.__searchWord is not None: 295 if self.__searchWord is not None:
293 QTimer.singleShot(0, self.__searchForWord) 296 QTimer.singleShot(0, self.__searchForWord)
297
298 self.__lastActiveWindow = None
299 e5App().focusChanged[QWidget, QWidget].connect(
300 self.__appFocusChanged)
294 301
295 QTimer.singleShot(0, syncMgr.loadSettings) 302 QTimer.singleShot(0, syncMgr.loadSettings)
296 303
297 def __del__(self): 304 def __del__(self):
298 """ 305 """
2228 2235
2229 self.syncManager().close() 2236 self.syncManager().close()
2230 2237
2231 self.__virusTotal.close() 2238 self.__virusTotal.close()
2232 2239
2240 self.flashCookieManager().shutdown()
2241
2233 self.searchEdit.openSearchManager().close() 2242 self.searchEdit.openSearchManager().close()
2234 2243
2235 if self.useQtHelp: 2244 if self.useQtHelp:
2236 self.__searchEngine.cancelIndexing() 2245 self.__searchEngine.cancelIndexing()
2237 self.__searchEngine.cancelSearching() 2246 self.__searchEngine.cancelSearching()
3299 cls._featurePermissionManager = FeaturePermissionManager() 3308 cls._featurePermissionManager = FeaturePermissionManager()
3300 3309
3301 return cls._featurePermissionManager 3310 return cls._featurePermissionManager
3302 3311
3303 @classmethod 3312 @classmethod
3313 def flashCookieManager(cls):
3314 """
3315 Class method to get a reference to the flash cookies manager.
3316
3317 @return reference to the feature permission manager
3318 @rtype FlashCookieManager
3319 """
3320 if cls._flashCookieManager is None:
3321 from .FlashCookieManager.FlashCookieManager import \
3322 FlashCookieManager
3323 cls._flashCookieManager = FlashCookieManager()
3324
3325 return cls._flashCookieManager
3326
3327 @classmethod
3304 def mainWindow(cls): 3328 def mainWindow(cls):
3305 """ 3329 """
3306 Class method to get a reference to the main window. 3330 Class method to get a reference to the main window.
3307 3331
3308 @return reference to the main window (HelpWindow) 3332 @return reference to the main window (HelpWindow)
3318 Class method to get references to all main windows. 3342 Class method to get references to all main windows.
3319 3343
3320 @return references to all main window (list of HelpWindow) 3344 @return references to all main window (list of HelpWindow)
3321 """ 3345 """
3322 return cls.helpwindows 3346 return cls.helpwindows
3347
3348 def __appFocusChanged(self, old, now):
3349 """
3350 Private slot to handle a change of the focus.
3351
3352 @param old reference to the widget, that lost focus (QWidget or None)
3353 @param now reference to the widget having the focus (QWidget or None)
3354 """
3355 if isinstance(now, HelpWindow):
3356 self.__lastActiveWindow = now
3357
3358 def getWindow(self):
3359 """
3360 Public method to get a reference to the most recent active help window.
3361
3362 @return reference to most recent help window
3363 @rtype HelpWindow
3364 """
3365 if self.__lastActiveWindow:
3366 return self.__lastActiveWindow
3367
3368 return self.mainWindow()
3323 3369
3324 def openSearchManager(self): 3370 def openSearchManager(self):
3325 """ 3371 """
3326 Public method to get a reference to the opensearch manager object. 3372 Public method to get a reference to the opensearch manager object.
3327 3373

eric ide

mercurial