Helpviewer/HelpBrowserWV.py

changeset 3034
7ce719013078
parent 3022
57179e4cdadd
child 3035
36e9f388958b
equal deleted inserted replaced
3033:58fe260e7469 3034:7ce719013078
137 137
138 @param searchStr search term (string) 138 @param searchStr search term (string)
139 @return search URL (string) 139 @return search URL (string)
140 """ 140 """
141 return bytes( 141 return bytes(
142 self.__mw.openSearchManager().currentEngine()\ 142 self.__mw.openSearchManager().currentEngine()
143 .searchUrl(searchStr).toEncoded()).decode() 143 .searchUrl(searchStr).toEncoded()).decode()
144 144
145 ############################################################################### 145 ###############################################################################
146 146
147 147
349 html = html.replace( 349 html = html.replace(
350 "@FAVICON@", imageBuffer.buffer().toBase64()) 350 "@FAVICON@", imageBuffer.buffer().toBase64())
351 html = html.replace("@TITLE@", title.encode("utf8")) 351 html = html.replace("@TITLE@", title.encode("utf8"))
352 html = html.replace("@H1@", info.errorString.encode("utf8")) 352 html = html.replace("@H1@", info.errorString.encode("utf8"))
353 html = html.replace( 353 html = html.replace(
354 "@H2@", self.trUtf8("When connecting to: {0}.")\ 354 "@H2@", self.trUtf8("When connecting to: {0}.")
355 .format(urlString).encode("utf8")) 355 .format(urlString).encode("utf8"))
356 html = html.replace( 356 html = html.replace(
357 "@LI-1@", 357 "@LI-1@",
358 self.trUtf8("Check the address for errors such as " 358 self.trUtf8("Check the address for errors such as "
359 "<b>ww</b>.example.org instead of " 359 "<b>ww</b>.example.org instead of "
370 "or proxy, make sure that the browser is permitted to " 370 "or proxy, make sure that the browser is permitted to "
371 "access the network.").encode("utf8")) 371 "access the network.").encode("utf8"))
372 html = html.replace( 372 html = html.replace(
373 "@LI-4@", 373 "@LI-4@",
374 self.trUtf8("If your cache policy is set to offline browsing," 374 self.trUtf8("If your cache policy is set to offline browsing,"
375 "only pages in the local cache are available.")\ 375 "only pages in the local cache are available.")
376 .encode("utf8")) 376 .encode("utf8"))
377 html = html.replace( 377 html = html.replace(
378 "@BUTTON@", self.trUtf8("Try Again").encode("utf8")) 378 "@BUTTON@", self.trUtf8("Try Again").encode("utf8"))
379 errorPage.content = html 379 errorPage.content = html
380 return True 380 return True
821 if not QFileInfo(name.toLocalFile()).exists(): 821 if not QFileInfo(name.toLocalFile()).exists():
822 E5MessageBox.critical( 822 E5MessageBox.critical(
823 self, 823 self,
824 self.trUtf8("eric5 Web Browser"), 824 self.trUtf8("eric5 Web Browser"),
825 self.trUtf8( 825 self.trUtf8(
826 """<p>The file <b>{0}</b> does not exist.</p>""")\ 826 """<p>The file <b>{0}</b> does not exist.</p>""")
827 .format(name.toLocalFile())) 827 .format(name.toLocalFile()))
828 return 828 return
829 829
830 if name.toLocalFile().endswith(".pdf") or \ 830 if name.toLocalFile().endswith(".pdf") or \
831 name.toLocalFile().endswith(".PDF") or \ 831 name.toLocalFile().endswith(".PDF") or \
1721 if self.mw.personalInformationManager().viewKeyPressEvent(self, evt): 1721 if self.mw.personalInformationManager().viewKeyPressEvent(self, evt):
1722 return 1722 return
1723 1723
1724 if self.__enableAccessKeys: 1724 if self.__enableAccessKeys:
1725 self.__accessKeysPressed = ( 1725 self.__accessKeysPressed = (
1726 evt.modifiers() == Qt.ControlModifier and \ 1726 evt.modifiers() == Qt.ControlModifier and
1727 evt.key() == Qt.Key_Control) 1727 evt.key() == Qt.Key_Control)
1728 if not self.__accessKeysPressed: 1728 if not self.__accessKeysPressed:
1729 if self.__checkForAccessKey(evt): 1729 if self.__checkForAccessKey(evt):
1730 self.__hideAccessKeys() 1730 self.__hideAccessKeys()
1731 evt.accept() 1731 evt.accept()
1950 if pixmap.save(imageBuffer, "PNG"): 1950 if pixmap.save(imageBuffer, "PNG"):
1951 html = html.replace("@FAVICON@", imageBuffer.buffer().toBase64()) 1951 html = html.replace("@FAVICON@", imageBuffer.buffer().toBase64())
1952 html = html.replace("@TITLE@", title.encode("utf8")) 1952 html = html.replace("@TITLE@", title.encode("utf8"))
1953 html = html.replace("@H1@", reply.errorString().encode("utf8")) 1953 html = html.replace("@H1@", reply.errorString().encode("utf8"))
1954 html = html.replace( 1954 html = html.replace(
1955 "@H2@", self.trUtf8("When connecting to: {0}.")\ 1955 "@H2@", self.trUtf8("When connecting to: {0}.")
1956 .format(urlString).encode("utf8")) 1956 .format(urlString).encode("utf8"))
1957 html = html.replace( 1957 html = html.replace(
1958 "@LI-1@", 1958 "@LI-1@",
1959 self.trUtf8("Check the address for errors such as " 1959 self.trUtf8("Check the address for errors such as "
1960 "<b>ww</b>.example.org instead of " 1960 "<b>ww</b>.example.org instead of "
1970 "or proxy, make sure that the browser is permitted to " 1970 "or proxy, make sure that the browser is permitted to "
1971 "access the network.").encode("utf8")) 1971 "access the network.").encode("utf8"))
1972 html = html.replace( 1972 html = html.replace(
1973 "@LI-4@", 1973 "@LI-4@",
1974 self.trUtf8("If your cache policy is set to offline browsing," 1974 self.trUtf8("If your cache policy is set to offline browsing,"
1975 "only pages in the local cache are available.")\ 1975 "only pages in the local cache are available.")
1976 .encode("utf8")) 1976 .encode("utf8"))
1977 html = html.replace( 1977 html = html.replace(
1978 "@BUTTON@", self.trUtf8("Try Again").encode("utf8")) 1978 "@BUTTON@", self.trUtf8("Try Again").encode("utf8"))
1979 notFoundFrame.setHtml(bytes(html).decode("utf8"), replyUrl) 1979 notFoundFrame.setHtml(bytes(html).decode("utf8"), replyUrl)
1980 self.mw.historyManager().removeHistoryEntry(replyUrl, self.title()) 1980 self.mw.historyManager().removeHistoryEntry(replyUrl, self.title())
2006 self, 2006 self,
2007 self.trUtf8("Web Database Quota"), 2007 self.trUtf8("Web Database Quota"),
2008 self.trUtf8( 2008 self.trUtf8(
2009 """<p>The database quota of <strong>{0}</strong> has""" 2009 """<p>The database quota of <strong>{0}</strong> has"""
2010 """ been exceeded while accessing database <strong>{1}""" 2010 """ been exceeded while accessing database <strong>{1}"""
2011 """</strong>.</p><p>Shall it be changed?</p>""")\ 2011 """</strong>.</p><p>Shall it be changed?</p>""")
2012 .format(self.__dataString(securityOrigin.databaseQuota()), 2012 .format(self.__dataString(securityOrigin.databaseQuota()),
2013 databaseName), 2013 databaseName),
2014 yesDefault=True) 2014 yesDefault=True)
2015 if res: 2015 if res:
2016 newQuota, ok = QInputDialog.getInt( 2016 newQuota, ok = QInputDialog.getInt(
2017 self, 2017 self,
2018 self.trUtf8("New Web Database Quota"), 2018 self.trUtf8("New Web Database Quota"),
2019 self.trUtf8( 2019 self.trUtf8(
2020 "Enter the new quota in MB (current = {0}, used = {1}; " 2020 "Enter the new quota in MB (current = {0}, used = {1}; "
2021 "step size = 5 MB):"\ 2021 "step size = 5 MB):"
2022 .format( 2022 .format(
2023 self.__dataString(securityOrigin.databaseQuota()), 2023 self.__dataString(securityOrigin.databaseQuota()),
2024 self.__dataString(securityOrigin.databaseUsage()))), 2024 self.__dataString(securityOrigin.databaseUsage()))),
2025 securityOrigin.databaseQuota() // (1024 * 1024), 2025 securityOrigin.databaseQuota() // (1024 * 1024),
2026 0, 2147483647, 5) 2026 0, 2147483647, 5)
2248 linkElementsList = frame.findAllElements("link").toList() 2248 linkElementsList = frame.findAllElements("link").toList()
2249 2249
2250 for linkElement in linkElementsList: 2250 for linkElement in linkElementsList:
2251 # only atom+xml and rss+xml will be processed 2251 # only atom+xml and rss+xml will be processed
2252 if linkElement.attribute("rel") != "alternate" or \ 2252 if linkElement.attribute("rel") != "alternate" or \
2253 (linkElement.attribute("type") != "application/rss+xml" and \ 2253 (linkElement.attribute("type") != "application/rss+xml" and
2254 linkElement.attribute("type") != "application/atom+xml"): 2254 linkElement.attribute("type") != "application/atom+xml"):
2255 continue 2255 continue
2256 2256
2257 title = linkElement.attribute("title") 2257 title = linkElement.attribute("title")
2258 href = linkElement.attribute("href") 2258 href = linkElement.attribute("href")

eric ide

mercurial