102 def __init__(self, files=None, parent=None): |
102 def __init__(self, files=None, parent=None): |
103 """ |
103 """ |
104 Constructor |
104 Constructor |
105 |
105 |
106 @param files list of files to compare and their label |
106 @param files list of files to compare and their label |
107 (list of two tuples of two strings) |
107 @type list of two tuples of (str, str) |
108 @param parent parent widget (QWidget) |
108 @param parent parent widget |
|
109 @type QWidget |
109 """ |
110 """ |
110 super().__init__(parent) |
111 super().__init__(parent) |
111 self.setupUi(self) |
112 self.setupUi(self) |
112 |
113 |
113 if files is None: |
114 if files is None: |
262 self.tr("Compare Files"), |
263 self.tr("Compare Files"), |
263 self.tr("""<p>The file <b>{0}</b> could not be read.</p>""").format( |
264 self.tr("""<p>The file <b>{0}</b> could not be read.</p>""").format( |
264 filename1 |
265 filename1 |
265 ), |
266 ), |
266 ) |
267 ) |
|
268 self.filesGroup.show() |
|
269 self.diffButton.show() |
267 return |
270 return |
268 |
271 |
269 filename2 = self.file2Picker.text() |
272 filename2 = self.file2Picker.text() |
270 try: |
273 try: |
271 with open(filename2, "r", encoding="utf-8") as f2: |
274 with open(filename2, "r", encoding="utf-8") as f2: |
276 self.tr("Compare Files"), |
279 self.tr("Compare Files"), |
277 self.tr("""<p>The file <b>{0}</b> could not be read.</p>""").format( |
280 self.tr("""<p>The file <b>{0}</b> could not be read.</p>""").format( |
278 filename2 |
281 filename2 |
279 ), |
282 ), |
280 ) |
283 ) |
|
284 self.filesGroup.show() |
|
285 self.diffButton.show() |
281 return |
286 return |
282 |
287 |
283 self.__compare(lines1, lines2) |
288 self.__compare(lines1, lines2) |
284 |
289 |
285 def compare(self, lines1, lines2, name1="", name2=""): |
290 def compare(self, lines1, lines2, name1="", name2=""): |