10 import re |
10 import re |
11 from difflib import _mdiff, IS_CHARACTER_JUNK |
11 from difflib import _mdiff, IS_CHARACTER_JUNK |
12 |
12 |
13 from PyQt4.QtCore import QTimer, QEvent, pyqtSlot |
13 from PyQt4.QtCore import QTimer, QEvent, pyqtSlot |
14 from PyQt4.QtGui import QWidget, QColor, QFontMetrics, QBrush, QApplication, \ |
14 from PyQt4.QtGui import QWidget, QColor, QFontMetrics, QBrush, QApplication, \ |
15 QTextCursor, QDialogButtonBox, QMainWindow |
15 QTextCursor, QDialogButtonBox |
16 |
16 |
17 from E5Gui.E5Completers import E5FileCompleter |
17 from E5Gui.E5Completers import E5FileCompleter |
18 from E5Gui import E5MessageBox, E5FileDialog |
18 from E5Gui import E5MessageBox, E5FileDialog |
|
19 from E5Gui.E5MainWindow import E5MainWindow |
19 |
20 |
20 import UI.PixmapCache |
21 import UI.PixmapCache |
21 |
22 |
22 from .Ui_CompareDialog import Ui_CompareDialog |
23 from .Ui_CompareDialog import Ui_CompareDialog |
23 |
24 |
24 import Utilities |
25 import Utilities |
|
26 import Preferences |
25 |
27 |
26 |
28 |
27 def sbsdiff(a, b, linenumberwidth=4): |
29 def sbsdiff(a, b, linenumberwidth=4): |
28 """ |
30 """ |
29 Compare two sequences of lines; generate the delta for display side by side. |
31 Compare two sequences of lines; generate the delta for display side by side. |
421 else: |
423 else: |
422 self.hsb1.valueChanged.disconnect(self.hsb2.setValue) |
424 self.hsb1.valueChanged.disconnect(self.hsb2.setValue) |
423 self.hsb2.valueChanged.disconnect(self.hsb1.setValue) |
425 self.hsb2.valueChanged.disconnect(self.hsb1.setValue) |
424 |
426 |
425 |
427 |
426 class CompareWindow(QMainWindow): |
428 class CompareWindow(E5MainWindow): |
427 """ |
429 """ |
428 Main window class for the standalone dialog. |
430 Main window class for the standalone dialog. |
429 """ |
431 """ |
430 def __init__(self, files=[], parent=None): |
432 def __init__(self, files=[], parent=None): |
431 """ |
433 """ |
434 @param files list of files to compare and their label |
436 @param files list of files to compare and their label |
435 (list of two tuples of two strings) |
437 (list of two tuples of two strings) |
436 @param parent reference to the parent widget (QWidget) |
438 @param parent reference to the parent widget (QWidget) |
437 """ |
439 """ |
438 super().__init__(parent) |
440 super().__init__(parent) |
|
441 |
|
442 self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) |
|
443 |
439 self.cw = CompareDialog(files, self) |
444 self.cw = CompareDialog(files, self) |
440 self.cw.installEventFilter(self) |
445 self.cw.installEventFilter(self) |
441 size = self.cw.size() |
446 size = self.cw.size() |
442 self.setCentralWidget(self.cw) |
447 self.setCentralWidget(self.cw) |
443 self.resize(size) |
448 self.resize(size) |