RefactoringRope/RefactoringDialogBase.py

branch
eric7
changeset 389
4f53795beff0
parent 374
958f34e97952
child 396
933b8fcd854f
--- a/RefactoringRope/RefactoringDialogBase.py	Sat Jun 25 18:06:56 2022 +0200
+++ b/RefactoringRope/RefactoringDialogBase.py	Wed Sep 21 15:30:34 2022 +0200
@@ -17,10 +17,11 @@
     """
     Class implementing the Refactoring dialog base class.
     """
+
     def __init__(self, refactoring, title, parent=None):
         """
         Constructor
-        
+
         @param refactoring reference to the main refactoring object
         @type RefactoringServer
         @param title title of the dialog
@@ -31,77 +32,90 @@
         QDialog.__init__(self, parent)
         self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose)
         self.setWindowTitle(title)
-        
+
         self._ui = parent
         self._refactoring = refactoring
         self._title = title
-        
+
         self._changesCalculated = False
-        
+
         self.__queue = []
-    
+
     def getChangeGroupName(self):
         """
         Public method to get the name of the change group.
-        
+
         @return name of the associated change group
         @rtype str
         """
         return self._changeGroupName
-    
+
     def _calculateChanges(self):
         """
         Protected method to initiate the calculation of changes.
-        
+
         @exception NotImplementedError raised to indicate that this method must
             be overridden by subclasses
         """
         raise NotImplementedError("_calculateChanges must be overridden.")
-    
+
     def requestPreview(self):
         """
         Public method to request a preview of the calculated changes.
         """
-        self.__queue.append(("PreviewChanges", {
-            "ChangeGroup": self._changeGroupName,
-        }))
-        
+        self.__queue.append(
+            (
+                "PreviewChanges",
+                {
+                    "ChangeGroup": self._changeGroupName,
+                },
+            )
+        )
+
         self._calculateChanges()
-    
+
     def previewChanges(self, data):
         """
         Public method to preview the changes.
-        
+
         @param data dictionary containing the change data
         @type dict
         """
         from .ChangesPreviewDialog import ChangesPreviewDialog
-        dlg = ChangesPreviewDialog(
-            data["Description"], data["Changes"], self)
+
+        dlg = ChangesPreviewDialog(data["Description"], data["Changes"], self)
         if dlg.exec() == QDialog.DialogCode.Accepted:
             self.applyChanges()
-    
+
     def applyChanges(self):
         """
         Public method to apply the changes.
         """
         if not self._changesCalculated:
-            self.__queue.append(("ApplyChanges", {
-                "ChangeGroup": self._changeGroupName,
-                "Title": self._title,
-            }))
+            self.__queue.append(
+                (
+                    "ApplyChanges",
+                    {
+                        "ChangeGroup": self._changeGroupName,
+                        "Title": self._title,
+                    },
+                )
+            )
             self._calculateChanges()
         else:
-            self._refactoring.sendJson("ApplyChanges", {
-                "ChangeGroup": self._changeGroupName,
-                "Title": self._title,
-            })
-    
+            self._refactoring.sendJson(
+                "ApplyChanges",
+                {
+                    "ChangeGroup": self._changeGroupName,
+                    "Title": self._title,
+                },
+            )
+
     def processChangeData(self, data):
         """
         Public method to process the change data sent by the refactoring
         client.
-        
+
         @param data dictionary containing the change data
         @type dict
         """
@@ -121,18 +135,21 @@
                 p = ericApp().getObject("Project")
                 if p.isDirty():
                     p.saveProject()
-            
+
             self.accept()
-    
+
     def closeEvent(self, evt):
         """
         Protected method handling close events.
-        
+
         @param evt reference to the close event object
         @type QCloseEvent
         """
-        self._refactoring.sendJson("ClearChanges", {
-            "ChangeGroup": self._changeGroupName,
-        })
-        
+        self._refactoring.sendJson(
+            "ClearChanges",
+            {
+                "ChangeGroup": self._changeGroupName,
+            },
+        )
+
         evt.accept()

eric ide

mercurial