16 |
16 |
17 class RefactoringPreviewDialog(QDialog, Ui_RefactoringPreviewDialog): |
17 class RefactoringPreviewDialog(QDialog, Ui_RefactoringPreviewDialog): |
18 """ |
18 """ |
19 Class implementing a dialog to preview refactoring changes. |
19 Class implementing a dialog to preview refactoring changes. |
20 """ |
20 """ |
|
21 |
21 def __init__(self, title, diff, parent=None): |
22 def __init__(self, title, diff, parent=None): |
22 """ |
23 """ |
23 Constructor |
24 Constructor |
24 |
25 |
25 @param title title string to be shown above the diff |
26 @param title title string to be shown above the diff |
26 @type str |
27 @type str |
27 @param diff changes to be shown (unified diff) |
28 @param diff changes to be shown (unified diff) |
28 @type str |
29 @type str |
29 @param parent reference to the parent widget (defaults to None) |
30 @param parent reference to the parent widget (defaults to None) |
30 @type QWidget (optional) |
31 @type QWidget (optional) |
31 """ |
32 """ |
32 super().__init__(parent) |
33 super().__init__(parent) |
33 self.setupUi(self) |
34 self.setupUi(self) |
34 |
35 |
35 self.buttonBox.addButton( |
36 self.buttonBox.addButton( |
36 self.tr("&Apply Changes"), QDialogButtonBox.ButtonRole.AcceptRole) |
37 self.tr("&Apply Changes"), QDialogButtonBox.ButtonRole.AcceptRole |
37 |
38 ) |
|
39 |
38 self.highlighter = DiffHighlighter(self.previewEdit.document()) |
40 self.highlighter = DiffHighlighter(self.previewEdit.document()) |
39 |
41 |
40 self.titleLabel.setText(title) |
42 self.titleLabel.setText(title) |
41 self.previewEdit.setPlainText(diff) |
43 self.previewEdit.setPlainText(diff) |