Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py

changeset 12
1d8dd9706f46
parent 0
de9c2efb9d02
child 13
1af94a91f439
--- a/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py	Fri Jan 01 16:11:36 2010 +0000
+++ b/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py	Sat Jan 02 15:11:35 2010 +0000
@@ -16,9 +16,10 @@
 
 from E4Gui.E4Application import e4App
 
-from Ui_SvnDiffDialog import Ui_SvnDiffDialog
+from .Ui_SvnDiffDialog import Ui_SvnDiffDialog
 
 import Utilities
+import Preferences
 
 class SvnDiffDialog(QWidget, Ui_SvnDiffDialog):
     """
@@ -137,7 +138,7 @@
                 self.summaryPath = urls[0]
             args.append("--old=%s" % urls[0])
             args.append("--new=%s" % urls[1])
-            if type(fn) is types.ListType:
+            if isinstance(fn, list):
                 dname, fnames = self.vcs.splitPathList(fn)
             else:
                 dname, fname = self.vcs.splitPath(fn)
@@ -152,7 +153,7 @@
             for fname in fnames:
                 args.append(path + fname)
         else:
-            if type(fn) is types.ListType:
+            if isinstance(fn, list):
                 dname, fnames = self.vcs.splitPathList(fn)
                 self.vcs.addArguments(args, fnames)
             else:
@@ -215,7 +216,9 @@
         self.process.setReadChannel(QProcess.StandardOutput)
         
         while self.process.canReadLine():
-            line = unicode(self.process.readLine())
+            line = str(self.process.readLine(), 
+                        Preferences.getSystem("IOEncoding"), 
+                        'replace')
             if self.summaryPath:
                 line = line.replace(self.summaryPath + '/', '')
                 line = " ".join(line.split())
@@ -239,7 +242,9 @@
         """
         if self.process is not None:
             self.errorGroup.show()
-            s = unicode(self.process.readAllStandardError())
+            s = str(self.process.readAllStandardError(), 
+                    Preferences.getSystem("IOEncoding"), 
+                    'replace')
             self.errors.insertPlainText(s)
             self.errors.ensureCursorVisible()
         
@@ -260,7 +265,7 @@
         It saves the diff shown in the dialog to a file in the local
         filesystem.
         """
-        if type(self.filename) is types.ListType:
+        if isinstance(self.filename, list):
             if len(self.filename) > 1:
                 fname = self.vcs.splitPathList(self.filename)[0]
             else:
@@ -302,14 +307,14 @@
         fname = Utilities.toNativeSeparators(fname)
         
         try:
-            f = open(fname, "wb")
+            f = open(fname, "w")
             f.write(self.contents.toPlainText())
             f.close()
-        except IOError, why:
+        except IOError as why:
             QMessageBox.critical(self, self.trUtf8('Save Diff'),
                 self.trUtf8('<p>The patch file <b>{0}</b> could not be saved.'
                     '<br>Reason: {1}</p>')
-                    .format(fname, unicode(why)))
+                    .format(fname, str(why)))
         
     def on_passwordCheckBox_toggled(self, isOn):
         """

eric ide

mercurial