UI/DiffDialog.py

branch
Py2 comp.
changeset 3484
645c12de6b0c
parent 3178
f25fc1364c88
parent 3190
a9a94491c4fd
child 3656
441956d8fce5
--- a/UI/DiffDialog.py	Sun Mar 30 22:00:14 2014 +0200
+++ b/UI/DiffDialog.py	Thu Apr 03 23:05:31 2014 +0200
@@ -24,6 +24,7 @@
 
 import Utilities
 import Preferences
+import UI.PixmapCache
 
 from difflib import SequenceMatcher
 
@@ -212,17 +213,20 @@
         super(DiffDialog, self).__init__(parent)
         self.setupUi(self)
         
+        self.file1Button.setIcon(UI.PixmapCache.getIcon("open.png"))
+        self.file2Button.setIcon(UI.PixmapCache.getIcon("open.png"))
+        
         self.file1Completer = E5FileCompleter(self.file1Edit)
         self.file2Completer = E5FileCompleter(self.file2Edit)
         
         self.diffButton = self.buttonBox.addButton(
-            self.trUtf8("Compare"), QDialogButtonBox.ActionRole)
+            self.tr("Compare"), QDialogButtonBox.ActionRole)
         self.diffButton.setToolTip(
-            self.trUtf8("Press to perform the comparison of the two files"))
+            self.tr("Press to perform the comparison of the two files"))
         self.saveButton = self.buttonBox.addButton(
-            self.trUtf8("Save"), QDialogButtonBox.ActionRole)
+            self.tr("Save"), QDialogButtonBox.ActionRole)
         self.saveButton.setToolTip(
-            self.trUtf8("Save the output to a patch file"))
+            self.tr("Save the output to a patch file"))
         self.diffButton.setEnabled(False)
         self.saveButton.setEnabled(False)
         self.diffButton.setDefault(True)
@@ -287,9 +291,9 @@
             
         fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter(
             self,
-            self.trUtf8("Save Diff"),
+            self.tr("Save Diff"),
             fname,
-            self.trUtf8("Patch Files (*.diff)"),
+            self.tr("Patch Files (*.diff)"),
             None,
             E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite))
         
@@ -304,9 +308,9 @@
         if QFileInfo(fname).exists():
             res = E5MessageBox.yesNo(
                 self,
-                self.trUtf8("Save Diff"),
-                self.trUtf8("<p>The patch file <b>{0}</b> already exists."
-                            " Overwrite it?</p>").format(fname),
+                self.tr("Save Diff"),
+                self.tr("<p>The patch file <b>{0}</b> already exists."
+                        " Overwrite it?</p>").format(fname),
                 icon=E5MessageBox.Warning)
             if not res:
                 return
@@ -322,8 +326,8 @@
             f.close()
         except IOError as why:
             E5MessageBox.critical(
-                self, self.trUtf8('Save Diff'),
-                self.trUtf8(
+                self, self.tr('Save Diff'),
+                self.tr(
                     '<p>The patch file <b>{0}</b> could not be saved.<br />'
                     'Reason: {1}</p>').format(fname, str(why)))
 
@@ -344,8 +348,8 @@
         except IOError:
             E5MessageBox.critical(
                 self,
-                self.trUtf8("Compare Files"),
-                self.trUtf8(
+                self.tr("Compare Files"),
+                self.tr(
                     """<p>The file <b>{0}</b> could not be read.</p>""")
                 .format(self.filename1))
             return
@@ -362,8 +366,8 @@
         except IOError:
             E5MessageBox.critical(
                 self,
-                self.trUtf8("Compare Files"),
-                self.trUtf8(
+                self.tr("Compare Files"),
+                self.tr(
                     """<p>The file <b>{0}</b> could not be read.</p>""")
                 .format(self.filename2))
             return
@@ -430,7 +434,7 @@
             
         if paras == 0:
             self.__appendText(
-                self.trUtf8('There is no difference.'), self.cNormalFormat)
+                self.tr('There is no difference.'), self.cNormalFormat)
 
     def __generateContextDiff(self, a, b, fromfile, tofile,
                               fromfiledate, tofiledate):
@@ -465,7 +469,7 @@
             
         if paras == 0:
             self.__appendText(
-                self.trUtf8('There is no difference.'), self.cNormalFormat)
+                self.tr('There is no difference.'), self.cNormalFormat)
 
     def __fileChanged(self):
         """
@@ -486,7 +490,7 @@
         """
         filename = E5FileDialog.getOpenFileName(
             self,
-            self.trUtf8("Select file to compare"),
+            self.tr("Select file to compare"),
             lineEdit.text(),
             "")
             

eric ide

mercurial