--- a/Helpviewer/HelpBrowserWV.py Fri Nov 01 15:48:48 2013 +0100 +++ b/Helpviewer/HelpBrowserWV.py Sun Nov 03 15:58:22 2013 +0100 @@ -145,7 +145,7 @@ @return search URL (string) """ return bytes( - self.__mw.openSearchManager().currentEngine()\ + self.__mw.openSearchManager().currentEngine() .searchUrl(searchStr).toEncoded()).decode() ############################################################################### @@ -256,7 +256,7 @@ """ try: if extension in [QWebPage.ErrorPageExtension, - QWebPage.ChooseMultipleFilesExtension]: + QWebPage.ChooseMultipleFilesExtension]: return True except AttributeError: pass @@ -342,13 +342,13 @@ htmlFile.open(QFile.ReadOnly) html = htmlFile.readAll() pixmap = qApp.style()\ - .standardIcon(QStyle.SP_MessageBoxWarning).pixmap(48, 48) + .standardIcon(QStyle.SP_MessageBoxWarning).pixmap(48, 48) imageBuffer = QBuffer() imageBuffer.open(QIODevice.ReadWrite) if pixmap.save(imageBuffer, "PNG"): html = html.replace("@IMAGE@", imageBuffer.buffer().toBase64()) pixmap = qApp.style()\ - .standardIcon(QStyle.SP_MessageBoxWarning).pixmap(16, 16) + .standardIcon(QStyle.SP_MessageBoxWarning).pixmap(16, 16) imageBuffer = QBuffer() imageBuffer.open(QIODevice.ReadWrite) if pixmap.save(imageBuffer, "PNG"): @@ -357,7 +357,7 @@ html = html.replace("@TITLE@", title.encode("utf8")) html = html.replace("@H1@", info.errorString.encode("utf8")) html = html.replace( - "@H2@", self.trUtf8("When connecting to: {0}.")\ + "@H2@", self.trUtf8("When connecting to: {0}.") .format(urlString).encode("utf8")) html = html.replace( "@LI-1@", @@ -378,7 +378,7 @@ html = html.replace( "@LI-4@", self.trUtf8("If your cache policy is set to offline browsing," - "only pages in the local cache are available.")\ + "only pages in the local cache are available.") .encode("utf8")) html = html.replace( "@BUTTON@", self.trUtf8("Try Again").encode("utf8")) @@ -564,7 +564,7 @@ return False certificateDict = Preferences.toDict( - Preferences.Prefs.settings.value("Ssl/CaCertificatesDict")) + Preferences.Prefs.settings.value("Ssl/CaCertificatesDict")) for server in certificateDict: localCAList = QSslCertificate.fromData(certificateDict[server]) for cert in certList: @@ -829,8 +829,8 @@ self, self.trUtf8("eric5 Web Browser"), self.trUtf8( - """<p>The file <b>{0}</b> does not exist.</p>""")\ - .format(name.toLocalFile())) + """<p>The file <b>{0}</b> does not exist.</p>""") + .format(name.toLocalFile())) return if name.toLocalFile().endswith(".pdf") or \ @@ -1199,7 +1199,7 @@ act.setVisible(False) directionFound = True elif self.pageAction(QWebPage.ToggleBold) in \ - act.menu().actions(): + act.menu().actions(): act.setVisible(False) elif act == self.pageAction(QWebPage.InspectElement): # we have our own inspect entry @@ -1353,9 +1353,9 @@ @return flag indicating a valid URL (boolean) """ return url.isValid() and \ - bool(url.host()) and \ - bool(url.scheme()) and \ - "." in url.host() + bool(url.host()) and \ + bool(url.scheme()) and \ + "." in url.host() def __openLinkInNewTab(self): """ @@ -1729,7 +1729,7 @@ if self.__enableAccessKeys: self.__accessKeysPressed = ( - evt.modifiers() == Qt.ControlModifier and \ + evt.modifiers() == Qt.ControlModifier and evt.key() == Qt.Key_Control) if not self.__accessKeysPressed: if self.__checkForAccessKey(evt): @@ -1944,13 +1944,13 @@ htmlFile.open(QFile.ReadOnly) html = htmlFile.readAll() pixmap = qApp.style()\ - .standardIcon(QStyle.SP_MessageBoxWarning).pixmap(48, 48) + .standardIcon(QStyle.SP_MessageBoxWarning).pixmap(48, 48) imageBuffer = QBuffer() imageBuffer.open(QIODevice.ReadWrite) if pixmap.save(imageBuffer, "PNG"): html = html.replace("@IMAGE@", imageBuffer.buffer().toBase64()) pixmap = qApp.style()\ - .standardIcon(QStyle.SP_MessageBoxWarning).pixmap(16, 16) + .standardIcon(QStyle.SP_MessageBoxWarning).pixmap(16, 16) imageBuffer = QBuffer() imageBuffer.open(QIODevice.ReadWrite) if pixmap.save(imageBuffer, "PNG"): @@ -1958,8 +1958,8 @@ 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")) + "@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 " @@ -1978,7 +1978,7 @@ html = html.replace( "@LI-4@", self.trUtf8("If your cache policy is set to offline browsing," - "only pages in the local cache are available.")\ + "only pages in the local cache are available.") .encode("utf8")) html = html.replace( "@BUTTON@", self.trUtf8("Try Again").encode("utf8")) @@ -2014,9 +2014,9 @@ self.trUtf8( """<p>The database quota of <strong>{0}</strong> has""" """ been exceeded while accessing database <strong>{1}""" - """</strong>.</p><p>Shall it be changed?</p>""")\ - .format(self.__dataString(securityOrigin.databaseQuota()), - databaseName), + """</strong>.</p><p>Shall it be changed?</p>""") + .format(self.__dataString(securityOrigin.databaseQuota()), + databaseName), yesDefault=True) if res: newQuota, ok = QInputDialog.getInt( @@ -2024,7 +2024,7 @@ self.trUtf8("New Web Database Quota"), self.trUtf8( "Enter the new quota in MB (current = {0}, used = {1}; " - "step size = 5 MB):"\ + "step size = 5 MB):" .format( self.__dataString(securityOrigin.databaseQuota()), self.__dataString(securityOrigin.databaseUsage()))), @@ -2256,8 +2256,8 @@ for linkElement in linkElementsList: # only atom+xml and rss+xml will be processed if linkElement.attribute("rel") != "alternate" or \ - (linkElement.attribute("type") != "application/rss+xml" and \ - linkElement.attribute("type") != "application/atom+xml"): + (linkElement.attribute("type") != "application/rss+xml" and + linkElement.attribute("type") != "application/atom+xml"): continue title = linkElement.attribute("title") @@ -2314,7 +2314,9 @@ Preferences.getPrinter("BottomMargin") * 10, QPrinter.Millimeter ) - printer.setPrinterName(Preferences.getPrinter("PrinterName")) + printerName = Preferences.getPrinter("PrinterName") + if printerName: + self.setPrinterName(printerName) printDialog = QPrintDialog(printer, self) if printDialog.exec_() == QDialog.Accepted: @@ -2350,7 +2352,9 @@ Preferences.getPrinter("BottomMargin") * 10, QPrinter.Millimeter ) - printer.setPrinterName(Preferences.getPrinter("PrinterName")) + printerName = Preferences.getPrinter("PrinterName") + if printerName: + self.setPrinterName(printerName) preview = QPrintPreviewDialog(printer, self) preview.paintRequested.connect(self.__generatePrintPreviewClickedFrame) @@ -2382,7 +2386,9 @@ printer.setColorMode(QPrinter.Color) else: printer.setColorMode(QPrinter.GrayScale) - printer.setPrinterName(Preferences.getPrinter("PrinterName")) + printerName = Preferences.getPrinter("PrinterName") + if printerName: + self.setPrinterName(printerName) printer.setOutputFormat(QPrinter.PdfFormat) name = self.__clickedFrame.url().path().rsplit('/', 1)[-1] if name: