QScintilla/Exporters/ExporterRTF.py

changeset 12
1d8dd9706f46
parent 0
de9c2efb9d02
child 13
1af94a91f439
--- a/QScintilla/Exporters/ExporterRTF.py	Fri Jan 01 16:11:36 2010 +0000
+++ b/QScintilla/Exporters/ExporterRTF.py	Sat Jan 02 15:11:35 2010 +0000
@@ -16,7 +16,7 @@
 from PyQt4.QtGui import *
 from PyQt4.Qsci import QsciScintilla
 
-from ExporterBase import ExporterBase
+from .ExporterBase import ExporterBase
 
 import Preferences
 
@@ -145,7 +145,7 @@
                 bgColour = self.editor.paper()
             
             try:
-                f = open(filename, "wb")
+                f = open(filename, "w")
                 
                 styles = {}
                 fonts = {}
@@ -169,7 +169,7 @@
                                 font = lex.font(istyle)
                                 if wysiwyg:
                                     fontKey = None
-                                    for key, value in fonts.items():
+                                    for key, value in list(fonts.items()):
                                         if value.lower() == font.family().lower():
                                             fontKey = key
                                             break
@@ -192,7 +192,7 @@
                                 
                                 sColour = lex.color(istyle)
                                 sColourKey = None
-                                for key, value in colors.items():
+                                for key, value in list(colors.items()):
                                     if value == sColour:
                                         sColourKey = key
                                         break
@@ -204,7 +204,7 @@
                                 
                                 sColour = lex.paper(istyle)
                                 sColourKey = None
-                                for key, value in colors.items():
+                                for key, value in list(colors.items()):
                                     if value == sColour:
                                         sColourKey = key
                                         break
@@ -240,7 +240,7 @@
                                 self.RTF_BOLD_OFF + self.RTF_ITALIC_OFF
                 
                 f.write(self.RTF_FONTDEFCLOSE + self.RTF_COLORDEFOPEN)
-                for value in colors.values():
+                for value in list(colors.values()):
                     f.write(self.RTF_COLORDEF % \
                             (value.red(), value.green(), value.blue()))
                 f.write(self.RTF_COLORDEFCLOSE)
@@ -327,14 +327,14 @@
                 
                 f.write(self.RTF_BODYCLOSE)
                 f.close()
-            except IOError, err:
+            except IOError as err:
                 QApplication.restoreOverrideCursor()
                 QMessageBox.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>""")\
-                        .format(filename, unicode(err)),
+                        .format(filename, str(err)),
                     QMessageBox.StandardButtons(\
                         QMessageBox.Ok))
         finally:

eric ide

mercurial