RefactoringRope/InlineArgumentDefaultDialog.py

branch
eric7
changeset 389
4f53795beff0
parent 374
958f34e97952
child 409
65153bf17e8d
--- a/RefactoringRope/InlineArgumentDefaultDialog.py	Sat Jun 25 18:06:56 2022 +0200
+++ b/RefactoringRope/InlineArgumentDefaultDialog.py	Wed Sep 21 15:30:34 2022 +0200
@@ -14,17 +14,19 @@
 from .RefactoringDialogBase import RefactoringDialogBase
 
 
-class InlineArgumentDefaultDialog(RefactoringDialogBase,
-                                  Ui_InlineArgumentDefaultDialog):
+class InlineArgumentDefaultDialog(
+    RefactoringDialogBase, Ui_InlineArgumentDefaultDialog
+):
     """
     Class implementing the Inline Argument Default dialog.
     """
+
     NameRole = Qt.ItemDataRole.UserRole
-    
+
     def __init__(self, refactoring, title, filename, offset, parent=None):
         """
         Constructor
-        
+
         @param refactoring reference to the main refactoring object
         @type RefactoringServer
         @param title title of the dialog
@@ -38,61 +40,65 @@
         """
         RefactoringDialogBase.__init__(self, refactoring, title, parent)
         self.setupUi(self)
-        
+
         self._changeGroupName = "ChangeSignature"
-        
+
         self.__filename = filename
         self.__offset = offset
-        
+
         self.__definition_info = []
-        
-        self.__okButton = self.buttonBox.button(
-            QDialogButtonBox.StandardButton.Ok)
+
+        self.__okButton = self.buttonBox.button(QDialogButtonBox.StandardButton.Ok)
         self.__okButton.setEnabled(False)
         self.__previewButton = self.buttonBox.addButton(
-            self.tr("Preview"), QDialogButtonBox.ButtonRole.ActionRole)
+            self.tr("Preview"), QDialogButtonBox.ButtonRole.ActionRole
+        )
         self.__previewButton.setDefault(True)
         self.__previewButton.setEnabled(False)
-        
-        self._refactoring.sendJson("RequestSignature", {
-            "ChangeGroup": self._changeGroupName,
-            "Title": self._title,
-            "FileName": self.__filename,
-            "Offset": self.__offset,
-        })
-    
+
+        self._refactoring.sendJson(
+            "RequestSignature",
+            {
+                "ChangeGroup": self._changeGroupName,
+                "Title": self._title,
+                "FileName": self.__filename,
+                "Offset": self.__offset,
+            },
+        )
+
     def __processSignature(self, data):
         """
         Private method to process the inline type data sent by the refactoring
         client in order to polish the dialog.
-        
+
         @param data dictionary containing the inline type data
         @type dict
         """
         self.__definition_info = data["DefinitionInfo"]
-        
+
         # populate the parameters list
         for arg, default in self.__definition_info:
             if default is not None:
-                itm = QListWidgetItem("{0}={1}".format(arg, default),
-                                      self.parameterList)
+                itm = QListWidgetItem(
+                    "{0}={1}".format(arg, default), self.parameterList
+                )
                 itm.setData(InlineArgumentDefaultDialog.NameRole, arg)
-    
+
     @pyqtSlot()
     def on_parameterList_itemSelectionChanged(self):
         """
         Private slot called, when the selection changes.
         """
         enable = len(self.parameterList.selectedItems()) > 0
-        
+
         self.__okButton.setEnabled(enable)
         self.__previewButton.setEnabled(enable)
-    
+
     @pyqtSlot(QAbstractButton)
     def on_buttonBox_clicked(self, button):
         """
         Private slot to act on the button pressed.
-        
+
         @param button reference to the button pressed
         @type QAbstractButton
         """
@@ -100,11 +106,11 @@
             self.requestPreview()
         elif button == self.__okButton:
             self.applyChanges()
-    
+
     def __getParameterIndex(self, definition_info, name):
         """
         Private method to calculate the index of the given paramter.
-        
+
         @param definition_info list of lists containing the method signature
             definition
         @type list of lists of two str
@@ -116,7 +122,7 @@
         for index, pair in enumerate(definition_info):
             if pair[0] == name:
                 return index
-        
+
         return -1
 
     def _calculateChanges(self):
@@ -128,21 +134,23 @@
             itm = items[0]
             name = itm.data(InlineArgumentDefaultDialog.NameRole)
             index = self.__getParameterIndex(self.__definition_info, name)
-            
+
             self._refactoring.sendJson(
-                "CalculateInlineArgumentDefaultChanges", {
+                "CalculateInlineArgumentDefaultChanges",
+                {
                     "ChangeGroup": self._changeGroupName,
                     "Title": self._title,
                     "FileName": self.__filename,
                     "Offset": self.__offset,
                     "Index": index,
-                })
-    
+                },
+            )
+
     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
         """

eric ide

mercurial