Helpviewer/HelpBrowserWV.py

changeset 3020
542e97d4ecb3
parent 2999
28c75409a78f
child 3022
57179e4cdadd
equal deleted inserted replaced
3019:7912530a33e2 3020:542e97d4ecb3
197 if scheme == "mailto": 197 if scheme == "mailto":
198 QDesktopServices.openUrl(request.url()) 198 QDesktopServices.openUrl(request.url())
199 return False 199 return False
200 200
201 if type_ == QWebPage.NavigationTypeFormResubmitted: 201 if type_ == QWebPage.NavigationTypeFormResubmitted:
202 res = E5MessageBox.yesNo(self.view(), 202 res = E5MessageBox.yesNo(
203 self.view(),
203 self.trUtf8("Resending POST request"), 204 self.trUtf8("Resending POST request"),
204 self.trUtf8( 205 self.trUtf8(
205 """In order to display the site, the request along with""" 206 """In order to display the site, the request along with"""
206 """ all the data must be sent once again, which may lead""" 207 """ all the data must be sent once again, which may lead"""
207 """ to some unexpected behaviour of the site e.g. the""" 208 """ to some unexpected behaviour of the site e.g. the"""
532 from E5Network.E5SslInfoWidget import E5SslInfoWidget 533 from E5Network.E5SslInfoWidget import E5SslInfoWidget
533 widget = E5SslInfoWidget( 534 widget = E5SslInfoWidget(
534 self.mainFrame().url(), self.__sslConfiguration, self.view()) 535 self.mainFrame().url(), self.__sslConfiguration, self.view())
535 widget.showAt(pos) 536 widget.showAt(pos)
536 else: 537 else:
537 E5MessageBox.warning(self.view(), 538 E5MessageBox.warning(
539 self.view(),
538 self.trUtf8("SSL Info"), 540 self.trUtf8("SSL Info"),
539 self.trUtf8("""This site does not contain SSL information.""")) 541 self.trUtf8("""This site does not contain SSL information."""))
540 542
541 def hasValidSslInfo(self): 543 def hasValidSslInfo(self):
542 """ 544 """
811 if name.scheme() and len(name.scheme()) == 1: 813 if name.scheme() and len(name.scheme()) == 1:
812 # it is a local path on win os 814 # it is a local path on win os
813 name = QUrl.fromLocalFile(name.toString()) 815 name = QUrl.fromLocalFile(name.toString())
814 816
815 if not QFileInfo(name.toLocalFile()).exists(): 817 if not QFileInfo(name.toLocalFile()).exists():
816 E5MessageBox.critical(self, 818 E5MessageBox.critical(
819 self,
817 self.trUtf8("eric5 Web Browser"), 820 self.trUtf8("eric5 Web Browser"),
818 self.trUtf8( 821 self.trUtf8(
819 """<p>The file <b>{0}</b> does not exist.</p>""")\ 822 """<p>The file <b>{0}</b> does not exist.</p>""")\
820 .format(name.toLocalFile())) 823 .format(name.toLocalFile()))
821 return 824 return
824 name.toLocalFile().endswith(".PDF") or \ 827 name.toLocalFile().endswith(".PDF") or \
825 name.toLocalFile().endswith(".chm") or \ 828 name.toLocalFile().endswith(".chm") or \
826 name.toLocalFile().endswith(".CHM"): 829 name.toLocalFile().endswith(".CHM"):
827 started = QDesktopServices.openUrl(name) 830 started = QDesktopServices.openUrl(name)
828 if not started: 831 if not started:
829 E5MessageBox.critical(self, 832 E5MessageBox.critical(
833 self,
830 self.trUtf8("eric5 Web Browser"), 834 self.trUtf8("eric5 Web Browser"),
831 self.trUtf8("""<p>Could not start a viewer""" 835 self.trUtf8("""<p>Could not start a viewer"""
832 """ for file <b>{0}</b>.</p>""").format(name.path())) 836 """ for file <b>{0}</b>.</p>""").format(name.path()))
833 return 837 return
834 elif name.scheme() in ["mailto"]: 838 elif name.scheme() in ["mailto"]:
835 started = QDesktopServices.openUrl(name) 839 started = QDesktopServices.openUrl(name)
836 if not started: 840 if not started:
837 E5MessageBox.critical(self, 841 E5MessageBox.critical(
842 self,
838 self.trUtf8("eric5 Web Browser"), 843 self.trUtf8("eric5 Web Browser"),
839 self.trUtf8("""<p>Could not start an application""" 844 self.trUtf8("""<p>Could not start an application"""
840 """ for URL <b>{0}</b>.</p>""").format(name.toString())) 845 """ for URL <b>{0}</b>.</p>""").format(name.toString()))
841 return 846 return
842 elif name.scheme() == "javascript": 847 elif name.scheme() == "javascript":
849 name.toString().endswith(".PDF") or \ 854 name.toString().endswith(".PDF") or \
850 name.toString().endswith(".chm") or \ 855 name.toString().endswith(".chm") or \
851 name.toString().endswith(".CHM"): 856 name.toString().endswith(".CHM"):
852 started = QDesktopServices.openUrl(name) 857 started = QDesktopServices.openUrl(name)
853 if not started: 858 if not started:
854 E5MessageBox.critical(self, 859 E5MessageBox.critical(
860 self,
855 self.trUtf8("eric5 Web Browser"), 861 self.trUtf8("eric5 Web Browser"),
856 self.trUtf8("""<p>Could not start a viewer""" 862 self.trUtf8("""<p>Could not start a viewer"""
857 """ for file <b>{0}</b>.</p>""").format(name.path())) 863 """ for file <b>{0}</b>.</p>""").format(name.path()))
858 return 864 return
859 865
1464 formElement.attribute("action") == "": 1470 formElement.attribute("action") == "":
1465 return 1471 return
1466 1472
1467 method = formElement.attribute("method", "get").lower() 1473 method = formElement.attribute("method", "get").lower()
1468 if method != "get": 1474 if method != "get":
1469 E5MessageBox.warning(self, 1475 E5MessageBox.warning(
1476 self,
1470 self.trUtf8("Method not supported"), 1477 self.trUtf8("Method not supported"),
1471 self.trUtf8( 1478 self.trUtf8(
1472 """{0} method is not supported.""").format(method.upper())) 1479 """{0} method is not supported.""").format(method.upper()))
1473 return 1480 return
1474 1481
1952 securityOrigin.databaseUsage() == 0: 1959 securityOrigin.databaseUsage() == 0:
1953 # cope with a strange behavior of Qt 4.6, if a database is 1960 # cope with a strange behavior of Qt 4.6, if a database is
1954 # accessed for the first time 1961 # accessed for the first time
1955 return 1962 return
1956 1963
1957 res = E5MessageBox.yesNo(self, 1964 res = E5MessageBox.yesNo(
1965 self,
1958 self.trUtf8("Web Database Quota"), 1966 self.trUtf8("Web Database Quota"),
1959 self.trUtf8( 1967 self.trUtf8(
1960 """<p>The database quota of <strong>{0}</strong> has""" 1968 """<p>The database quota of <strong>{0}</strong> has"""
1961 """ been exceeded while accessing database <strong>{1}""" 1969 """ been exceeded while accessing database <strong>{1}"""
1962 """</strong>.</p><p>Shall it be changed?</p>""")\ 1970 """</strong>.</p><p>Shall it be changed?</p>""")\
2264 printDialog = QPrintDialog(printer, self) 2272 printDialog = QPrintDialog(printer, self)
2265 if printDialog.exec_() == QDialog.Accepted: 2273 if printDialog.exec_() == QDialog.Accepted:
2266 try: 2274 try:
2267 self.__clickedFrame.print_(printer) 2275 self.__clickedFrame.print_(printer)
2268 except AttributeError: 2276 except AttributeError:
2269 E5MessageBox.critical(self, 2277 E5MessageBox.critical(
2278 self,
2270 self.trUtf8("eric5 Web Browser"), 2279 self.trUtf8("eric5 Web Browser"),
2271 self.trUtf8( 2280 self.trUtf8(
2272 """<p>Printing is not available due to a bug in""" 2281 """<p>Printing is not available due to a bug in"""
2273 """ PyQt4. Please upgrade.</p>""")) 2282 """ PyQt4. Please upgrade.</p>"""))
2274 2283
2307 @param printer reference to the printer object (QPrinter) 2316 @param printer reference to the printer object (QPrinter)
2308 """ 2317 """
2309 try: 2318 try:
2310 self.__clickedFrame.print_(printer) 2319 self.__clickedFrame.print_(printer)
2311 except AttributeError: 2320 except AttributeError:
2312 E5MessageBox.critical(self, 2321 E5MessageBox.critical(
2322 self,
2313 self.trUtf8("eric5 Web Browser"), 2323 self.trUtf8("eric5 Web Browser"),
2314 self.trUtf8( 2324 self.trUtf8(
2315 """<p>Printing is not available due to a bug in PyQt4.""" 2325 """<p>Printing is not available due to a bug in PyQt4."""
2316 """Please upgrade.</p>""")) 2326 """Please upgrade.</p>"""))
2317 return 2327 return
2336 printDialog = QPrintDialog(printer, self) 2346 printDialog = QPrintDialog(printer, self)
2337 if printDialog.exec_() == QDialog.Accepted: 2347 if printDialog.exec_() == QDialog.Accepted:
2338 try: 2348 try:
2339 self.__clickedFrame.print_(printer) 2349 self.__clickedFrame.print_(printer)
2340 except AttributeError: 2350 except AttributeError:
2341 E5MessageBox.critical(self, 2351 E5MessageBox.critical(
2352 self,
2342 self.trUtf8("eric5 Web Browser"), 2353 self.trUtf8("eric5 Web Browser"),
2343 self.trUtf8( 2354 self.trUtf8(
2344 """<p>Printing is not available due to a bug in""" 2355 """<p>Printing is not available due to a bug in"""
2345 """ PyQt4. Please upgrade.</p>""")) 2356 """ PyQt4. Please upgrade.</p>"""))
2346 return 2357 return

eric ide

mercurial