4 # |
4 # |
5 |
5 |
6 """ |
6 """ |
7 Module implementing a dialog to compare two files and show the result side by side. |
7 Module implementing a dialog to compare two files and show the result side by side. |
8 """ |
8 """ |
|
9 |
|
10 from __future__ import unicode_literals # __IGNORE_WARNING__ |
9 |
11 |
10 import re |
12 import re |
11 from difflib import _mdiff, IS_CHARACTER_JUNK |
13 from difflib import _mdiff, IS_CHARACTER_JUNK |
12 |
14 |
13 from PyQt4.QtCore import QTimer, QEvent, pyqtSlot |
15 from PyQt4.QtCore import QTimer, QEvent, pyqtSlot |
86 |
88 |
87 @param files list of files to compare and their label |
89 @param files list of files to compare and their label |
88 (list of two tuples of two strings) |
90 (list of two tuples of two strings) |
89 @param parent parent widget (QWidget) |
91 @param parent parent widget (QWidget) |
90 """ |
92 """ |
91 super().__init__(parent) |
93 super(CompareDialog, self).__init__(parent) |
92 self.setupUi(self) |
94 self.setupUi(self) |
93 |
95 |
94 self.file1Completer = E5FileCompleter(self.file1Edit) |
96 self.file1Completer = E5FileCompleter(self.file1Edit) |
95 self.file2Completer = E5FileCompleter(self.file2Edit) |
97 self.file2Completer = E5FileCompleter(self.file2Edit) |
96 |
98 |
168 |
170 |
169 @param filename name of a file to use as the first file (string) |
171 @param filename name of a file to use as the first file (string) |
170 """ |
172 """ |
171 if filename: |
173 if filename: |
172 self.file1Edit.setText(filename) |
174 self.file1Edit.setText(filename) |
173 super().show() |
175 super(CompareDialog, self).show() |
174 |
176 |
175 def __appendText(self, pane, linenumber, line, format, interLine=False): |
177 def __appendText(self, pane, linenumber, line, format, interLine=False): |
176 """ |
178 """ |
177 Private method to append text to the end of the contents pane. |
179 Private method to append text to the end of the contents pane. |
178 |
180 |
435 |
437 |
436 @param files list of files to compare and their label |
438 @param files list of files to compare and their label |
437 (list of two tuples of two strings) |
439 (list of two tuples of two strings) |
438 @param parent reference to the parent widget (QWidget) |
440 @param parent reference to the parent widget (QWidget) |
439 """ |
441 """ |
440 super().__init__(parent) |
442 super(CompareWindow, self).__init__(parent) |
441 |
443 |
442 self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) |
444 self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) |
443 |
445 |
444 self.cw = CompareDialog(files, self) |
446 self.cw = CompareDialog(files, self) |
445 self.cw.installEventFilter(self) |
447 self.cw.installEventFilter(self) |