22 class RenameDialog(RefactoringDialogBase, Ui_RenameDialog): |
22 class RenameDialog(RefactoringDialogBase, Ui_RenameDialog): |
23 """ |
23 """ |
24 Class implementing the Rename dialog. |
24 Class implementing the Rename dialog. |
25 """ |
25 """ |
26 def __init__(self, refactoring, title, renamer, resource=None, |
26 def __init__(self, refactoring, title, renamer, resource=None, |
27 parent=None): |
27 selectedText='', parent=None): |
28 """ |
28 """ |
29 Constructor |
29 Constructor |
30 |
30 |
31 @param refactoring reference to the main refactoring object |
31 @param refactoring reference to the main refactoring object |
32 (Refactoring) |
32 (Refactoring) |
33 @param title title of the dialog (string) |
33 @param title title of the dialog (string) |
34 @param renamer reference to the renamer object |
34 @param renamer reference to the renamer object |
35 (rope.refactor.rename.Rename) |
35 (rope.refactor.rename.Rename) |
36 @param resource reference to a resource object, if the action is to |
36 @param resource reference to a resource object, if the action is to |
37 be applied to the local file only (rope.base.resources.File) |
37 be applied to the local file only (rope.base.resources.File) |
|
38 @param selectedText selected text to rename (str) |
38 @param parent reference to the parent widget (QWidget) |
39 @param parent reference to the parent widget (QWidget) |
39 """ |
40 """ |
40 RefactoringDialogBase.__init__(self, refactoring, title, parent) |
41 RefactoringDialogBase.__init__(self, refactoring, title, parent) |
41 self.setupUi(self) |
42 self.setupUi(self) |
42 |
43 |
49 self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) |
50 self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) |
50 self.__okButton.setEnabled(False) |
51 self.__okButton.setEnabled(False) |
51 self.__previewButton = self.buttonBox.addButton( |
52 self.__previewButton = self.buttonBox.addButton( |
52 self.tr("Preview"), QDialogButtonBox.ActionRole) |
53 self.tr("Preview"), QDialogButtonBox.ActionRole) |
53 self.__previewButton.setDefault(True) |
54 self.__previewButton.setDefault(True) |
|
55 self.newNameEdit.setText(selectedText) |
|
56 self.newNameEdit.selectAll() |
54 |
57 |
55 msh = self.minimumSizeHint() |
58 msh = self.minimumSizeHint() |
56 self.resize(max(self.width(), msh.width()), msh.height()) |
59 self.resize(max(self.width(), msh.width()), msh.height()) |
57 |
60 |
58 @pyqtSlot(str) |
61 @pyqtSlot(str) |