--- a/QScintilla/Exporters/ExporterRTF.py Sat Oct 12 18:25:29 2013 +0200 +++ b/QScintilla/Exporters/ExporterRTF.py Sun Oct 13 12:21:37 2013 +0200 @@ -38,7 +38,8 @@ RTF_INFOOPEN = "{\\info " RTF_INFOCLOSE = "}" RTF_COMMENT = "{\\comment Generated by eric5's RTF export filter.}" - RTF_CREATED = "{\creatim\yr%Y\mo%m\dy%d\hr%H\min%M\sec%S}" # to be used by strftime + # to be used by strftime + RTF_CREATED = "{\creatim\yr%Y\mo%m\dy%d\hr%H\min%M\sec%S}" RTF_BODYOPEN = "" RTF_BODYCLOSE = "}" @@ -86,7 +87,8 @@ def __GetRTFStyleChange(self, last, current): """ - Private method to extract control words that are different between two styles. + Private method to extract control words that are different between two + styles. @param last least recently used style (string) @param current current style (string) @@ -99,7 +101,8 @@ i = 0 while i < 6: lastPos, lastControl = self.__GetRTFNextControl(lastPos, last) - currentPos, currentControl = self.__GetRTFNextControl(currentPos, current) + currentPos, currentControl = self.__GetRTFNextControl(currentPos, + current) if lastControl != currentControl: delta += currentControl i += 1 @@ -130,7 +133,8 @@ if lex: defaultFont = lex.font(QsciScintilla.STYLE_DEFAULT) else: - defaultFont = Preferences.getEditorOtherFonts("DefaultFont") + defaultFont = Preferences.getEditorOtherFonts( + "DefaultFont") else: defaultFont = Preferences.getEditorExporter("RTF/Font") fontface = defaultFont.family() @@ -173,24 +177,26 @@ if wysiwyg: fontKey = None for key, value in list(fonts.items()): - if value.lower() == font.family().lower(): + if value.lower() == \ + font.family().lower(): fontKey = key break if fontKey is None: fonts[fontCount] = font.family() f.write(self.RTF_FONTDEF.format( - fontCount, characterset, font.family())) + fontCount, characterset, + font.family())) fontKey = fontCount fontCount += 1 - lastStyle = self.RTF_SETFONTFACE + "{0:d}".format( - fontKey) + lastStyle = self.RTF_SETFONTFACE + \ + "{0:d}".format(fontKey) else: lastStyle = self.RTF_SETFONTFACE + "0" if wysiwyg and QFontInfo(font).pointSize(): lastStyle += self.RTF_SETFONTSIZE + \ - "{0:d}".format( - QFontInfo(font).pointSize() << 1) + "{0:d}".format( + QFontInfo(font).pointSize() << 1) else: lastStyle += self.RTF_SETFONTSIZE + \ "{0:d}".format(fontsize) @@ -231,17 +237,19 @@ lastStyle += self.RTF_ITALIC_OFF styles[istyle] = lastStyle else: - styles[istyle] = self.RTF_SETFONTFACE + "0" + \ - self.RTF_SETFONTSIZE + \ - "{0:d}".format(fontsize) + \ - self.RTF_SETCOLOR + "0" + \ - self.RTF_SETBACKGROUND + "1" + \ - self.RTF_BOLD_OFF + self.RTF_ITALIC_OFF + styles[istyle] = \ + self.RTF_SETFONTFACE + "0" + \ + self.RTF_SETFONTSIZE + \ + "{0:d}".format(fontsize) + \ + self.RTF_SETCOLOR + "0" + \ + self.RTF_SETBACKGROUND + "1" + \ + self.RTF_BOLD_OFF + self.RTF_ITALIC_OFF istyle += 1 else: styles[0] = self.RTF_SETFONTFACE + "0" + \ - self.RTF_SETFONTSIZE + "{0:d}".format(fontsize) + \ + self.RTF_SETFONTSIZE + \ + "{0:d}".format(fontsize) + \ self.RTF_SETCOLOR + "0" + \ self.RTF_SETBACKGROUND + "1" + \ self.RTF_BOLD_OFF + self.RTF_ITALIC_OFF @@ -278,7 +286,8 @@ ch = self.editor.byteAt(pos) style = self.editor.styleAt(pos) if style != styleCurrent: - deltaStyle = self.__GetRTFStyleChange(lastStyle, styles[style]) + deltaStyle = self.__GetRTFStyleChange( + lastStyle, styles[style]) if deltaStyle: f.write(deltaStyle) styleCurrent = style @@ -337,11 +346,12 @@ f.close() except IOError as err: QApplication.restoreOverrideCursor() - E5MessageBox.critical(self.editor, + E5MessageBox.critical( + self.editor, self.trUtf8("Export source"), self.trUtf8( - """<p>The source could not be exported to <b>{0}</b>.</p>""" - """<p>Reason: {1}</p>""")\ + """<p>The source could not be exported to""" + """ <b>{0}</b>.</p><p>Reason: {1}</p>""")\ .format(filename, str(err))) finally: QApplication.restoreOverrideCursor()