RefactoringRope/RenameDialog.py

branch
eric7
changeset 365
f740b50380df
parent 347
b5048b5ff454
child 374
958f34e97952
equal deleted inserted replaced
364:a92b3272f4c1 365:f740b50380df
5 5
6 """ 6 """
7 Module implementing the Rename dialog. 7 Module implementing the Rename dialog.
8 """ 8 """
9 9
10 from PyQt5.QtCore import pyqtSlot 10 from PyQt6.QtCore import pyqtSlot
11 from PyQt5.QtWidgets import QDialogButtonBox, QAbstractButton 11 from PyQt6.QtWidgets import QDialogButtonBox, QAbstractButton
12 12
13 from E5Gui.E5Application import e5App 13 from EricWidgets.EricApplication import ericApp
14 from E5Gui import E5MessageBox 14 from EricWidgets import EricMessageBox
15 15
16 from .Ui_RenameDialog import Ui_RenameDialog 16 from .Ui_RenameDialog import Ui_RenameDialog
17 from .RefactoringDialogBase import RefactoringDialogBase 17 from .RefactoringDialogBase import RefactoringDialogBase
18 18
19 19
49 49
50 self.__filename = filename 50 self.__filename = filename
51 self.__offset = offset 51 self.__offset = offset
52 self.__local = isLocal 52 self.__local = isLocal
53 53
54 self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) 54 self.__okButton = self.buttonBox.button(
55 QDialogButtonBox.StandardButton.Ok)
55 self.__okButton.setEnabled(False) 56 self.__okButton.setEnabled(False)
56 self.__previewButton = self.buttonBox.addButton( 57 self.__previewButton = self.buttonBox.addButton(
57 self.tr("Preview"), QDialogButtonBox.ActionRole) 58 self.tr("Preview"), QDialogButtonBox.ButtonRole.ActionRole)
58 self.__previewButton.setDefault(True) 59 self.__previewButton.setDefault(True)
59 self.__previewButton.setEnabled(False) 60 self.__previewButton.setEnabled(False)
60 61
61 self.newNameEdit.setText(selectedText) 62 self.newNameEdit.setText(selectedText)
62 self.newNameEdit.selectAll() 63 self.newNameEdit.selectAll()
102 else: 103 else:
103 filename = data["FileName"] 104 filename = data["FileName"]
104 start = data["StartOffset"] 105 start = data["StartOffset"]
105 end = data["EndOffset"] 106 end = data["EndOffset"]
106 107
107 vm = e5App().getObject("ViewManager") 108 vm = ericApp().getObject("ViewManager")
108 109
109 # display the file and select the match 110 # display the file and select the match
110 vm.openSourceFile(filename) 111 vm.openSourceFile(filename)
111 aw = vm.activeWindow() 112 aw = vm.activeWindow()
112 cline, cindex = aw.getCursorPosition() 113 cline, cindex = aw.getCursorPosition()
114 eline, eindex = aw.lineIndexFromPosition(end) 115 eline, eindex = aw.lineIndexFromPosition(end)
115 aw.ensureLineVisible(sline) 116 aw.ensureLineVisible(sline)
116 aw.gotoLine(sline) 117 aw.gotoLine(sline)
117 aw.setSelection(sline, sindex, eline, eindex) 118 aw.setSelection(sline, sindex, eline, eindex)
118 119
119 answer = E5MessageBox.yesNo( 120 answer = EricMessageBox.yesNo(
120 self._ui, 121 self._ui,
121 self.tr("Rename"), 122 self.tr("Rename"),
122 self.tr("""<p>Is the highlighted code a match?</p>"""), 123 self.tr("""<p>Is the highlighted code a match?</p>"""),
123 yesDefault=True) 124 yesDefault=True)
124 125

eric ide

mercurial