UI/CompareDialog.py

changeset 2835
678978fe9ffd
parent 2580
7403bc14ea26
child 2836
289ad03f0e57
diff -r 2997bc65a48b -r 678978fe9ffd UI/CompareDialog.py
--- a/UI/CompareDialog.py	Sun Jul 28 14:22:01 2013 +0200
+++ b/UI/CompareDialog.py	Wed Jul 31 18:34:43 2013 +0200
@@ -242,6 +242,43 @@
                     .format(filename2))
             return
         
+        self.__compare(lines1, lines2)
+        
+    def compare(self, lines1, lines2, name1="", name2=""):
+        """
+        Public method to compare two lists of text.
+        
+        @param lines1 text to compare against (string or list of strings)
+        @param lines2 text to compare (string or list of strings)
+        @keyparam name1 name to be shown for the first text (string)
+        @keyparam name2 name to be shown for the second text (string)
+        """
+        if name1 == "" or name2 == "":
+            self.filesGroup.hide()
+        else:
+            self.file1Button.hide()
+            self.file2Button.hide()
+            self.file1Edit.setText(name1)
+            self.file1Edit.setReadOnly(True)
+            self.file2Edit.setText(name2)
+            self.file2Edit.setReadOnly(True)
+        self.diffButton.setEnabled(False)
+        self.diffButton.hide()
+        
+        if type(lines1) == type(""):
+            lines1 = lines1.splitlines(True)
+        if type(lines2) == type(""):
+            lines2 = lines2.splitlines(True)
+        
+        self.__compare(lines1, lines2)
+        
+    def __compare(self, lines1, lines2):
+        """
+        Private method to compare two lists of text.
+        
+        @param lines1 text to compare against (list of strings)
+        @param lines2 text to compare (list of strings)
+        """
         self.contents_1.clear()
         self.contents_2.clear()
         

eric ide

mercurial