5 |
5 |
6 """ |
6 """ |
7 Module implementing the Refactoring dialog base class. |
7 Module implementing the Refactoring dialog base class. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt5.QtCore import Qt |
10 from PyQt6.QtCore import Qt |
11 from PyQt5.QtWidgets import QDialog |
11 from PyQt6.QtWidgets import QDialog |
12 |
12 |
13 from E5Gui.E5Application import e5App |
13 from EricWidgets.EricApplication import ericApp |
14 |
14 |
15 |
15 |
16 class RefactoringDialogBase(QDialog): |
16 class RefactoringDialogBase(QDialog): |
17 """ |
17 """ |
18 Class implementing the Refactoring dialog base class. |
18 Class implementing the Refactoring dialog base class. |
27 @type str |
27 @type str |
28 @param parent reference to the parent widget |
28 @param parent reference to the parent widget |
29 @type QWidget |
29 @type QWidget |
30 """ |
30 """ |
31 QDialog.__init__(self, parent) |
31 QDialog.__init__(self, parent) |
32 self.setAttribute(Qt.WA_DeleteOnClose) |
32 self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose) |
33 self.setWindowTitle(title) |
33 self.setWindowTitle(title) |
34 |
34 |
35 self._ui = parent |
35 self._ui = parent |
36 self._refactoring = refactoring |
36 self._refactoring = refactoring |
37 self._title = title |
37 self._title = title |
76 @type dict |
76 @type dict |
77 """ |
77 """ |
78 from .ChangesPreviewDialog import ChangesPreviewDialog |
78 from .ChangesPreviewDialog import ChangesPreviewDialog |
79 dlg = ChangesPreviewDialog( |
79 dlg = ChangesPreviewDialog( |
80 data["Description"], data["Changes"], self) |
80 data["Description"], data["Changes"], self) |
81 if dlg.exec() == QDialog.Accepted: |
81 if dlg.exec() == QDialog.DialogCode.Accepted: |
82 self.applyChanges() |
82 self.applyChanges() |
83 |
83 |
84 def applyChanges(self): |
84 def applyChanges(self): |
85 """ |
85 """ |
86 Public method to apply the changes. |
86 Public method to apply the changes. |
116 method, params = self.__queue.pop(0) |
116 method, params = self.__queue.pop(0) |
117 self._refactoring.sendJson(method, params) |
117 self._refactoring.sendJson(method, params) |
118 elif subcommand == "ChangesApplied": |
118 elif subcommand == "ChangesApplied": |
119 if self._refactoring.handleRopeError(data): |
119 if self._refactoring.handleRopeError(data): |
120 self._refactoring.refreshEditors(data["ChangedFiles"]) |
120 self._refactoring.refreshEditors(data["ChangedFiles"]) |
121 p = e5App().getObject("Project") |
121 p = ericApp().getObject("Project") |
122 if p.isDirty(): |
122 if p.isDirty(): |
123 p.saveProject() |
123 p.saveProject() |
124 |
124 |
125 self.accept() |
125 self.accept() |
126 |
126 |