Helpviewer/HelpBrowserWV.py

changeset 3035
36e9f388958b
parent 3034
7ce719013078
child 3048
83f86da6344e
equal deleted inserted replaced
3034:7ce719013078 3035:36e9f388958b
248 @param extension extension to test for (QWebPage.Extension) 248 @param extension extension to test for (QWebPage.Extension)
249 @return flag indicating the support of extension (boolean) 249 @return flag indicating the support of extension (boolean)
250 """ 250 """
251 try: 251 try:
252 if extension in [QWebPage.ErrorPageExtension, 252 if extension in [QWebPage.ErrorPageExtension,
253 QWebPage.ChooseMultipleFilesExtension]: 253 QWebPage.ChooseMultipleFilesExtension]:
254 return True 254 return True
255 except AttributeError: 255 except AttributeError:
256 pass 256 pass
257 257
258 return QWebPage.supportsExtension(self, extension) 258 return QWebPage.supportsExtension(self, extension)
334 title = self.trUtf8("Error loading page: {0}").format(urlString) 334 title = self.trUtf8("Error loading page: {0}").format(urlString)
335 htmlFile = QFile(":/html/notFoundPage.html") 335 htmlFile = QFile(":/html/notFoundPage.html")
336 htmlFile.open(QFile.ReadOnly) 336 htmlFile.open(QFile.ReadOnly)
337 html = htmlFile.readAll() 337 html = htmlFile.readAll()
338 pixmap = qApp.style()\ 338 pixmap = qApp.style()\
339 .standardIcon(QStyle.SP_MessageBoxWarning).pixmap(48, 48) 339 .standardIcon(QStyle.SP_MessageBoxWarning).pixmap(48, 48)
340 imageBuffer = QBuffer() 340 imageBuffer = QBuffer()
341 imageBuffer.open(QIODevice.ReadWrite) 341 imageBuffer.open(QIODevice.ReadWrite)
342 if pixmap.save(imageBuffer, "PNG"): 342 if pixmap.save(imageBuffer, "PNG"):
343 html = html.replace("@IMAGE@", imageBuffer.buffer().toBase64()) 343 html = html.replace("@IMAGE@", imageBuffer.buffer().toBase64())
344 pixmap = qApp.style()\ 344 pixmap = qApp.style()\
345 .standardIcon(QStyle.SP_MessageBoxWarning).pixmap(16, 16) 345 .standardIcon(QStyle.SP_MessageBoxWarning).pixmap(16, 16)
346 imageBuffer = QBuffer() 346 imageBuffer = QBuffer()
347 imageBuffer.open(QIODevice.ReadWrite) 347 imageBuffer.open(QIODevice.ReadWrite)
348 if pixmap.save(imageBuffer, "PNG"): 348 if pixmap.save(imageBuffer, "PNG"):
349 html = html.replace( 349 html = html.replace(
350 "@FAVICON@", imageBuffer.buffer().toBase64()) 350 "@FAVICON@", imageBuffer.buffer().toBase64())
556 certList = self.__sslConfiguration.peerCertificateChain() 556 certList = self.__sslConfiguration.peerCertificateChain()
557 if not certList: 557 if not certList:
558 return False 558 return False
559 559
560 certificateDict = Preferences.toDict( 560 certificateDict = Preferences.toDict(
561 Preferences.Prefs.settings.value("Ssl/CaCertificatesDict")) 561 Preferences.Prefs.settings.value("Ssl/CaCertificatesDict"))
562 for server in certificateDict: 562 for server in certificateDict:
563 localCAList = QSslCertificate.fromData(certificateDict[server]) 563 localCAList = QSslCertificate.fromData(certificateDict[server])
564 for cert in certList: 564 for cert in certList:
565 if cert in localCAList: 565 if cert in localCAList:
566 return True 566 return True
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 \
832 name.toLocalFile().endswith(".chm") or \ 832 name.toLocalFile().endswith(".chm") or \
1191 act.menu().actions(): 1191 act.menu().actions():
1192 if directionFound: 1192 if directionFound:
1193 act.setVisible(False) 1193 act.setVisible(False)
1194 directionFound = True 1194 directionFound = True
1195 elif self.pageAction(QWebPage.ToggleBold) in \ 1195 elif self.pageAction(QWebPage.ToggleBold) in \
1196 act.menu().actions(): 1196 act.menu().actions():
1197 act.setVisible(False) 1197 act.setVisible(False)
1198 elif act == self.pageAction(QWebPage.InspectElement): 1198 elif act == self.pageAction(QWebPage.InspectElement):
1199 # we have our own inspect entry 1199 # we have our own inspect entry
1200 act.setVisible(False) 1200 act.setVisible(False)
1201 menu.addAction(act) 1201 menu.addAction(act)
1345 1345
1346 @param url URL to be checked (QUrl) 1346 @param url URL to be checked (QUrl)
1347 @return flag indicating a valid URL (boolean) 1347 @return flag indicating a valid URL (boolean)
1348 """ 1348 """
1349 return url.isValid() and \ 1349 return url.isValid() and \
1350 bool(url.host()) and \ 1350 bool(url.host()) and \
1351 bool(url.scheme()) and \ 1351 bool(url.scheme()) and \
1352 "." in url.host() 1352 "." in url.host()
1353 1353
1354 def __openLinkInNewTab(self): 1354 def __openLinkInNewTab(self):
1355 """ 1355 """
1356 Private method called by the context menu to open a link in a new 1356 Private method called by the context menu to open a link in a new
1357 window. 1357 window.
1936 title = self.trUtf8("Error loading page: {0}").format(urlString) 1936 title = self.trUtf8("Error loading page: {0}").format(urlString)
1937 htmlFile = QFile(":/html/notFoundPage.html") 1937 htmlFile = QFile(":/html/notFoundPage.html")
1938 htmlFile.open(QFile.ReadOnly) 1938 htmlFile.open(QFile.ReadOnly)
1939 html = htmlFile.readAll() 1939 html = htmlFile.readAll()
1940 pixmap = qApp.style()\ 1940 pixmap = qApp.style()\
1941 .standardIcon(QStyle.SP_MessageBoxWarning).pixmap(48, 48) 1941 .standardIcon(QStyle.SP_MessageBoxWarning).pixmap(48, 48)
1942 imageBuffer = QBuffer() 1942 imageBuffer = QBuffer()
1943 imageBuffer.open(QIODevice.ReadWrite) 1943 imageBuffer.open(QIODevice.ReadWrite)
1944 if pixmap.save(imageBuffer, "PNG"): 1944 if pixmap.save(imageBuffer, "PNG"):
1945 html = html.replace("@IMAGE@", imageBuffer.buffer().toBase64()) 1945 html = html.replace("@IMAGE@", imageBuffer.buffer().toBase64())
1946 pixmap = qApp.style()\ 1946 pixmap = qApp.style()\
1947 .standardIcon(QStyle.SP_MessageBoxWarning).pixmap(16, 16) 1947 .standardIcon(QStyle.SP_MessageBoxWarning).pixmap(16, 16)
1948 imageBuffer = QBuffer() 1948 imageBuffer = QBuffer()
1949 imageBuffer.open(QIODevice.ReadWrite) 1949 imageBuffer.open(QIODevice.ReadWrite)
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 "
1961 "<b>www</b>.example.org").encode("utf8")) 1961 "<b>www</b>.example.org").encode("utf8"))
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"),
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")
2259 if href == "" or title == "": 2259 if href == "" or title == "":

eric ide

mercurial