eric7/JediInterface/RefactoringPreviewDialog.py

branch
eric7
changeset 8666
3a62b4009df9
child 8881
54e42bc2437a
equal deleted inserted replaced
8664:5aa1070daa48 8666:3a62b4009df9
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2021 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog to preview refactoring changes.
8 """
9
10 from PyQt6.QtWidgets import QDialog, QDialogButtonBox
11
12 from UI.DiffHighlighter import DiffHighlighter
13
14 from .Ui_RefactoringPreviewDialog import Ui_RefactoringPreviewDialog
15
16
17 class RefactoringPreviewDialog(QDialog, Ui_RefactoringPreviewDialog):
18 """
19 Class implementing a dialog to preview refactoring changes.
20 """
21 def __init__(self, title, diff, parent=None):
22 """
23 Constructor
24
25 @param title title string to be shown above the diff
26 @type str
27 @param diff changes to be shown (unified diff)
28 @type str
29 @param parent reference to the parent widget (defaults to None)
30 @type QWidget (optional)
31 """
32 super().__init__(parent)
33 self.setupUi(self)
34
35 self.buttonBox.addButton(
36 self.tr("&Apply Changes"), QDialogButtonBox.ButtonRole.AcceptRole)
37
38 self.highlighter = DiffHighlighter(self.previewEdit.document())
39
40 self.titleLabel.setText(title)
41 self.previewEdit.setPlainText(diff)

eric ide

mercurial