--- a/RefactoringRope/ExtractDialog.py Sat Jun 25 18:06:56 2022 +0200 +++ b/RefactoringRope/ExtractDialog.py Wed Sep 21 15:30:34 2022 +0200 @@ -18,11 +18,20 @@ """ Class implementing the Extract dialog. """ - def __init__(self, refactoring, title, filename, startOffset, endOffset, - extractionType, parent=None): + + def __init__( + self, + refactoring, + title, + filename, + startOffset, + endOffset, + extractionType, + parent=None, + ): """ Constructor - + @param refactoring reference to the main refactoring object @type RefactoringServer @param title title of the dialog @@ -40,41 +49,41 @@ """ RefactoringDialogBase.__init__(self, refactoring, title, parent) self.setupUi(self) - + self._changeGroupName = "Extract" - + self.__filename = filename self.__startOffset = startOffset self.__endOffset = endOffset self.__extractionType = extractionType - - 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) - + msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) - + @pyqtSlot(str) def on_newNameEdit_textChanged(self, text): """ Private slot to react to changes of the new name. - + @param text text entered into the edit @type str """ self.__okButton.setEnabled(text != "") self.__previewButton.setEnabled(text != "") - + @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 """ @@ -82,19 +91,22 @@ self.requestPreview() elif button == self.__okButton: self.applyChanges() - + def _calculateChanges(self): """ Protected method to calculate the changes. """ - self._refactoring.sendJson("CalculateExtractChanges", { - "ChangeGroup": self._changeGroupName, - "Title": self._title, - "FileName": self.__filename, - "StartOffset": self.__startOffset, - "EndOffset": self.__endOffset, - "Kind": self.__extractionType, - "NewName": self.newNameEdit.text(), - "Similar": self.similarCheckBox.isChecked(), - "Global": self.globalCheckBox.isChecked(), - }) + self._refactoring.sendJson( + "CalculateExtractChanges", + { + "ChangeGroup": self._changeGroupName, + "Title": self._title, + "FileName": self.__filename, + "StartOffset": self.__startOffset, + "EndOffset": self.__endOffset, + "Kind": self.__extractionType, + "NewName": self.newNameEdit.text(), + "Similar": self.similarCheckBox.isChecked(), + "Global": self.globalCheckBox.isChecked(), + }, + )