7 Module implementing a dialog to compare two files and show the result side by |
7 Module implementing a dialog to compare two files and show the result side by |
8 side. |
8 side. |
9 """ |
9 """ |
10 |
10 |
11 from __future__ import unicode_literals |
11 from __future__ import unicode_literals |
12 try: |
|
13 basestring # __IGNORE_WARNING__ |
|
14 except NameError: |
|
15 basestring = str |
|
16 |
12 |
17 import re |
13 import re |
18 from difflib import _mdiff, IS_CHARACTER_JUNK |
14 from difflib import _mdiff, IS_CHARACTER_JUNK |
19 |
15 |
20 from PyQt5.QtCore import QTimer, QEvent, pyqtSlot |
16 from PyQt5.QtCore import QTimer, QEvent, pyqtSlot |
286 self.file2Picker.setText(name2) |
282 self.file2Picker.setText(name2) |
287 self.file2Picker.setReadOnly(True) |
283 self.file2Picker.setReadOnly(True) |
288 self.diffButton.setEnabled(False) |
284 self.diffButton.setEnabled(False) |
289 self.diffButton.hide() |
285 self.diffButton.hide() |
290 |
286 |
291 if isinstance(lines1, basestring): |
287 if isinstance(lines1, str): |
292 lines1 = lines1.splitlines(True) |
288 lines1 = lines1.splitlines(True) |
293 if isinstance(lines2, basestring): |
289 if isinstance(lines2, str): |
294 lines2 = lines2.splitlines(True) |
290 lines2 = lines2.splitlines(True) |
295 |
291 |
296 self.__compare(lines1, lines2) |
292 self.__compare(lines1, lines2) |
297 |
293 |
298 def __compare(self, lines1, lines2): |
294 def __compare(self, lines1, lines2): |