Helpviewer/HelpBrowserWV.py

branch
Py2 comp.
changeset 3058
0a02c433f52d
parent 3057
10516539f238
parent 3022
57179e4cdadd
child 3060
5883ce99ee12
--- a/Helpviewer/HelpBrowserWV.py	Fri Oct 18 23:00:41 2013 +0200
+++ b/Helpviewer/HelpBrowserWV.py	Fri Nov 01 15:48:48 2013 +0100
@@ -205,7 +205,8 @@
             return False
         
         if type_ == QWebPage.NavigationTypeFormResubmitted:
-            res = E5MessageBox.yesNo(self.view(),
+            res = E5MessageBox.yesNo(
+                self.view(),
                 self.trUtf8("Resending POST request"),
                 self.trUtf8(
                     """In order to display the site, the request along with"""
@@ -358,20 +359,24 @@
             html = html.replace(
                 "@H2@", self.trUtf8("When connecting to: {0}.")\
                 .format(urlString).encode("utf8"))
-            html = html.replace("@LI-1@",
+            html = html.replace(
+                "@LI-1@",
                 self.trUtf8("Check the address for errors such as "
                             "<b>ww</b>.example.org instead of "
                             "<b>www</b>.example.org").encode("utf8"))
-            html = html.replace("@LI-2@",
+            html = html.replace(
+                "@LI-2@",
                 self.trUtf8(
                     "If the address is correct, try checking the network "
                     "connection.").encode("utf8"))
-            html = html.replace("@LI-3@",
+            html = html.replace(
+                "@LI-3@",
                 self.trUtf8(
                     "If your computer or network is protected by a firewall "
                     "or proxy, make sure that the browser is permitted to "
                     "access the network.").encode("utf8"))
-            html = html.replace("@LI-4@",
+            html = html.replace(
+                "@LI-4@",
                 self.trUtf8("If your cache policy is set to offline browsing,"
                             "only pages in the local cache are available.")\
                 .encode("utf8"))
@@ -540,7 +545,8 @@
                 self.mainFrame().url(), self.__sslConfiguration, self.view())
             widget.showAt(pos)
         else:
-            E5MessageBox.warning(self.view(),
+            E5MessageBox.warning(
+                self.view(),
                 self.trUtf8("SSL Info"),
                 self.trUtf8("""This site does not contain SSL information."""))
     
@@ -819,7 +825,8 @@
                 name = QUrl.fromLocalFile(name.toString())
             
             if not QFileInfo(name.toLocalFile()).exists():
-                E5MessageBox.critical(self,
+                E5MessageBox.critical(
+                    self,
                     self.trUtf8("eric5 Web Browser"),
                     self.trUtf8(
                         """<p>The file <b>{0}</b> does not exist.</p>""")\
@@ -832,18 +839,24 @@
                name.toLocalFile().endswith(".CHM"):
                 started = QDesktopServices.openUrl(name)
                 if not started:
-                    E5MessageBox.critical(self,
+                    E5MessageBox.critical(
+                        self,
                         self.trUtf8("eric5 Web Browser"),
-                        self.trUtf8("""<p>Could not start a viewer"""
-                        """ for file <b>{0}</b>.</p>""").format(name.path()))
+                        self.trUtf8(
+                            """<p>Could not start a viewer"""
+                            """ for file <b>{0}</b>.</p>""")
+                        .format(name.path()))
                 return
         elif name.scheme() in ["mailto"]:
             started = QDesktopServices.openUrl(name)
             if not started:
-                E5MessageBox.critical(self,
+                E5MessageBox.critical(
+                    self,
                     self.trUtf8("eric5 Web Browser"),
-                    self.trUtf8("""<p>Could not start an application"""
-                    """ for URL <b>{0}</b>.</p>""").format(name.toString()))
+                    self.trUtf8(
+                        """<p>Could not start an application"""
+                        """ for URL <b>{0}</b>.</p>""")
+                    .format(name.toString()))
             return
         elif name.scheme() == "javascript":
             scriptSource = QUrl.fromPercentEncoding(name.toString(
@@ -857,10 +870,13 @@
                name.toString().endswith(".CHM"):
                 started = QDesktopServices.openUrl(name)
                 if not started:
-                    E5MessageBox.critical(self,
+                    E5MessageBox.critical(
+                        self,
                         self.trUtf8("eric5 Web Browser"),
-                        self.trUtf8("""<p>Could not start a viewer"""
-                        """ for file <b>{0}</b>.</p>""").format(name.path()))
+                        self.trUtf8(
+                            """<p>Could not start a viewer"""
+                            """ for file <b>{0}</b>.</p>""")
+                        .format(name.path()))
                 return
         
         if requestData is not None:
@@ -1064,17 +1080,21 @@
         frameAtPos = self.page().frameAt(evt.pos())
         hit = self.page().mainFrame().hitTestContent(evt.pos())
         if not hit.linkUrl().isEmpty():
-            menu.addAction(UI.PixmapCache.getIcon("openNewTab.png"),
+            menu.addAction(
+                UI.PixmapCache.getIcon("openNewTab.png"),
                 self.trUtf8("Open Link in New Tab\tCtrl+LMB"),
                 self.__openLinkInNewTab).setData(hit.linkUrl())
             menu.addSeparator()
-            menu.addAction(UI.PixmapCache.getIcon("download.png"),
+            menu.addAction(
+                UI.PixmapCache.getIcon("download.png"),
                 self.trUtf8("Save Lin&k"), self.__downloadLink)
-            menu.addAction(UI.PixmapCache.getIcon("bookmark22.png"),
+            menu.addAction(
+                UI.PixmapCache.getIcon("bookmark22.png"),
                 self.trUtf8("Bookmark this Link"), self.__bookmarkLink)\
                 .setData(hit.linkUrl())
             menu.addSeparator()
-            menu.addAction(UI.PixmapCache.getIcon("editCopy.png"),
+            menu.addAction(
+                UI.PixmapCache.getIcon("editCopy.png"),
                 self.trUtf8("Copy Link to Clipboard"), self.__copyLink)
             menu.addAction(
                 UI.PixmapCache.getIcon("mailSend.png"),
@@ -1090,15 +1110,18 @@
         if not hit.imageUrl().isEmpty():
             if not menu.isEmpty():
                 menu.addSeparator()
-            menu.addAction(UI.PixmapCache.getIcon("openNewTab.png"),
+            menu.addAction(
+                UI.PixmapCache.getIcon("openNewTab.png"),
                 self.trUtf8("Open Image in New Tab"),
                 self.__openLinkInNewTab).setData(hit.imageUrl())
             menu.addSeparator()
-            menu.addAction(UI.PixmapCache.getIcon("download.png"),
+            menu.addAction(
+                UI.PixmapCache.getIcon("download.png"),
                 self.trUtf8("Save Image"), self.__downloadImage)
             menu.addAction(
                 self.trUtf8("Copy Image to Clipboard"), self.__copyImage)
-            menu.addAction(UI.PixmapCache.getIcon("editCopy.png"),
+            menu.addAction(
+                UI.PixmapCache.getIcon("editCopy.png"),
                 self.trUtf8("Copy Image Location to Clipboard"),
                 self.__copyLocation).setData(hit.imageUrl().toString())
             menu.addAction(
@@ -1106,7 +1129,8 @@
                 self.trUtf8("Send Image Link"),
                 self.__sendLink).setData(hit.imageUrl())
             menu.addSeparator()
-            menu.addAction(UI.PixmapCache.getIcon("adBlockPlus.png"),
+            menu.addAction(
+                UI.PixmapCache.getIcon("adBlockPlus.png"),
                 self.trUtf8("Block Image"), self.__blockImage)\
                 .setData(hit.imageUrl().toString())
             if Preferences.getHelp("VirusTotalEnabled") and \
@@ -1145,13 +1169,16 @@
                         UI.PixmapCache.getIcon("audioVolumeMuted.png"),
                         self.trUtf8("Mute"), self.__muteMedia)
                 menu.addSeparator()
-                menu.addAction(UI.PixmapCache.getIcon("editCopy.png"),
+                menu.addAction(
+                    UI.PixmapCache.getIcon("editCopy.png"),
                     self.trUtf8("Copy Media Address to Clipboard"),
                     self.__copyLocation).setData(videoUrl.toString())
-                menu.addAction(UI.PixmapCache.getIcon("mailSend.png"),
+                menu.addAction(
+                    UI.PixmapCache.getIcon("mailSend.png"),
                     self.trUtf8("Send Media Address"), self.__sendLink)\
                     .setData(videoUrl)
-                menu.addAction(UI.PixmapCache.getIcon("download.png"),
+                menu.addAction(
+                    UI.PixmapCache.getIcon("download.png"),
                     self.trUtf8("Save Media"), self.__downloadMedia)\
                     .setData(videoUrl)
             
@@ -1196,35 +1223,46 @@
             fmenu = QMenu(self.trUtf8("This Frame"))
             frameUrl = self.__clickedFrame.url()
             if frameUrl.isValid():
-                fmenu.addAction(self.trUtf8("Show &only this frame"),
+                fmenu.addAction(
+                    self.trUtf8("Show &only this frame"),
                     self.__loadClickedFrame)
-                fmenu.addAction(UI.PixmapCache.getIcon("openNewTab.png"),
+                fmenu.addAction(
+                    UI.PixmapCache.getIcon("openNewTab.png"),
                     self.trUtf8("Show in new &tab"),
                     self.__openLinkInNewTab).setData(self.__clickedFrame.url())
                 fmenu.addSeparator()
-            fmenu.addAction(UI.PixmapCache.getIcon("print.png"),
+            fmenu.addAction(
+                UI.PixmapCache.getIcon("print.png"),
                 self.trUtf8("&Print"), self.__printClickedFrame)
-            fmenu.addAction(UI.PixmapCache.getIcon("printPreview.png"),
+            fmenu.addAction(
+                UI.PixmapCache.getIcon("printPreview.png"),
                 self.trUtf8("Print Preview"), self.__printPreviewClickedFrame)
-            fmenu.addAction(UI.PixmapCache.getIcon("printPdf.png"),
+            fmenu.addAction(
+                UI.PixmapCache.getIcon("printPdf.png"),
                 self.trUtf8("Print as PDF"), self.__printPdfClickedFrame)
             fmenu.addSeparator()
-            fmenu.addAction(UI.PixmapCache.getIcon("zoomIn.png"),
+            fmenu.addAction(
+                UI.PixmapCache.getIcon("zoomIn.png"),
                 self.trUtf8("Zoom &in"), self.__zoomInClickedFrame)
-            fmenu.addAction(UI.PixmapCache.getIcon("zoomReset.png"),
+            fmenu.addAction(
+                UI.PixmapCache.getIcon("zoomReset.png"),
                 self.trUtf8("Zoom &reset"), self.__zoomResetClickedFrame)
-            fmenu.addAction(UI.PixmapCache.getIcon("zoomOut.png"),
+            fmenu.addAction(
+                UI.PixmapCache.getIcon("zoomOut.png"),
                 self.trUtf8("Zoom &out"), self.__zoomOutClickedFrame)
             fmenu.addSeparator()
-            fmenu.addAction(self.trUtf8("Show frame so&urce"),
+            fmenu.addAction(
+                self.trUtf8("Show frame so&urce"),
                 self.__showClickedFrameSource)
             
             menu.addMenu(fmenu)
             menu.addSeparator()
         
-        menu.addAction(UI.PixmapCache.getIcon("bookmark22.png"),
+        menu.addAction(
+            UI.PixmapCache.getIcon("bookmark22.png"),
             self.trUtf8("Bookmark this Page"), self.addBookmark)
-        menu.addAction(UI.PixmapCache.getIcon("mailSend.png"),
+        menu.addAction(
+            UI.PixmapCache.getIcon("mailSend.png"),
             self.trUtf8("Send Page Link"), self.__sendLink).setData(self.url())
         menu.addSeparator()
         self.__userAgentMenu = UserAgentMenu(self.trUtf8("User Agent"),
@@ -1264,7 +1302,8 @@
             
             from .HelpLanguagesDialog import HelpLanguagesDialog
             languages = Preferences.toList(
-                Preferences.Prefs.settings.value("Help/AcceptLanguages",
+                Preferences.Prefs.settings.value(
+                    "Help/AcceptLanguages",
                     HelpLanguagesDialog.defaultAcceptLanguages()))
             if languages:
                 language = languages[0]
@@ -1272,13 +1311,15 @@
                 googleTranslatorUrl = QUrl(
                     "http://translate.google.com/#auto|{0}|{1}".format(
                         langCode, self.selectedText()))
-                menu.addAction(UI.PixmapCache.getIcon("translate.png"),
+                menu.addAction(
+                    UI.PixmapCache.getIcon("translate.png"),
                     self.trUtf8("Google Translate"), self.__openLinkInNewTab)\
                     .setData(googleTranslatorUrl)
                 wiktionaryUrl = QUrl(
                     "http://{0}.wiktionary.org/wiki/Special:Search?search={1}"
                     .format(langCode, self.selectedText()))
-                menu.addAction(UI.PixmapCache.getIcon("wikipedia.png"),
+                menu.addAction(
+                    UI.PixmapCache.getIcon("wikipedia.png"),
                     self.trUtf8("Dictionary"), self.__openLinkInNewTab)\
                     .setData(wiktionaryUrl)
                 menu.addSeparator()
@@ -1298,7 +1339,8 @@
                            self.__addSearchEngine).setData(element)
             menu.addSeparator()
         
-        menu.addAction(UI.PixmapCache.getIcon("webInspector.png"),
+        menu.addAction(
+            UI.PixmapCache.getIcon("webInspector.png"),
             self.trUtf8("Web Inspector..."), self.__webInspector)
         
         menu.exec_(evt.globalPos())
@@ -1472,7 +1514,8 @@
         
         method = formElement.attribute("method", "get").lower()
         if method != "get":
-            E5MessageBox.warning(self,
+            E5MessageBox.warning(
+                self,
                 self.trUtf8("Method not supported"),
                 self.trUtf8(
                     """{0} method is not supported.""").format(method.upper()))
@@ -1914,21 +1957,26 @@
             html = html.replace("@FAVICON@", imageBuffer.buffer().toBase64())
         html = html.replace("@TITLE@", title.encode("utf8"))
         html = html.replace("@H1@", reply.errorString().encode("utf8"))
-        html = html.replace("@H2@", self.trUtf8("When connecting to: {0}.")\
-            .format(urlString).encode("utf8"))
-        html = html.replace("@LI-1@",
+        html = html.replace(
+            "@H2@", self.trUtf8("When connecting to: {0}.")\
+                .format(urlString).encode("utf8"))
+        html = html.replace(
+            "@LI-1@",
             self.trUtf8("Check the address for errors such as "
                         "<b>ww</b>.example.org instead of "
                         "<b>www</b>.example.org").encode("utf8"))
-        html = html.replace("@LI-2@",
+        html = html.replace(
+            "@LI-2@",
             self.trUtf8("If the address is correct, try checking the network "
                         "connection.").encode("utf8"))
-        html = html.replace("@LI-3@",
+        html = html.replace(
+            "@LI-3@",
             self.trUtf8(
                 "If your computer or network is protected by a firewall "
                 "or proxy, make sure that the browser is permitted to "
                 "access the network.").encode("utf8"))
-        html = html.replace("@LI-4@",
+        html = html.replace(
+            "@LI-4@",
             self.trUtf8("If your cache policy is set to offline browsing,"
                         "only pages in the local cache are available.")\
             .encode("utf8"))
@@ -1960,7 +2008,8 @@
             # accessed for the first time
             return
         
-        res = E5MessageBox.yesNo(self,
+        res = E5MessageBox.yesNo(
+            self,
             self.trUtf8("Web Database Quota"),
             self.trUtf8(
                 """<p>The database quota of <strong>{0}</strong> has"""
@@ -2272,7 +2321,8 @@
             try:
                 self.__clickedFrame.print_(printer)
             except AttributeError:
-                E5MessageBox.critical(self,
+                E5MessageBox.critical(
+                    self,
                     self.trUtf8("eric5 Web Browser"),
                     self.trUtf8(
                         """<p>Printing is not available due to a bug in"""
@@ -2315,7 +2365,8 @@
         try:
             self.__clickedFrame.print_(printer)
         except AttributeError:
-            E5MessageBox.critical(self,
+            E5MessageBox.critical(
+                self,
                 self.trUtf8("eric5 Web Browser"),
                 self.trUtf8(
                     """<p>Printing is not available due to a bug in PyQt4."""
@@ -2344,7 +2395,8 @@
             try:
                 self.__clickedFrame.print_(printer)
             except AttributeError:
-                E5MessageBox.critical(self,
+                E5MessageBox.critical(
+                    self,
                     self.trUtf8("eric5 Web Browser"),
                     self.trUtf8(
                         """<p>Printing is not available due to a bug in"""

eric ide

mercurial