Helpviewer/HelpWindow.py

changeset 6287
9a193ff6d24a
parent 6121
d3d64f3128b3
child 6293
509768769afe
equal deleted inserted replaced
6286:2c8a751d6137 6287:9a193ff6d24a
254 self.__adBlockIcon.sourceChanged) 254 self.__adBlockIcon.sourceChanged)
255 255
256 self.networkIcon = E5NetworkIcon(self) 256 self.networkIcon = E5NetworkIcon(self)
257 self.statusBar().addPermanentWidget(self.networkIcon) 257 self.statusBar().addPermanentWidget(self.networkIcon)
258 258
259 QDesktopServices.setUrlHandler("http", self.__linkActivated) 259 if not self.fromEric and len(HelpWindow.helpwindows):
260 QDesktopServices.setUrlHandler("https", self.__linkActivated) 260 QDesktopServices.setUrlHandler(
261 "http", HelpWindow.helpwindows[0].urlHandler)
262 QDesktopServices.setUrlHandler(
263 "https", HelpWindow.helpwindows[0].urlHandler)
261 264
262 # setup connections 265 # setup connections
263 self.__activating = False 266 self.__activating = False
264 if HelpWindow._useQtHelp: 267 if HelpWindow._useQtHelp:
265 # TOC window 268 # TOC window
2283 self.saveGeometry()) 2286 self.saveGeometry())
2284 else: 2287 else:
2285 Preferences.setGeometry("HelpViewerGeometry", QByteArray()) 2288 Preferences.setGeometry("HelpViewerGeometry", QByteArray())
2286 2289
2287 try: 2290 try:
2288 if self.fromEric or len(self.__class__.helpwindows) > 1: 2291 browserIndex = HelpWindow.helpwindows.index(self)
2289 del self.__class__.helpwindows[ 2292 if not self.__fromEric and len(HelpWindow.helpwindows):
2290 self.__class__.helpwindows.index(self)] 2293 if browserIndex == 0:
2294 if len(HelpWindow.helpwindows) > 1:
2295 # first window will be deleted
2296 QDesktopServices.setUrlHandler(
2297 "http",
2298 HelpWindow.helpwindows[1].urlHandler)
2299 QDesktopServices.setUrlHandler(
2300 "https",
2301 HelpWindow.helpwindows[1].urlHandler)
2302 else:
2303 QDesktopServices.unsetUrlHandler("http")
2304 QDesktopServices.unsetUrlHandler("https")
2305 if self.fromEric or len(HelpWindow.helpwindows) > 0:
2306 del HelpWindow.helpwindows[browserIndex]
2291 except ValueError: 2307 except ValueError:
2292 pass 2308 pass
2293 2309
2294 if not self.fromEric: 2310 if not self.fromEric:
2295 Preferences.syncPreferences() 2311 Preferences.syncPreferences()
2656 Private slot to clear the icons databse. 2672 Private slot to clear the icons databse.
2657 """ 2673 """
2658 QWebSettings.clearIconDatabase() 2674 QWebSettings.clearIconDatabase()
2659 2675
2660 @pyqtSlot(QUrl) 2676 @pyqtSlot(QUrl)
2677 def urlHandler(self, url):
2678 """
2679 Private slot used as desktop URL handler.
2680
2681 @param url URL to be handled
2682 @type QUrl
2683 """
2684 self.__linkActivated(url)
2685
2686 @pyqtSlot(QUrl)
2661 def __linkActivated(self, url): 2687 def __linkActivated(self, url):
2662 """ 2688 """
2663 Private slot to handle the selection of a link in the TOC window. 2689 Private slot to handle the selection of a link in the TOC window.
2664 2690
2665 @param url URL to be shown (QUrl) 2691 @param url URL to be shown
2692 @type QUrl
2666 """ 2693 """
2667 if not self.__activating: 2694 if not self.__activating:
2668 self.__activating = True 2695 self.__activating = True
2669 req = QNetworkRequest(url) 2696 req = QNetworkRequest(url)
2670 req.setRawHeader(b"X-Eric6-UserLoadAction", b"1") 2697 req.setRawHeader(b"X-Eric6-UserLoadAction", b"1")

eric ide

mercurial