Helpviewer/HelpWindow.py

changeset 2099
afde0e9110f7
parent 2071
136eb25e4314
child 2100
fb16f4650860
equal deleted inserted replaced
2097:c5809ca16182 2099:afde0e9110f7
228 228
229 QDesktopServices.setUrlHandler("http", self.__linkActivated) 229 QDesktopServices.setUrlHandler("http", self.__linkActivated)
230 QDesktopServices.setUrlHandler("https", self.__linkActivated) 230 QDesktopServices.setUrlHandler("https", self.__linkActivated)
231 231
232 # setup connections 232 # setup connections
233 self.__activating = False
233 # TOC window 234 # TOC window
234 self.__tocWindow.linkActivated.connect(self.__linkActivated) 235 self.__tocWindow.linkActivated.connect(self.__linkActivated)
235 self.__tocWindow.escapePressed.connect(self.__activateCurrentBrowser) 236 self.__tocWindow.escapePressed.connect(self.__activateCurrentBrowser)
236 # index window 237 # index window
237 self.__indexWindow.linkActivated.connect(self.__linkActivated) 238 self.__indexWindow.linkActivated.connect(self.__linkActivated)
2289 """ 2290 """
2290 Private slot to handle the selection of a link in the TOC window. 2291 Private slot to handle the selection of a link in the TOC window.
2291 2292
2292 @param url URL to be shown (QUrl) 2293 @param url URL to be shown (QUrl)
2293 """ 2294 """
2294 req = QNetworkRequest(url) 2295 if not self.__activating:
2295 req.setRawHeader("X-Eric5-UserLoadAction", b"1") 2296 self.__activating = True
2296 self.currentBrowser().setSource( 2297 req = QNetworkRequest(url)
2297 None, (req, QNetworkAccessManager.GetOperation, b"")) 2298 req.setRawHeader("X-Eric5-UserLoadAction", b"1")
2299 self.currentBrowser().setSource(
2300 None, (req, QNetworkAccessManager.GetOperation, b""))
2301 self.__activating = False
2298 2302
2299 def __linksActivated(self, links, keyword): 2303 def __linksActivated(self, links, keyword):
2300 """ 2304 """
2301 Private slot to select a topic to be shown. 2305 Private slot to select a topic to be shown.
2302 2306
2303 @param links dictionary with help topic as key (string) and 2307 @param links dictionary with help topic as key (string) and
2304 URL as value (QUrl) 2308 URL as value (QUrl)
2305 @param keyword keyword for the link set (string) 2309 @param keyword keyword for the link set (string)
2306 """ 2310 """
2307 dlg = HelpTopicDialog(self, keyword, links) 2311 if not self.__activating:
2308 if dlg.exec_() == QDialog.Accepted: 2312 self.__activating = True
2309 self.currentBrowser().setSource(dlg.link()) 2313 dlg = HelpTopicDialog(self, keyword, links)
2314 if dlg.exec_() == QDialog.Accepted:
2315 self.currentBrowser().setSource(dlg.link())
2316 self.__activating = False
2310 2317
2311 def __activateCurrentBrowser(self): 2318 def __activateCurrentBrowser(self):
2312 """ 2319 """
2313 Private slot to activate the current browser. 2320 Private slot to activate the current browser.
2314 """ 2321 """

eric ide

mercurial