RefactoringRope/Refactoring.py

changeset 87
1fbf5fdbe721
parent 76
936b2a98fe4e
child 88
e71619898d0f
child 94
03d6a17c66ac
equal deleted inserted replaced
84:f8e0131a4761 87:1fbf5fdbe721
22 22
23 import rope 23 import rope
24 import rope.base.libutils 24 import rope.base.libutils
25 import rope.base.exceptions 25 import rope.base.exceptions
26 26
27 from PyQt4.QtCore import QObject 27 from PyQt5.QtCore import QObject
28 from PyQt4.QtGui import QMenu, QApplication, QDialog, QAction 28 from PyQt5.QtWidgets import QMenu, QApplication, QDialog, QAction
29 from PyQt4.Qsci import QsciScintilla 29 from PyQt5.Qsci import QsciScintilla
30 30
31 from E5Gui.E5Application import e5App 31 from E5Gui.E5Application import e5App
32 from E5Gui import E5MessageBox 32 from E5Gui import E5MessageBox
33 from E5Gui.E5Action import E5Action 33 from E5Gui.E5Action import E5Action
34 34
73 ##################################################### 73 #####################################################
74 ## Rename refactoring actions 74 ## Rename refactoring actions
75 ##################################################### 75 #####################################################
76 76
77 self.refactoringRenameAct = E5Action( 77 self.refactoringRenameAct = E5Action(
78 self.trUtf8('Rename'), 78 self.tr('Rename'),
79 self.trUtf8('&Rename'), 79 self.tr('&Rename'),
80 0, 0, 80 0, 0,
81 self, 'refactoring_rename') 81 self, 'refactoring_rename')
82 self.refactoringRenameAct.setStatusTip(self.trUtf8( 82 self.refactoringRenameAct.setStatusTip(self.tr(
83 'Rename the highlighted object')) 83 'Rename the highlighted object'))
84 self.refactoringRenameAct.setWhatsThis(self.trUtf8( 84 self.refactoringRenameAct.setWhatsThis(self.tr(
85 """<b>Rename</b>""" 85 """<b>Rename</b>"""
86 """<p>Rename the highlighted Python object.</p>""" 86 """<p>Rename the highlighted Python object.</p>"""
87 )) 87 ))
88 self.refactoringRenameAct.triggered[()].connect( 88 self.refactoringRenameAct.triggered.connect(
89 self.__rename) 89 self.__rename)
90 self.actions.append(self.refactoringRenameAct) 90 self.actions.append(self.refactoringRenameAct)
91 91
92 self.refactoringRenameLocalAct = E5Action( 92 self.refactoringRenameLocalAct = E5Action(
93 self.trUtf8('Local Rename'), 93 self.tr('Local Rename'),
94 self.trUtf8('&Local Rename'), 94 self.tr('&Local Rename'),
95 0, 0, 95 0, 0,
96 self, 'refactoring_rename_local') 96 self, 'refactoring_rename_local')
97 self.refactoringRenameLocalAct.setStatusTip(self.trUtf8( 97 self.refactoringRenameLocalAct.setStatusTip(self.tr(
98 'Rename the highlighted object in the current module only')) 98 'Rename the highlighted object in the current module only'))
99 self.refactoringRenameLocalAct.setWhatsThis(self.trUtf8( 99 self.refactoringRenameLocalAct.setWhatsThis(self.tr(
100 """<b>Local Rename</b>""" 100 """<b>Local Rename</b>"""
101 """<p>Rename the highlighted Python object in the current""" 101 """<p>Rename the highlighted Python object in the current"""
102 """ module only.</p>""" 102 """ module only.</p>"""
103 )) 103 ))
104 self.refactoringRenameLocalAct.triggered[()].connect( 104 self.refactoringRenameLocalAct.triggered.connect(
105 self.__renameLocal) 105 self.__renameLocal)
106 self.actions.append(self.refactoringRenameLocalAct) 106 self.actions.append(self.refactoringRenameLocalAct)
107 107
108 self.refactoringRenameModuleAct = E5Action( 108 self.refactoringRenameModuleAct = E5Action(
109 self.trUtf8('Rename Current Module'), 109 self.tr('Rename Current Module'),
110 self.trUtf8('Rename Current Module'), 110 self.tr('Rename Current Module'),
111 0, 0, 111 0, 0,
112 self, 'refactoring_rename_module') 112 self, 'refactoring_rename_module')
113 self.refactoringRenameModuleAct.setStatusTip(self.trUtf8( 113 self.refactoringRenameModuleAct.setStatusTip(self.tr(
114 'Rename the current module')) 114 'Rename the current module'))
115 self.refactoringRenameModuleAct.setWhatsThis(self.trUtf8( 115 self.refactoringRenameModuleAct.setWhatsThis(self.tr(
116 """<b>Rename Current Module</b>""" 116 """<b>Rename Current Module</b>"""
117 """<p>Rename the current module.</p>""" 117 """<p>Rename the current module.</p>"""
118 )) 118 ))
119 self.refactoringRenameModuleAct.triggered[()].connect( 119 self.refactoringRenameModuleAct.triggered.connect(
120 self.__renameModule) 120 self.__renameModule)
121 self.actions.append(self.refactoringRenameModuleAct) 121 self.actions.append(self.refactoringRenameModuleAct)
122 122
123 self.refactoringChangeOccurrencesAct = E5Action( 123 self.refactoringChangeOccurrencesAct = E5Action(
124 self.trUtf8('Change Occurrences'), 124 self.tr('Change Occurrences'),
125 self.trUtf8('Change &Occurrences'), 125 self.tr('Change &Occurrences'),
126 0, 0, 126 0, 0,
127 self, 'refactoring_change_occurrences') 127 self, 'refactoring_change_occurrences')
128 self.refactoringChangeOccurrencesAct.setStatusTip(self.trUtf8( 128 self.refactoringChangeOccurrencesAct.setStatusTip(self.tr(
129 'Change all occurrences in the local scope')) 129 'Change all occurrences in the local scope'))
130 self.refactoringChangeOccurrencesAct.setWhatsThis(self.trUtf8( 130 self.refactoringChangeOccurrencesAct.setWhatsThis(self.tr(
131 """<b>Change Occurrences</b>""" 131 """<b>Change Occurrences</b>"""
132 """<p>Change all occurrences in the local scope.</p>""" 132 """<p>Change all occurrences in the local scope.</p>"""
133 )) 133 ))
134 self.refactoringChangeOccurrencesAct.triggered[()].connect( 134 self.refactoringChangeOccurrencesAct.triggered.connect(
135 self.__changeOccurrences) 135 self.__changeOccurrences)
136 self.actions.append(self.refactoringChangeOccurrencesAct) 136 self.actions.append(self.refactoringChangeOccurrencesAct)
137 137
138 ##################################################### 138 #####################################################
139 ## Extract refactoring actions 139 ## Extract refactoring actions
140 ##################################################### 140 #####################################################
141 141
142 self.refactoringExtractMethodAct = E5Action( 142 self.refactoringExtractMethodAct = E5Action(
143 self.trUtf8('Extract method'), 143 self.tr('Extract method'),
144 self.trUtf8('Extract &Method'), 144 self.tr('Extract &Method'),
145 0, 0, 145 0, 0,
146 self, 'refactoring_extract_method') 146 self, 'refactoring_extract_method')
147 self.refactoringExtractMethodAct.setStatusTip(self.trUtf8( 147 self.refactoringExtractMethodAct.setStatusTip(self.tr(
148 'Extract the highlighted area as a method')) 148 'Extract the highlighted area as a method'))
149 self.refactoringExtractMethodAct.setWhatsThis(self.trUtf8( 149 self.refactoringExtractMethodAct.setWhatsThis(self.tr(
150 """<b>Extract method</b>""" 150 """<b>Extract method</b>"""
151 """<p>Extract the highlighted area as a method or function.</p>""" 151 """<p>Extract the highlighted area as a method or function.</p>"""
152 )) 152 ))
153 self.refactoringExtractMethodAct.triggered[()].connect( 153 self.refactoringExtractMethodAct.triggered.connect(
154 self.__extractMethod) 154 self.__extractMethod)
155 self.actions.append(self.refactoringExtractMethodAct) 155 self.actions.append(self.refactoringExtractMethodAct)
156 156
157 self.refactoringExtractLocalVariableAct = E5Action( 157 self.refactoringExtractLocalVariableAct = E5Action(
158 self.trUtf8('Extract local variable'), 158 self.tr('Extract local variable'),
159 self.trUtf8('&Extract Local Variable'), 159 self.tr('&Extract Local Variable'),
160 0, 0, 160 0, 0,
161 self, 'refactoring_extract_variable') 161 self, 'refactoring_extract_variable')
162 self.refactoringExtractLocalVariableAct.setStatusTip(self.trUtf8( 162 self.refactoringExtractLocalVariableAct.setStatusTip(self.tr(
163 'Extract the highlighted area as a local variable')) 163 'Extract the highlighted area as a local variable'))
164 self.refactoringExtractLocalVariableAct.setWhatsThis(self.trUtf8( 164 self.refactoringExtractLocalVariableAct.setWhatsThis(self.tr(
165 """<b>Extract local variable</b>""" 165 """<b>Extract local variable</b>"""
166 """<p>Extract the highlighted area as a local variable.</p>""" 166 """<p>Extract the highlighted area as a local variable.</p>"""
167 )) 167 ))
168 self.refactoringExtractLocalVariableAct.triggered[()].connect( 168 self.refactoringExtractLocalVariableAct.triggered.connect(
169 self.__extractLocalVariable) 169 self.__extractLocalVariable)
170 self.actions.append(self.refactoringExtractLocalVariableAct) 170 self.actions.append(self.refactoringExtractLocalVariableAct)
171 171
172 ##################################################### 172 #####################################################
173 ## Inline refactoring actions 173 ## Inline refactoring actions
174 ##################################################### 174 #####################################################
175 175
176 self.refactoringInlineAct = E5Action( 176 self.refactoringInlineAct = E5Action(
177 self.trUtf8('Inline'), 177 self.tr('Inline'),
178 self.trUtf8('&Inline'), 178 self.tr('&Inline'),
179 0, 0, 179 0, 0,
180 self, 'refactoring_inline') 180 self, 'refactoring_inline')
181 self.refactoringInlineAct.setStatusTip(self.trUtf8( 181 self.refactoringInlineAct.setStatusTip(self.tr(
182 'Inlines the selected local variable or method')) 182 'Inlines the selected local variable or method'))
183 self.refactoringInlineAct.setWhatsThis(self.trUtf8( 183 self.refactoringInlineAct.setWhatsThis(self.tr(
184 """<b>Inline</b>""" 184 """<b>Inline</b>"""
185 """<p>Inlines the selected local variable or method.</p>""" 185 """<p>Inlines the selected local variable or method.</p>"""
186 )) 186 ))
187 self.refactoringInlineAct.triggered[()].connect( 187 self.refactoringInlineAct.triggered.connect(
188 self.__inline) 188 self.__inline)
189 self.actions.append(self.refactoringInlineAct) 189 self.actions.append(self.refactoringInlineAct)
190 190
191 ##################################################### 191 #####################################################
192 ## Move refactoring actions 192 ## Move refactoring actions
193 ##################################################### 193 #####################################################
194 194
195 self.refactoringMoveMethodAct = E5Action( 195 self.refactoringMoveMethodAct = E5Action(
196 self.trUtf8('Move method'), 196 self.tr('Move method'),
197 self.trUtf8('Mo&ve Method'), 197 self.tr('Mo&ve Method'),
198 0, 0, 198 0, 0,
199 self, 'refactoring_move_method') 199 self, 'refactoring_move_method')
200 self.refactoringMoveMethodAct.setStatusTip(self.trUtf8( 200 self.refactoringMoveMethodAct.setStatusTip(self.tr(
201 'Move the highlighted method to another class')) 201 'Move the highlighted method to another class'))
202 self.refactoringMoveMethodAct.setWhatsThis(self.trUtf8( 202 self.refactoringMoveMethodAct.setWhatsThis(self.tr(
203 """<b>Move method</b>""" 203 """<b>Move method</b>"""
204 """<p>Move the highlighted method to another class.</p>""" 204 """<p>Move the highlighted method to another class.</p>"""
205 )) 205 ))
206 self.refactoringMoveMethodAct.triggered[()].connect( 206 self.refactoringMoveMethodAct.triggered.connect(
207 self.__moveMethod) 207 self.__moveMethod)
208 self.actions.append(self.refactoringMoveMethodAct) 208 self.actions.append(self.refactoringMoveMethodAct)
209 209
210 self.refactoringMoveModuleAct = E5Action( 210 self.refactoringMoveModuleAct = E5Action(
211 self.trUtf8('Move current module'), 211 self.tr('Move current module'),
212 self.trUtf8('Move Current Module'), 212 self.tr('Move Current Module'),
213 0, 0, 213 0, 0,
214 self, 'refactoring_move_module') 214 self, 'refactoring_move_module')
215 self.refactoringMoveModuleAct.setStatusTip(self.trUtf8( 215 self.refactoringMoveModuleAct.setStatusTip(self.tr(
216 'Move the current module to another package')) 216 'Move the current module to another package'))
217 self.refactoringMoveModuleAct.setWhatsThis(self.trUtf8( 217 self.refactoringMoveModuleAct.setWhatsThis(self.tr(
218 """<b>Move current module</b>""" 218 """<b>Move current module</b>"""
219 """<p>Move the current module to another package.</p>""" 219 """<p>Move the current module to another package.</p>"""
220 )) 220 ))
221 self.refactoringMoveModuleAct.triggered[()].connect( 221 self.refactoringMoveModuleAct.triggered.connect(
222 self.__moveModule) 222 self.__moveModule)
223 self.actions.append(self.refactoringMoveModuleAct) 223 self.actions.append(self.refactoringMoveModuleAct)
224 224
225 ##################################################### 225 #####################################################
226 ## Use function refactoring action 226 ## Use function refactoring action
227 ##################################################### 227 #####################################################
228 228
229 self.refactoringUseFunctionAct = E5Action( 229 self.refactoringUseFunctionAct = E5Action(
230 self.trUtf8('Use Function'), 230 self.tr('Use Function'),
231 self.trUtf8('Use Function'), 231 self.tr('Use Function'),
232 0, 0, 232 0, 0,
233 self, 'refactoring_use_function') 233 self, 'refactoring_use_function')
234 self.refactoringUseFunctionAct.setStatusTip(self.trUtf8( 234 self.refactoringUseFunctionAct.setStatusTip(self.tr(
235 'Use a function wherever possible.')) 235 'Use a function wherever possible.'))
236 self.refactoringUseFunctionAct.setWhatsThis(self.trUtf8( 236 self.refactoringUseFunctionAct.setWhatsThis(self.tr(
237 """<b>Use function</b>""" 237 """<b>Use function</b>"""
238 """<p>Tries to use a function wherever possible.</p>""" 238 """<p>Tries to use a function wherever possible.</p>"""
239 )) 239 ))
240 self.refactoringUseFunctionAct.triggered[()].connect( 240 self.refactoringUseFunctionAct.triggered.connect(
241 self.__useFunction) 241 self.__useFunction)
242 self.actions.append(self.refactoringUseFunctionAct) 242 self.actions.append(self.refactoringUseFunctionAct)
243 243
244 ##################################################### 244 #####################################################
245 ## Introduce refactorings actions 245 ## Introduce refactorings actions
246 ##################################################### 246 #####################################################
247 247
248 self.refactoringIntroduceFactoryAct = E5Action( 248 self.refactoringIntroduceFactoryAct = E5Action(
249 self.trUtf8('Introduce Factory Method'), 249 self.tr('Introduce Factory Method'),
250 self.trUtf8('Introduce &Factory Method'), 250 self.tr('Introduce &Factory Method'),
251 0, 0, 251 0, 0,
252 self, 'refactoring_introduce_factory_method') 252 self, 'refactoring_introduce_factory_method')
253 self.refactoringIntroduceFactoryAct.setStatusTip(self.trUtf8( 253 self.refactoringIntroduceFactoryAct.setStatusTip(self.tr(
254 'Introduce a factory method or function')) 254 'Introduce a factory method or function'))
255 self.refactoringIntroduceFactoryAct.setWhatsThis(self.trUtf8( 255 self.refactoringIntroduceFactoryAct.setWhatsThis(self.tr(
256 """<b>Introduce Factory Method</b>""" 256 """<b>Introduce Factory Method</b>"""
257 """<p>Introduce a factory method or function.</p>""" 257 """<p>Introduce a factory method or function.</p>"""
258 )) 258 ))
259 self.refactoringIntroduceFactoryAct.triggered[()].connect( 259 self.refactoringIntroduceFactoryAct.triggered.connect(
260 self.__introduceFactoryMethod) 260 self.__introduceFactoryMethod)
261 self.actions.append(self.refactoringIntroduceFactoryAct) 261 self.actions.append(self.refactoringIntroduceFactoryAct)
262 262
263 self.refactoringIntroduceParameterAct = E5Action( 263 self.refactoringIntroduceParameterAct = E5Action(
264 self.trUtf8('Introduce Parameter'), 264 self.tr('Introduce Parameter'),
265 self.trUtf8('Introduce &Parameter'), 265 self.tr('Introduce &Parameter'),
266 0, 0, 266 0, 0,
267 self, 'refactoring_introduce_parameter_method') 267 self, 'refactoring_introduce_parameter_method')
268 self.refactoringIntroduceParameterAct.setStatusTip(self.trUtf8( 268 self.refactoringIntroduceParameterAct.setStatusTip(self.tr(
269 'Introduce a parameter in a function')) 269 'Introduce a parameter in a function'))
270 self.refactoringIntroduceParameterAct.setWhatsThis(self.trUtf8( 270 self.refactoringIntroduceParameterAct.setWhatsThis(self.tr(
271 """<b>Introduce Parameter</b>""" 271 """<b>Introduce Parameter</b>"""
272 """<p>Introduce a parameter in a function.</p>""" 272 """<p>Introduce a parameter in a function.</p>"""
273 )) 273 ))
274 self.refactoringIntroduceParameterAct.triggered[()].connect( 274 self.refactoringIntroduceParameterAct.triggered.connect(
275 self.__introduceParameter) 275 self.__introduceParameter)
276 self.actions.append(self.refactoringIntroduceParameterAct) 276 self.actions.append(self.refactoringIntroduceParameterAct)
277 277
278 ##################################################### 278 #####################################################
279 ## Import refactorings actions 279 ## Import refactorings actions
280 ##################################################### 280 #####################################################
281 281
282 self.refactoringImportsOrganizeAct = E5Action( 282 self.refactoringImportsOrganizeAct = E5Action(
283 self.trUtf8('Organize Imports'), 283 self.tr('Organize Imports'),
284 self.trUtf8('&Organize Imports'), 284 self.tr('&Organize Imports'),
285 0, 0, 285 0, 0,
286 self, 'refactoring_organize_imports') 286 self, 'refactoring_organize_imports')
287 self.refactoringImportsOrganizeAct.setStatusTip(self.trUtf8( 287 self.refactoringImportsOrganizeAct.setStatusTip(self.tr(
288 'Sort imports according to PEP-8')) 288 'Sort imports according to PEP-8'))
289 self.refactoringImportsOrganizeAct.setWhatsThis(self.trUtf8( 289 self.refactoringImportsOrganizeAct.setWhatsThis(self.tr(
290 """<b>Organize Imports</b>""" 290 """<b>Organize Imports</b>"""
291 """<p>Sort imports according to PEP-8.</p>""" 291 """<p>Sort imports according to PEP-8.</p>"""
292 )) 292 ))
293 self.refactoringImportsOrganizeAct.triggered[()].connect( 293 self.refactoringImportsOrganizeAct.triggered.connect(
294 self.__importsOrganize) 294 self.__importsOrganize)
295 self.actions.append(self.refactoringImportsOrganizeAct) 295 self.actions.append(self.refactoringImportsOrganizeAct)
296 296
297 self.refactoringImportsStarExpandAct = E5Action( 297 self.refactoringImportsStarExpandAct = E5Action(
298 self.trUtf8('Expand Star Imports'), 298 self.tr('Expand Star Imports'),
299 self.trUtf8('E&xpand Star Imports'), 299 self.tr('E&xpand Star Imports'),
300 0, 0, 300 0, 0,
301 self, 'refactoring_expand_star_imports') 301 self, 'refactoring_expand_star_imports')
302 self.refactoringImportsStarExpandAct.setStatusTip(self.trUtf8( 302 self.refactoringImportsStarExpandAct.setStatusTip(self.tr(
303 'Expand imports like "from xxx import *"')) 303 'Expand imports like "from xxx import *"'))
304 self.refactoringImportsStarExpandAct.setWhatsThis(self.trUtf8( 304 self.refactoringImportsStarExpandAct.setWhatsThis(self.tr(
305 """<b>Expand Star Imports</b>""" 305 """<b>Expand Star Imports</b>"""
306 """<p>Expand imports like "from xxx import *".</p>""" 306 """<p>Expand imports like "from xxx import *".</p>"""
307 """<p>Select the import to act on or none to do all.""" 307 """<p>Select the import to act on or none to do all."""
308 """ Unused imports are deleted.</p>""" 308 """ Unused imports are deleted.</p>"""
309 )) 309 ))
310 self.refactoringImportsStarExpandAct.triggered[()].connect( 310 self.refactoringImportsStarExpandAct.triggered.connect(
311 self.__importsExpandStar) 311 self.__importsExpandStar)
312 self.actions.append(self.refactoringImportsStarExpandAct) 312 self.actions.append(self.refactoringImportsStarExpandAct)
313 313
314 self.refactoringImportsRelativeToAbsoluteAct = E5Action( 314 self.refactoringImportsRelativeToAbsoluteAct = E5Action(
315 self.trUtf8('Relative to Absolute'), 315 self.tr('Relative to Absolute'),
316 self.trUtf8('Relative to &Absolute'), 316 self.tr('Relative to &Absolute'),
317 0, 0, 317 0, 0,
318 self, 'refactoring_relative_to_absolute_imports') 318 self, 'refactoring_relative_to_absolute_imports')
319 self.refactoringImportsRelativeToAbsoluteAct.setStatusTip(self.trUtf8( 319 self.refactoringImportsRelativeToAbsoluteAct.setStatusTip(self.tr(
320 'Transform relative imports to absolute ones')) 320 'Transform relative imports to absolute ones'))
321 self.refactoringImportsRelativeToAbsoluteAct.setWhatsThis(self.trUtf8( 321 self.refactoringImportsRelativeToAbsoluteAct.setWhatsThis(self.tr(
322 """<b>Relative to Absolute</b>""" 322 """<b>Relative to Absolute</b>"""
323 """<p>Transform relative imports to absolute ones.</p>""" 323 """<p>Transform relative imports to absolute ones.</p>"""
324 """<p>Select the import to act on or none to do all.""" 324 """<p>Select the import to act on or none to do all."""
325 """ Unused imports are deleted.</p>""" 325 """ Unused imports are deleted.</p>"""
326 )) 326 ))
327 self.refactoringImportsRelativeToAbsoluteAct.triggered[()].connect( 327 self.refactoringImportsRelativeToAbsoluteAct.triggered.connect(
328 self.__importsRelativeToAbsolute) 328 self.__importsRelativeToAbsolute)
329 self.actions.append(self.refactoringImportsRelativeToAbsoluteAct) 329 self.actions.append(self.refactoringImportsRelativeToAbsoluteAct)
330 330
331 self.refactoringImportsFromsToImportsAct = E5Action( 331 self.refactoringImportsFromsToImportsAct = E5Action(
332 self.trUtf8('Froms to Imports'), 332 self.tr('Froms to Imports'),
333 self.trUtf8('Froms to &Imports'), 333 self.tr('Froms to &Imports'),
334 0, 0, 334 0, 0,
335 self, 'refactoring_froms_to_imports') 335 self, 'refactoring_froms_to_imports')
336 self.refactoringImportsFromsToImportsAct.setStatusTip(self.trUtf8( 336 self.refactoringImportsFromsToImportsAct.setStatusTip(self.tr(
337 'Transform From imports to plain imports')) 337 'Transform From imports to plain imports'))
338 self.refactoringImportsFromsToImportsAct.setWhatsThis(self.trUtf8( 338 self.refactoringImportsFromsToImportsAct.setWhatsThis(self.tr(
339 """<b>Froms to Imports</b>""" 339 """<b>Froms to Imports</b>"""
340 """<p>Transform From imports to plain imports.</p>""" 340 """<p>Transform From imports to plain imports.</p>"""
341 """<p>Select the import to act on or none to do all.""" 341 """<p>Select the import to act on or none to do all."""
342 """ Unused imports are deleted.</p>""" 342 """ Unused imports are deleted.</p>"""
343 )) 343 ))
344 self.refactoringImportsFromsToImportsAct.triggered[()].connect( 344 self.refactoringImportsFromsToImportsAct.triggered.connect(
345 self.__importsFromToImport) 345 self.__importsFromToImport)
346 self.actions.append(self.refactoringImportsFromsToImportsAct) 346 self.actions.append(self.refactoringImportsFromsToImportsAct)
347 347
348 self.refactoringImportsHandleLongAct = E5Action( 348 self.refactoringImportsHandleLongAct = E5Action(
349 self.trUtf8('Handle Long Imports'), 349 self.tr('Handle Long Imports'),
350 self.trUtf8('Handle &Long Imports'), 350 self.tr('Handle &Long Imports'),
351 0, 0, 351 0, 0,
352 self, 'refactoring_organize_imports') 352 self, 'refactoring_organize_imports')
353 self.refactoringImportsHandleLongAct.setStatusTip(self.trUtf8( 353 self.refactoringImportsHandleLongAct.setStatusTip(self.tr(
354 'Transform long import statements to look better')) 354 'Transform long import statements to look better'))
355 self.refactoringImportsHandleLongAct.setWhatsThis(self.trUtf8( 355 self.refactoringImportsHandleLongAct.setWhatsThis(self.tr(
356 """<b>Handle Long Imports</b>""" 356 """<b>Handle Long Imports</b>"""
357 """<p>Transform long import statements to look better.</p>""" 357 """<p>Transform long import statements to look better.</p>"""
358 """<p>Select the import to act on or none to do all.""" 358 """<p>Select the import to act on or none to do all."""
359 """ Unused imports are deleted.</p>""" 359 """ Unused imports are deleted.</p>"""
360 )) 360 ))
361 self.refactoringImportsHandleLongAct.triggered[()].connect( 361 self.refactoringImportsHandleLongAct.triggered.connect(
362 self.__importsHandleLong) 362 self.__importsHandleLong)
363 self.actions.append(self.refactoringImportsHandleLongAct) 363 self.actions.append(self.refactoringImportsHandleLongAct)
364 364
365 ##################################################### 365 #####################################################
366 ## Various refactorings actions 366 ## Various refactorings actions
367 ##################################################### 367 #####################################################
368 368
369 self.refactoringRestructureAct = E5Action( 369 self.refactoringRestructureAct = E5Action(
370 self.trUtf8('Restructure'), 370 self.tr('Restructure'),
371 self.trUtf8('Res&tructure'), 371 self.tr('Res&tructure'),
372 0, 0, 372 0, 0,
373 self, 'refactoring_restructure') 373 self, 'refactoring_restructure')
374 self.refactoringRestructureAct.setStatusTip(self.trUtf8( 374 self.refactoringRestructureAct.setStatusTip(self.tr(
375 'Restructure code')) 375 'Restructure code'))
376 self.refactoringRestructureAct.setWhatsThis(self.trUtf8( 376 self.refactoringRestructureAct.setWhatsThis(self.tr(
377 """<b>Restructure</b>""" 377 """<b>Restructure</b>"""
378 """<p>Restructure code. See "Rope Help" for examples.</p>""" 378 """<p>Restructure code. See "Rope Help" for examples.</p>"""
379 )) 379 ))
380 self.refactoringRestructureAct.triggered[()].connect( 380 self.refactoringRestructureAct.triggered.connect(
381 self.__restructure) 381 self.__restructure)
382 self.actions.append(self.refactoringRestructureAct) 382 self.actions.append(self.refactoringRestructureAct)
383 383
384 self.refactoringChangeSignatureAct = E5Action( 384 self.refactoringChangeSignatureAct = E5Action(
385 self.trUtf8('Change Method Signature'), 385 self.tr('Change Method Signature'),
386 self.trUtf8('&Change Method Signature'), 386 self.tr('&Change Method Signature'),
387 0, 0, 387 0, 0,
388 self, 'refactoring_change_method_signature') 388 self, 'refactoring_change_method_signature')
389 self.refactoringChangeSignatureAct.setStatusTip(self.trUtf8( 389 self.refactoringChangeSignatureAct.setStatusTip(self.tr(
390 'Change the signature of the selected method or function')) 390 'Change the signature of the selected method or function'))
391 self.refactoringChangeSignatureAct.setWhatsThis(self.trUtf8( 391 self.refactoringChangeSignatureAct.setWhatsThis(self.tr(
392 """<b>Change Method Signature</b>""" 392 """<b>Change Method Signature</b>"""
393 """<p>Change the signature of the selected method""" 393 """<p>Change the signature of the selected method"""
394 """ or function.</p>""" 394 """ or function.</p>"""
395 )) 395 ))
396 self.refactoringChangeSignatureAct.triggered[()].connect( 396 self.refactoringChangeSignatureAct.triggered.connect(
397 self.__changeSignature) 397 self.__changeSignature)
398 self.actions.append(self.refactoringChangeSignatureAct) 398 self.actions.append(self.refactoringChangeSignatureAct)
399 399
400 self.refactoringInlineArgumentDefaultAct = E5Action( 400 self.refactoringInlineArgumentDefaultAct = E5Action(
401 self.trUtf8('Inline Argument Default'), 401 self.tr('Inline Argument Default'),
402 self.trUtf8('Inline &Argument Default'), 402 self.tr('Inline &Argument Default'),
403 0, 0, 403 0, 0,
404 self, 'refactoring_inline_argument_default') 404 self, 'refactoring_inline_argument_default')
405 self.refactoringInlineArgumentDefaultAct.setStatusTip(self.trUtf8( 405 self.refactoringInlineArgumentDefaultAct.setStatusTip(self.tr(
406 'Inline a parameters default value')) 406 'Inline a parameters default value'))
407 self.refactoringInlineArgumentDefaultAct.setWhatsThis(self.trUtf8( 407 self.refactoringInlineArgumentDefaultAct.setWhatsThis(self.tr(
408 """<b>Inline Argument Default</b>""" 408 """<b>Inline Argument Default</b>"""
409 """<p>Inline a parameters default value.</p>""" 409 """<p>Inline a parameters default value.</p>"""
410 )) 410 ))
411 self.refactoringInlineArgumentDefaultAct.triggered[()].connect( 411 self.refactoringInlineArgumentDefaultAct.triggered.connect(
412 self.__inlineArgumentDefault) 412 self.__inlineArgumentDefault)
413 self.actions.append(self.refactoringInlineArgumentDefaultAct) 413 self.actions.append(self.refactoringInlineArgumentDefaultAct)
414 414
415 self.refactoringTransformModuleAct = E5Action( 415 self.refactoringTransformModuleAct = E5Action(
416 self.trUtf8('Transform Module to Package'), 416 self.tr('Transform Module to Package'),
417 self.trUtf8('Transform Module to Package'), 417 self.tr('Transform Module to Package'),
418 0, 0, 418 0, 0,
419 self, 'refactoring_transform_module_to_package') 419 self, 'refactoring_transform_module_to_package')
420 self.refactoringTransformModuleAct.setStatusTip(self.trUtf8( 420 self.refactoringTransformModuleAct.setStatusTip(self.tr(
421 'Transform the current module to a package')) 421 'Transform the current module to a package'))
422 self.refactoringTransformModuleAct.setWhatsThis(self.trUtf8( 422 self.refactoringTransformModuleAct.setWhatsThis(self.tr(
423 """<b>Transform Module to Package</b>""" 423 """<b>Transform Module to Package</b>"""
424 """<p>Transform the current module to a package.</p>""" 424 """<p>Transform the current module to a package.</p>"""
425 )) 425 ))
426 self.refactoringTransformModuleAct.triggered[()].connect( 426 self.refactoringTransformModuleAct.triggered.connect(
427 self.__transformModuleToPackage) 427 self.__transformModuleToPackage)
428 self.actions.append(self.refactoringTransformModuleAct) 428 self.actions.append(self.refactoringTransformModuleAct)
429 429
430 self.refactoringEncapsulateAttributeAct = E5Action( 430 self.refactoringEncapsulateAttributeAct = E5Action(
431 self.trUtf8('Encapsulate Attribute'), 431 self.tr('Encapsulate Attribute'),
432 self.trUtf8('Encap&sulate Attribute'), 432 self.tr('Encap&sulate Attribute'),
433 0, 0, 433 0, 0,
434 self, 'refactoring_encapsulate_attribute') 434 self, 'refactoring_encapsulate_attribute')
435 self.refactoringEncapsulateAttributeAct.setStatusTip(self.trUtf8( 435 self.refactoringEncapsulateAttributeAct.setStatusTip(self.tr(
436 'Generate a getter/setter for an attribute')) 436 'Generate a getter/setter for an attribute'))
437 self.refactoringEncapsulateAttributeAct.setWhatsThis(self.trUtf8( 437 self.refactoringEncapsulateAttributeAct.setWhatsThis(self.tr(
438 """<b>Encapsulate Attribute</b>""" 438 """<b>Encapsulate Attribute</b>"""
439 """<p>Generate a getter/setter for an attribute and changes""" 439 """<p>Generate a getter/setter for an attribute and changes"""
440 """ its occurrences to use them.</p>""" 440 """ its occurrences to use them.</p>"""
441 )) 441 ))
442 self.refactoringEncapsulateAttributeAct.triggered[()].connect( 442 self.refactoringEncapsulateAttributeAct.triggered.connect(
443 self.__encapsulateAttribute) 443 self.__encapsulateAttribute)
444 self.actions.append(self.refactoringEncapsulateAttributeAct) 444 self.actions.append(self.refactoringEncapsulateAttributeAct)
445 445
446 self.refactoringLocalVariableToAttributeAct = E5Action( 446 self.refactoringLocalVariableToAttributeAct = E5Action(
447 self.trUtf8('Local Variable to Attribute'), 447 self.tr('Local Variable to Attribute'),
448 self.trUtf8('Local Varia&ble to Attribute'), 448 self.tr('Local Varia&ble to Attribute'),
449 0, 0, 449 0, 0,
450 self, 'refactoring_local_variable_to_attribute') 450 self, 'refactoring_local_variable_to_attribute')
451 self.refactoringLocalVariableToAttributeAct.setStatusTip(self.trUtf8( 451 self.refactoringLocalVariableToAttributeAct.setStatusTip(self.tr(
452 'Change a local variable to an attribute')) 452 'Change a local variable to an attribute'))
453 self.refactoringLocalVariableToAttributeAct.setWhatsThis(self.trUtf8( 453 self.refactoringLocalVariableToAttributeAct.setWhatsThis(self.tr(
454 """<b>Local Variable to Attribute</b>""" 454 """<b>Local Variable to Attribute</b>"""
455 """<p>Change a local variable to an attribute.</p>""" 455 """<p>Change a local variable to an attribute.</p>"""
456 )) 456 ))
457 self.refactoringLocalVariableToAttributeAct.triggered[()].connect( 457 self.refactoringLocalVariableToAttributeAct.triggered.connect(
458 self.__convertLocalToAttribute) 458 self.__convertLocalToAttribute)
459 self.actions.append(self.refactoringLocalVariableToAttributeAct) 459 self.actions.append(self.refactoringLocalVariableToAttributeAct)
460 460
461 self.refactoringMethodToMethodObjectAct = E5Action( 461 self.refactoringMethodToMethodObjectAct = E5Action(
462 self.trUtf8('Method To Method Object'), 462 self.tr('Method To Method Object'),
463 self.trUtf8('Method To Method Ob&ject'), 463 self.tr('Method To Method Ob&ject'),
464 0, 0, 464 0, 0,
465 self, 'refactoring_method_to_methodobject') 465 self, 'refactoring_method_to_methodobject')
466 self.refactoringMethodToMethodObjectAct.setStatusTip(self.trUtf8( 466 self.refactoringMethodToMethodObjectAct.setStatusTip(self.tr(
467 'Transform a function or a method to a method object')) 467 'Transform a function or a method to a method object'))
468 self.refactoringMethodToMethodObjectAct.setWhatsThis(self.trUtf8( 468 self.refactoringMethodToMethodObjectAct.setWhatsThis(self.tr(
469 """<b>Method To Method Object</b>""" 469 """<b>Method To Method Object</b>"""
470 """<p>Transform a function or a method to a method object.</p>""" 470 """<p>Transform a function or a method to a method object.</p>"""
471 )) 471 ))
472 self.refactoringMethodToMethodObjectAct.triggered[()].connect( 472 self.refactoringMethodToMethodObjectAct.triggered.connect(
473 self.__methodToMethodObject) 473 self.__methodToMethodObject)
474 self.actions.append(self.refactoringMethodToMethodObjectAct) 474 self.actions.append(self.refactoringMethodToMethodObjectAct)
475 475
476 ##################################################### 476 #####################################################
477 ## Undo/Redo actions 477 ## Undo/Redo actions
478 ##################################################### 478 #####################################################
479 479
480 self.refactoringUndoAct = E5Action( 480 self.refactoringUndoAct = E5Action(
481 self.trUtf8('Undo'), 481 self.tr('Undo'),
482 self.trUtf8('&Undo'), 482 self.tr('&Undo'),
483 0, 0, 483 0, 0,
484 self, 'refactoring_undo') 484 self, 'refactoring_undo')
485 self.refactoringUndoAct.setStatusTip(self.trUtf8( 485 self.refactoringUndoAct.setStatusTip(self.tr(
486 'Undo the last refactoring')) 486 'Undo the last refactoring'))
487 self.refactoringUndoAct.setWhatsThis(self.trUtf8( 487 self.refactoringUndoAct.setWhatsThis(self.tr(
488 """<b>Undo</b>""" 488 """<b>Undo</b>"""
489 """<p>Undo the last refactoring.</p>""" 489 """<p>Undo the last refactoring.</p>"""
490 )) 490 ))
491 self.refactoringUndoAct.triggered[()].connect( 491 self.refactoringUndoAct.triggered.connect(
492 self.__undo) 492 self.__undo)
493 self.actions.append(self.refactoringUndoAct) 493 self.actions.append(self.refactoringUndoAct)
494 494
495 self.refactoringRedoAct = E5Action( 495 self.refactoringRedoAct = E5Action(
496 self.trUtf8('Redo'), 496 self.tr('Redo'),
497 self.trUtf8('Re&do'), 497 self.tr('Re&do'),
498 0, 0, 498 0, 0,
499 self, 'refactoring_redo') 499 self, 'refactoring_redo')
500 self.refactoringRedoAct.setStatusTip(self.trUtf8( 500 self.refactoringRedoAct.setStatusTip(self.tr(
501 'Redo the last refactoring')) 501 'Redo the last refactoring'))
502 self.refactoringRedoAct.setWhatsThis(self.trUtf8( 502 self.refactoringRedoAct.setWhatsThis(self.tr(
503 """<b>Redo</b>""" 503 """<b>Redo</b>"""
504 """<p>Redo the last refactoring.</p>""" 504 """<p>Redo the last refactoring.</p>"""
505 )) 505 ))
506 self.refactoringRedoAct.triggered[()].connect( 506 self.refactoringRedoAct.triggered.connect(
507 self.__redo) 507 self.__redo)
508 self.actions.append(self.refactoringRedoAct) 508 self.actions.append(self.refactoringRedoAct)
509 509
510 self.refactoringUndoHistoryAct = E5Action( 510 self.refactoringUndoHistoryAct = E5Action(
511 self.trUtf8('Show Project Undo History'), 511 self.tr('Show Project Undo History'),
512 self.trUtf8('Show Project Undo History'), 512 self.tr('Show Project Undo History'),
513 0, 0, 513 0, 0,
514 self, 'refactoring_show_project_undo_history') 514 self, 'refactoring_show_project_undo_history')
515 self.refactoringUndoHistoryAct.setStatusTip(self.trUtf8( 515 self.refactoringUndoHistoryAct.setStatusTip(self.tr(
516 'Show the undo history of the project')) 516 'Show the undo history of the project'))
517 self.refactoringUndoHistoryAct.setWhatsThis(self.trUtf8( 517 self.refactoringUndoHistoryAct.setWhatsThis(self.tr(
518 """<b>Show Project Undo History</b>""" 518 """<b>Show Project Undo History</b>"""
519 """<p>Opens a dialog to show the undo history list of""" 519 """<p>Opens a dialog to show the undo history list of"""
520 """ the project.</p>""" 520 """ the project.</p>"""
521 )) 521 ))
522 self.refactoringUndoHistoryAct.triggered[()].connect( 522 self.refactoringUndoHistoryAct.triggered.connect(
523 self.__showProjectUndoHistory) 523 self.__showProjectUndoHistory)
524 self.actions.append(self.refactoringUndoHistoryAct) 524 self.actions.append(self.refactoringUndoHistoryAct)
525 525
526 self.refactoringRedoHistoryAct = E5Action( 526 self.refactoringRedoHistoryAct = E5Action(
527 self.trUtf8('Show Project Redo History'), 527 self.tr('Show Project Redo History'),
528 self.trUtf8('Show Project Redo History'), 528 self.tr('Show Project Redo History'),
529 0, 0, 529 0, 0,
530 self, 'refactoring_show_project_redo_history') 530 self, 'refactoring_show_project_redo_history')
531 self.refactoringRedoHistoryAct.setStatusTip(self.trUtf8( 531 self.refactoringRedoHistoryAct.setStatusTip(self.tr(
532 'Show the redo history of the project')) 532 'Show the redo history of the project'))
533 self.refactoringRedoHistoryAct.setWhatsThis(self.trUtf8( 533 self.refactoringRedoHistoryAct.setWhatsThis(self.tr(
534 """<b>Show Project Redo History</b>""" 534 """<b>Show Project Redo History</b>"""
535 """<p>Opens a dialog to show the redo history list of""" 535 """<p>Opens a dialog to show the redo history list of"""
536 """ the project.</p>""" 536 """ the project.</p>"""
537 )) 537 ))
538 self.refactoringRedoHistoryAct.triggered[()].connect( 538 self.refactoringRedoHistoryAct.triggered.connect(
539 self.__showProjectRedoHistory) 539 self.__showProjectRedoHistory)
540 self.actions.append(self.refactoringRedoHistoryAct) 540 self.actions.append(self.refactoringRedoHistoryAct)
541 541
542 self.refactoringUndoFileHistoryAct = E5Action( 542 self.refactoringUndoFileHistoryAct = E5Action(
543 self.trUtf8('Show Current File Undo History'), 543 self.tr('Show Current File Undo History'),
544 self.trUtf8('Show Current File Undo History'), 544 self.tr('Show Current File Undo History'),
545 0, 0, 545 0, 0,
546 self, 'refactoring_show_file_undo_history') 546 self, 'refactoring_show_file_undo_history')
547 self.refactoringUndoFileHistoryAct.setStatusTip(self.trUtf8( 547 self.refactoringUndoFileHistoryAct.setStatusTip(self.tr(
548 'Show the undo history of the current file')) 548 'Show the undo history of the current file'))
549 self.refactoringUndoFileHistoryAct.setWhatsThis(self.trUtf8( 549 self.refactoringUndoFileHistoryAct.setWhatsThis(self.tr(
550 """<b>Show Current File Undo History</b>""" 550 """<b>Show Current File Undo History</b>"""
551 """<p>Opens a dialog to show the undo history list of""" 551 """<p>Opens a dialog to show the undo history list of"""
552 """ the current file.</p>""" 552 """ the current file.</p>"""
553 )) 553 ))
554 self.refactoringUndoFileHistoryAct.triggered[()].connect( 554 self.refactoringUndoFileHistoryAct.triggered.connect(
555 self.__showFileUndoHistory) 555 self.__showFileUndoHistory)
556 self.actions.append(self.refactoringUndoFileHistoryAct) 556 self.actions.append(self.refactoringUndoFileHistoryAct)
557 557
558 self.refactoringRedoFileHistoryAct = E5Action( 558 self.refactoringRedoFileHistoryAct = E5Action(
559 self.trUtf8('Show Current File Redo History'), 559 self.tr('Show Current File Redo History'),
560 self.trUtf8('Show Current File Redo History'), 560 self.tr('Show Current File Redo History'),
561 0, 0, 561 0, 0,
562 self, 'refactoring_show_file_redo_history') 562 self, 'refactoring_show_file_redo_history')
563 self.refactoringRedoFileHistoryAct.setStatusTip(self.trUtf8( 563 self.refactoringRedoFileHistoryAct.setStatusTip(self.tr(
564 'Show the redo history of the current file')) 564 'Show the redo history of the current file'))
565 self.refactoringRedoFileHistoryAct.setWhatsThis(self.trUtf8( 565 self.refactoringRedoFileHistoryAct.setWhatsThis(self.tr(
566 """<b>Show Current File Redo History</b>""" 566 """<b>Show Current File Redo History</b>"""
567 """<p>Opens a dialog to show the redo history list of""" 567 """<p>Opens a dialog to show the redo history list of"""
568 """ the current file.</p>""" 568 """ the current file.</p>"""
569 )) 569 ))
570 self.refactoringRedoFileHistoryAct.triggered[()].connect( 570 self.refactoringRedoFileHistoryAct.triggered.connect(
571 self.__showFileRedoHistory) 571 self.__showFileRedoHistory)
572 self.actions.append(self.refactoringRedoFileHistoryAct) 572 self.actions.append(self.refactoringRedoFileHistoryAct)
573 573
574 self.refactoringClearHistoryAct = E5Action( 574 self.refactoringClearHistoryAct = E5Action(
575 self.trUtf8('Clear History'), 575 self.tr('Clear History'),
576 self.trUtf8('Clear History'), 576 self.tr('Clear History'),
577 0, 0, 577 0, 0,
578 self, 'refactoring_clear_history') 578 self, 'refactoring_clear_history')
579 self.refactoringClearHistoryAct.setStatusTip(self.trUtf8( 579 self.refactoringClearHistoryAct.setStatusTip(self.tr(
580 'Clear the refactoring history')) 580 'Clear the refactoring history'))
581 self.refactoringClearHistoryAct.setWhatsThis(self.trUtf8( 581 self.refactoringClearHistoryAct.setWhatsThis(self.tr(
582 """<b>Clear History</b>""" 582 """<b>Clear History</b>"""
583 """<p>Clears the refactoring history.</p>""" 583 """<p>Clears the refactoring history.</p>"""
584 )) 584 ))
585 self.refactoringClearHistoryAct.triggered[()].connect( 585 self.refactoringClearHistoryAct.triggered.connect(
586 self.__clearHistory) 586 self.__clearHistory)
587 self.actions.append(self.refactoringClearHistoryAct) 587 self.actions.append(self.refactoringClearHistoryAct)
588 588
589 ##################################################### 589 #####################################################
590 ## Query actions 590 ## Query actions
591 ##################################################### 591 #####################################################
592 592
593 self.queryReferencesAct = E5Action( 593 self.queryReferencesAct = E5Action(
594 self.trUtf8('Find occurrences'), 594 self.tr('Find occurrences'),
595 self.trUtf8('Find &Occurrences'), 595 self.tr('Find &Occurrences'),
596 0, 0, 596 0, 0,
597 self, 'refactoring_find_occurrences') 597 self, 'refactoring_find_occurrences')
598 self.queryReferencesAct.setStatusTip(self.trUtf8( 598 self.queryReferencesAct.setStatusTip(self.tr(
599 'Find occurrences of the highlighted object')) 599 'Find occurrences of the highlighted object'))
600 self.queryReferencesAct.setWhatsThis(self.trUtf8( 600 self.queryReferencesAct.setWhatsThis(self.tr(
601 """<b>Find occurrences</b>""" 601 """<b>Find occurrences</b>"""
602 """<p>Find occurrences of the highlighted class, method,""" 602 """<p>Find occurrences of the highlighted class, method,"""
603 """ function or variable.</p>""" 603 """ function or variable.</p>"""
604 )) 604 ))
605 self.queryReferencesAct.triggered[()].connect( 605 self.queryReferencesAct.triggered.connect(
606 self.__queryReferences) 606 self.__queryReferences)
607 self.actions.append(self.queryReferencesAct) 607 self.actions.append(self.queryReferencesAct)
608 608
609 self.queryDefinitionAct = E5Action( 609 self.queryDefinitionAct = E5Action(
610 self.trUtf8('Find definition'), 610 self.tr('Find definition'),
611 self.trUtf8('Find &Definition'), 611 self.tr('Find &Definition'),
612 0, 0, 612 0, 0,
613 self, 'refactoring_find_definition') 613 self, 'refactoring_find_definition')
614 self.queryDefinitionAct.setStatusTip(self.trUtf8( 614 self.queryDefinitionAct.setStatusTip(self.tr(
615 'Find definition of the highlighted item')) 615 'Find definition of the highlighted item'))
616 self.queryDefinitionAct.setWhatsThis(self.trUtf8( 616 self.queryDefinitionAct.setWhatsThis(self.tr(
617 """<b>Find definition</b>""" 617 """<b>Find definition</b>"""
618 """<p>Find the definition of the highlighted class, method,""" 618 """<p>Find the definition of the highlighted class, method,"""
619 """ function or variable.</p>""" 619 """ function or variable.</p>"""
620 )) 620 ))
621 self.queryDefinitionAct.triggered[()].connect( 621 self.queryDefinitionAct.triggered.connect(
622 self.__queryDefinition) 622 self.__queryDefinition)
623 self.actions.append(self.queryDefinitionAct) 623 self.actions.append(self.queryDefinitionAct)
624 624
625 self.queryImplementationsAct = E5Action( 625 self.queryImplementationsAct = E5Action(
626 self.trUtf8('Find implementations'), 626 self.tr('Find implementations'),
627 self.trUtf8('Find &Implementations'), 627 self.tr('Find &Implementations'),
628 0, 0, 628 0, 0,
629 self, 'refactoring_find_implementations') 629 self, 'refactoring_find_implementations')
630 self.queryImplementationsAct.setStatusTip(self.trUtf8( 630 self.queryImplementationsAct.setStatusTip(self.tr(
631 'Find places where the selected method is overridden')) 631 'Find places where the selected method is overridden'))
632 self.queryImplementationsAct.setWhatsThis(self.trUtf8( 632 self.queryImplementationsAct.setWhatsThis(self.tr(
633 """<b>Find implementations</b>""" 633 """<b>Find implementations</b>"""
634 """<p>Find places where the selected method is overridden.</p>""" 634 """<p>Find places where the selected method is overridden.</p>"""
635 )) 635 ))
636 self.queryImplementationsAct.triggered[()].connect( 636 self.queryImplementationsAct.triggered.connect(
637 self.__queryImplementations) 637 self.__queryImplementations)
638 self.actions.append(self.queryImplementationsAct) 638 self.actions.append(self.queryImplementationsAct)
639 639
640 ##################################################### 640 #####################################################
641 ## Various actions 641 ## Various actions
642 ##################################################### 642 #####################################################
643 643
644 self.refactoringEditConfigAct = E5Action( 644 self.refactoringEditConfigAct = E5Action(
645 self.trUtf8('Configure Rope'), 645 self.tr('Configure Rope'),
646 self.trUtf8('&Configure Rope'), 646 self.tr('&Configure Rope'),
647 0, 0, 647 0, 0,
648 self, 'refactoring_edit_config') 648 self, 'refactoring_edit_config')
649 self.refactoringEditConfigAct.setStatusTip(self.trUtf8( 649 self.refactoringEditConfigAct.setStatusTip(self.tr(
650 'Open the rope configuration file')) 650 'Open the rope configuration file'))
651 self.refactoringEditConfigAct.setWhatsThis(self.trUtf8( 651 self.refactoringEditConfigAct.setWhatsThis(self.tr(
652 """<b>Configure Rope</b>""" 652 """<b>Configure Rope</b>"""
653 """<p>Opens the rope configuration file in an editor.</p>""" 653 """<p>Opens the rope configuration file in an editor.</p>"""
654 )) 654 ))
655 self.refactoringEditConfigAct.triggered[()].connect( 655 self.refactoringEditConfigAct.triggered.connect(
656 self.__editConfig) 656 self.__editConfig)
657 self.refactoringEditConfigAct.setMenuRole(QAction.NoRole) 657 self.refactoringEditConfigAct.setMenuRole(QAction.NoRole)
658 self.actions.append(self.refactoringEditConfigAct) 658 self.actions.append(self.refactoringEditConfigAct)
659 659
660 self.refactoringHelpAct = E5Action( 660 self.refactoringHelpAct = E5Action(
661 self.trUtf8('Rope help'), 661 self.tr('Rope help'),
662 self.trUtf8('Rope &Help'), 662 self.tr('Rope &Help'),
663 0, 0, 663 0, 0,
664 self, 'refactoring_help') 664 self, 'refactoring_help')
665 self.refactoringHelpAct.setStatusTip(self.trUtf8( 665 self.refactoringHelpAct.setStatusTip(self.tr(
666 'Show help about the rope refactorings')) 666 'Show help about the rope refactorings'))
667 self.refactoringHelpAct.setWhatsThis(self.trUtf8( 667 self.refactoringHelpAct.setWhatsThis(self.tr(
668 """<b>Rope help</b>""" 668 """<b>Rope help</b>"""
669 """<p>Show some help text about the rope refactorings.</p>""" 669 """<p>Show some help text about the rope refactorings.</p>"""
670 )) 670 ))
671 self.refactoringHelpAct.triggered[()].connect( 671 self.refactoringHelpAct.triggered.connect(
672 self.__showRopeHelp) 672 self.__showRopeHelp)
673 self.actions.append(self.refactoringHelpAct) 673 self.actions.append(self.refactoringHelpAct)
674 674
675 self.refactoringAllSoaAct = E5Action( 675 self.refactoringAllSoaAct = E5Action(
676 self.trUtf8('Analyse all modules'), 676 self.tr('Analyse all modules'),
677 self.trUtf8('&Analyse all modules'), 677 self.tr('&Analyse all modules'),
678 0, 0, 678 0, 0,
679 self, 'refactoring_analyze_all') 679 self, 'refactoring_analyze_all')
680 self.refactoringAllSoaAct.setStatusTip(self.trUtf8( 680 self.refactoringAllSoaAct.setStatusTip(self.tr(
681 'Perform static object analysis on all modules')) 681 'Perform static object analysis on all modules'))
682 self.refactoringAllSoaAct.setWhatsThis(self.trUtf8( 682 self.refactoringAllSoaAct.setWhatsThis(self.tr(
683 """<b>Analyse all modules</b>""" 683 """<b>Analyse all modules</b>"""
684 """<p>Perform static object analysis (SOA) on all modules. """ 684 """<p>Perform static object analysis (SOA) on all modules. """
685 """This might be time consuming. Analysis of all modules """ 685 """This might be time consuming. Analysis of all modules """
686 """should only be neccessary, if the project was created """ 686 """should only be neccessary, if the project was created """
687 """with the rope plugin disabled or if files were added.</p>""" 687 """with the rope plugin disabled or if files were added.</p>"""
688 )) 688 ))
689 self.refactoringAllSoaAct.triggered[()].connect( 689 self.refactoringAllSoaAct.triggered.connect(
690 self.__performSOA) 690 self.__performSOA)
691 self.actions.append(self.refactoringAllSoaAct) 691 self.actions.append(self.refactoringAllSoaAct)
692 692
693 self.updateConfigAct = E5Action( 693 self.updateConfigAct = E5Action(
694 self.trUtf8('Update Configuration'), 694 self.tr('Update Configuration'),
695 self.trUtf8('&Update Configuration'), 695 self.tr('&Update Configuration'),
696 0, 0, 696 0, 0,
697 self, 'refactoring_update_configuration') 697 self, 'refactoring_update_configuration')
698 self.updateConfigAct.setStatusTip(self.trUtf8( 698 self.updateConfigAct.setStatusTip(self.tr(
699 'Generates a new configuration file overwriting the current one.')) 699 'Generates a new configuration file overwriting the current one.'))
700 self.updateConfigAct.setWhatsThis(self.trUtf8( 700 self.updateConfigAct.setWhatsThis(self.tr(
701 """<b>Update Configuration</b>""" 701 """<b>Update Configuration</b>"""
702 """<p>Generates a new configuration file overwriting""" 702 """<p>Generates a new configuration file overwriting"""
703 """ the current one.</p>""" 703 """ the current one.</p>"""
704 )) 704 ))
705 self.updateConfigAct.triggered[()].connect( 705 self.updateConfigAct.triggered.connect(
706 self.__updateConfig) 706 self.__updateConfig)
707 self.actions.append(self.updateConfigAct) 707 self.actions.append(self.updateConfigAct)
708 708
709 for act in self.actions: 709 for act in self.actions:
710 act.setEnabled(False) 710 act.setEnabled(False)
713 """ 713 """
714 Public slot to initialize the refactoring menu. 714 Public slot to initialize the refactoring menu.
715 715
716 @return the menu generated (QMenu) 716 @return the menu generated (QMenu)
717 """ 717 """
718 menu = QMenu(self.trUtf8('&Refactoring'), self.__ui) 718 menu = QMenu(self.tr('&Refactoring'), self.__ui)
719 menu.setTearOffEnabled(True) 719 menu.setTearOffEnabled(True)
720 720
721 act = menu.addAction('rope', self.__ropeInfo) 721 act = menu.addAction('rope', self.__ropeInfo)
722 font = act.font() 722 font = act.font()
723 font.setBold(True) 723 font.setBold(True)
724 act.setFont(font) 724 act.setFont(font)
725 menu.addSeparator() 725 menu.addSeparator()
726 726
727 smenu = menu.addMenu(self.trUtf8("&Query")) 727 smenu = menu.addMenu(self.tr("&Query"))
728 smenu.addAction(self.queryReferencesAct) 728 smenu.addAction(self.queryReferencesAct)
729 smenu.addAction(self.queryDefinitionAct) 729 smenu.addAction(self.queryDefinitionAct)
730 smenu.addAction(self.queryImplementationsAct) 730 smenu.addAction(self.queryImplementationsAct)
731 731
732 smenu = menu.addMenu(self.trUtf8("&Refactoring")) 732 smenu = menu.addMenu(self.tr("&Refactoring"))
733 smenu.aboutToShow.connect(self.__showRefactoringMenu) 733 smenu.aboutToShow.connect(self.__showRefactoringMenu)
734 smenu.addAction(self.refactoringRenameAct) 734 smenu.addAction(self.refactoringRenameAct)
735 smenu.addAction(self.refactoringRenameLocalAct) 735 smenu.addAction(self.refactoringRenameLocalAct)
736 smenu.addAction(self.refactoringChangeOccurrencesAct) 736 smenu.addAction(self.refactoringChangeOccurrencesAct)
737 smenu.addSeparator() 737 smenu.addSeparator()
759 smenu.addAction(self.refactoringRenameModuleAct) 759 smenu.addAction(self.refactoringRenameModuleAct)
760 smenu.addAction(self.refactoringMoveModuleAct) 760 smenu.addAction(self.refactoringMoveModuleAct)
761 smenu.addAction(self.refactoringTransformModuleAct) 761 smenu.addAction(self.refactoringTransformModuleAct)
762 smenu.addSeparator() 762 smenu.addSeparator()
763 763
764 imenu = smenu.addMenu(self.trUtf8("Im&ports")) 764 imenu = smenu.addMenu(self.tr("Im&ports"))
765 imenu.addAction(self.refactoringImportsOrganizeAct) 765 imenu.addAction(self.refactoringImportsOrganizeAct)
766 imenu.addAction(self.refactoringImportsStarExpandAct) 766 imenu.addAction(self.refactoringImportsStarExpandAct)
767 imenu.addAction(self.refactoringImportsRelativeToAbsoluteAct) 767 imenu.addAction(self.refactoringImportsRelativeToAbsoluteAct)
768 imenu.addAction(self.refactoringImportsFromsToImportsAct) 768 imenu.addAction(self.refactoringImportsFromsToImportsAct)
769 imenu.addAction(self.refactoringImportsHandleLongAct) 769 imenu.addAction(self.refactoringImportsHandleLongAct)
771 smenu.addSeparator() 771 smenu.addSeparator()
772 smenu.addAction(self.refactoringUndoAct) 772 smenu.addAction(self.refactoringUndoAct)
773 smenu.addAction(self.refactoringRedoAct) 773 smenu.addAction(self.refactoringRedoAct)
774 smenu.addSeparator() 774 smenu.addSeparator()
775 775
776 hmenu = smenu.addMenu(self.trUtf8("History")) 776 hmenu = smenu.addMenu(self.tr("History"))
777 hmenu.aboutToShow.connect(self.__showRefactoringHistoryMenu) 777 hmenu.aboutToShow.connect(self.__showRefactoringHistoryMenu)
778 hmenu.addAction(self.refactoringUndoHistoryAct) 778 hmenu.addAction(self.refactoringUndoHistoryAct)
779 hmenu.addAction(self.refactoringUndoFileHistoryAct) 779 hmenu.addAction(self.refactoringUndoFileHistoryAct)
780 hmenu.addSeparator() 780 hmenu.addSeparator()
781 hmenu.addAction(self.refactoringRedoHistoryAct) 781 hmenu.addAction(self.refactoringRedoHistoryAct)
782 hmenu.addAction(self.refactoringRedoFileHistoryAct) 782 hmenu.addAction(self.refactoringRedoFileHistoryAct)
783 hmenu.addSeparator() 783 hmenu.addSeparator()
784 hmenu.addAction(self.refactoringClearHistoryAct) 784 hmenu.addAction(self.refactoringClearHistoryAct)
785 785
786 smenu = menu.addMenu(self.trUtf8("&Utilities")) 786 smenu = menu.addMenu(self.tr("&Utilities"))
787 smenu.addAction(self.refactoringAllSoaAct) 787 smenu.addAction(self.refactoringAllSoaAct)
788 smenu.addSeparator() 788 smenu.addSeparator()
789 smenu.addAction(self.updateConfigAct) 789 smenu.addAction(self.updateConfigAct)
790 790
791 menu.addSeparator() 791 menu.addSeparator()
803 """ 803 """
804 Private slot to show some info about rope. 804 Private slot to show some info about rope.
805 """ 805 """
806 E5MessageBox.about( 806 E5MessageBox.about(
807 self.__ui, 807 self.__ui,
808 self.trUtf8("About rope"), 808 self.tr("About rope"),
809 self.trUtf8("{0}\nVersion {1}\n\n{2}".format( 809 self.tr("{0}\nVersion {1}\n\n{2}".format(
810 rope.INFO, rope.VERSION, rope.COPYRIGHT))) 810 rope.INFO, rope.VERSION, rope.COPYRIGHT)))
811 811
812 def __canUndo(self): 812 def __canUndo(self):
813 """ 813 """
814 Private slot to check, if there are changes to be undone. 814 Private slot to check, if there are changes to be undone.
912 handle.reset() 912 handle.reset()
913 if str(type(err)).split()[-1][1:-2].split('.')[-1] == \ 913 if str(type(err)).split()[-1][1:-2].split('.')[-1] == \
914 'ModuleSyntaxError': 914 'ModuleSyntaxError':
915 res = E5MessageBox.warning( 915 res = E5MessageBox.warning(
916 self.__ui, title, 916 self.__ui, title,
917 self.trUtf8("Rope error: {0}").format(str(err)), 917 self.tr("Rope error: {0}").format(str(err)),
918 E5MessageBox.Ok | E5MessageBox.Open) 918 E5MessageBox.Ok | E5MessageBox.Open)
919 if res == E5MessageBox.Open: 919 if res == E5MessageBox.Open:
920 e5App().getObject("ViewManager").openSourceFile( 920 e5App().getObject("ViewManager").openSourceFile(
921 os.path.join(self.__e5project.getProjectPath(), 921 os.path.join(self.__e5project.getProjectPath(),
922 err.filename), 922 err.filename),
923 err.lineno) 923 err.lineno)
924 else: 924 else:
925 E5MessageBox.warning( 925 E5MessageBox.warning(
926 self.__ui, title, 926 self.__ui, title,
927 self.trUtf8("Rope error: {0}").format(str(err))) 927 self.tr("Rope error: {0}").format(str(err)))
928 928
929 def __getOffset(self, editor, line, index): 929 def __getOffset(self, editor, line, index):
930 r""" 930 r"""
931 Private method to get the offset into the text treating CRLF as ONE 931 Private method to get the offset into the text treating CRLF as ONE
932 character. 932 character.
953 953
954 def __rename(self): 954 def __rename(self):
955 """ 955 """
956 Private slot to handle the Rename action. 956 Private slot to handle the Rename action.
957 """ 957 """
958 self.__doRename(self.trUtf8('Rename')) 958 self.__doRename(self.tr('Rename'))
959 959
960 def __renameLocal(self): 960 def __renameLocal(self):
961 """ 961 """
962 Private slot to handle the Local Rename action. 962 Private slot to handle the Local Rename action.
963 """ 963 """
964 self.__doRename(self.trUtf8('Local Rename'), isLocal=True) 964 self.__doRename(self.tr('Local Rename'), isLocal=True)
965 965
966 def __renameModule(self): 966 def __renameModule(self):
967 """ 967 """
968 Private slot to handle the Rename Current Module action. 968 Private slot to handle the Rename Current Module action.
969 """ 969 """
970 self.__doRename(self.trUtf8('Rename Current Module'), 970 self.__doRename(self.tr('Rename Current Module'),
971 renameModule=True) 971 renameModule=True)
972 972
973 def __doRename(self, title, isLocal=False, renameModule=False): 973 def __doRename(self, title, isLocal=False, renameModule=False):
974 """ 974 """
975 Private method to perform the various renaming refactorings. 975 Private method to perform the various renaming refactorings.
987 987
988 if not renameModule and not aw.hasSelectedText(): 988 if not renameModule and not aw.hasSelectedText():
989 # no selection available 989 # no selection available
990 E5MessageBox.warning( 990 E5MessageBox.warning(
991 self.__ui, title, 991 self.__ui, title,
992 self.trUtf8("Highlight the declaration you want to rename" 992 self.tr("Highlight the declaration you want to rename"
993 " and try again.")) 993 " and try again."))
994 return 994 return
995 995
996 if isLocal: 996 if isLocal:
997 if not self.confirmBufferIsSaved(aw): 997 if not self.confirmBufferIsSaved(aw):
998 return 998 return
1007 line, index, line1, index1 = aw.getSelection() 1007 line, index, line1, index1 = aw.getSelection()
1008 if line != line1: 1008 if line != line1:
1009 # selection span more than one line 1009 # selection span more than one line
1010 E5MessageBox.warning( 1010 E5MessageBox.warning(
1011 self.__ui, title, 1011 self.__ui, title,
1012 self.trUtf8("The selection must not extend beyond" 1012 self.tr("The selection must not extend beyond"
1013 " one line.")) 1013 " one line."))
1014 return 1014 return
1015 index = int(index + (index1 - index) / 2) 1015 index = int(index + (index1 - index) / 2)
1016 # keep it inside the object 1016 # keep it inside the object
1017 offset = self.__getOffset(aw, line, index) 1017 offset = self.__getOffset(aw, line, index)
1018 1018
1042 aw = e5App().getObject("ViewManager").activeWindow() 1042 aw = e5App().getObject("ViewManager").activeWindow()
1043 1043
1044 if aw is None: 1044 if aw is None:
1045 return 1045 return
1046 1046
1047 title = self.trUtf8("Change Occurrences") 1047 title = self.tr("Change Occurrences")
1048 if not aw.hasSelectedText(): 1048 if not aw.hasSelectedText():
1049 # no selection available 1049 # no selection available
1050 E5MessageBox.warning( 1050 E5MessageBox.warning(
1051 self.__ui, title, 1051 self.__ui, title,
1052 self.trUtf8("Highlight an occurrence to be changed" 1052 self.tr("Highlight an occurrence to be changed"
1053 " and try again.")) 1053 " and try again."))
1054 return 1054 return
1055 1055
1056 if not self.confirmBufferIsSaved(aw): 1056 if not self.confirmBufferIsSaved(aw):
1057 return 1057 return
1058 1058
1081 1081
1082 def __extractMethod(self): 1082 def __extractMethod(self):
1083 """ 1083 """
1084 Private slot to handle the Extract Method action. 1084 Private slot to handle the Extract Method action.
1085 """ 1085 """
1086 self.__doExtract(self.trUtf8("Extract Method"), "method") 1086 self.__doExtract(self.tr("Extract Method"), "method")
1087 1087
1088 def __extractLocalVariable(self): 1088 def __extractLocalVariable(self):
1089 """ 1089 """
1090 Private slot to handle the Extract Local Variable action. 1090 Private slot to handle the Extract Local Variable action.
1091 """ 1091 """
1092 self.__doExtract(self.trUtf8("Extract Local Variable"), "variable") 1092 self.__doExtract(self.tr("Extract Local Variable"), "variable")
1093 1093
1094 def __doExtract(self, title, kind): 1094 def __doExtract(self, title, kind):
1095 """ 1095 """
1096 Private method to perform the extract refactoring. 1096 Private method to perform the extract refactoring.
1097 1097
1107 1107
1108 if not aw.hasSelectedText(): 1108 if not aw.hasSelectedText():
1109 # no selection available 1109 # no selection available
1110 E5MessageBox.warning( 1110 E5MessageBox.warning(
1111 self.__ui, title, 1111 self.__ui, title,
1112 self.trUtf8("Highlight the region of code you want to extract" 1112 self.tr("Highlight the region of code you want to extract"
1113 " and try again.")) 1113 " and try again."))
1114 return 1114 return
1115 1115
1116 if not self.confirmBufferIsSaved(aw): 1116 if not self.confirmBufferIsSaved(aw):
1117 return 1117 return
1118 1118
1152 aw = e5App().getObject("ViewManager").activeWindow() 1152 aw = e5App().getObject("ViewManager").activeWindow()
1153 1153
1154 if aw is None: 1154 if aw is None:
1155 return 1155 return
1156 1156
1157 title = self.trUtf8("Inline") 1157 title = self.tr("Inline")
1158 if not aw.hasSelectedText(): 1158 if not aw.hasSelectedText():
1159 # no selection available 1159 # no selection available
1160 E5MessageBox.warning( 1160 E5MessageBox.warning(
1161 self.__ui, title, 1161 self.__ui, title,
1162 self.trUtf8("Highlight the local variable, method or parameter" 1162 self.tr("Highlight the local variable, method or parameter"
1163 " you want to inline and try again.")) 1163 " you want to inline and try again."))
1164 return 1164 return
1165 1165
1166 if not self.confirmAllBuffersSaved(): 1166 if not self.confirmAllBuffersSaved():
1167 return 1167 return
1168 1168
1195 aw = e5App().getObject("ViewManager").activeWindow() 1195 aw = e5App().getObject("ViewManager").activeWindow()
1196 1196
1197 if aw is None: 1197 if aw is None:
1198 return 1198 return
1199 1199
1200 title = self.trUtf8("Move Method") 1200 title = self.tr("Move Method")
1201 if not aw.hasSelectedText(): 1201 if not aw.hasSelectedText():
1202 # no selection available 1202 # no selection available
1203 E5MessageBox.warning( 1203 E5MessageBox.warning(
1204 self.__ui, title, 1204 self.__ui, title,
1205 self.trUtf8("Highlight the method to move" 1205 self.tr("Highlight the method to move"
1206 " and try again.")) 1206 " and try again."))
1207 return 1207 return
1208 1208
1209 if not self.confirmAllBuffersSaved(): 1209 if not self.confirmAllBuffersSaved():
1210 return 1210 return
1211 1211
1239 aw = e5App().getObject("ViewManager").activeWindow() 1239 aw = e5App().getObject("ViewManager").activeWindow()
1240 1240
1241 if aw is None: 1241 if aw is None:
1242 return 1242 return
1243 1243
1244 title = self.trUtf8("Move Current Module") 1244 title = self.tr("Move Current Module")
1245 1245
1246 if not self.confirmAllBuffersSaved(): 1246 if not self.confirmAllBuffersSaved():
1247 return 1247 return
1248 1248
1249 filename = aw.getFileName() 1249 filename = aw.getFileName()
1274 aw = e5App().getObject("ViewManager").activeWindow() 1274 aw = e5App().getObject("ViewManager").activeWindow()
1275 1275
1276 if aw is None: 1276 if aw is None:
1277 return 1277 return
1278 1278
1279 title = self.trUtf8("Use Function") 1279 title = self.tr("Use Function")
1280 if not aw.hasSelectedText(): 1280 if not aw.hasSelectedText():
1281 # no selection available 1281 # no selection available
1282 E5MessageBox.warning( 1282 E5MessageBox.warning(
1283 self.__ui, title, 1283 self.__ui, title,
1284 self.trUtf8("Highlight a global function and try again.")) 1284 self.tr("Highlight a global function and try again."))
1285 return 1285 return
1286 1286
1287 if not self.confirmAllBuffersSaved(): 1287 if not self.confirmAllBuffersSaved():
1288 return 1288 return
1289 1289
1316 aw = e5App().getObject("ViewManager").activeWindow() 1316 aw = e5App().getObject("ViewManager").activeWindow()
1317 1317
1318 if aw is None: 1318 if aw is None:
1319 return 1319 return
1320 1320
1321 title = self.trUtf8("Introduce Factory Method") 1321 title = self.tr("Introduce Factory Method")
1322 if not aw.hasSelectedText(): 1322 if not aw.hasSelectedText():
1323 # no selection available 1323 # no selection available
1324 E5MessageBox.warning( 1324 E5MessageBox.warning(
1325 self.__ui, title, 1325 self.__ui, title,
1326 self.trUtf8("Highlight the class to introduce a factory" 1326 self.tr("Highlight the class to introduce a factory"
1327 " method for and try again.")) 1327 " method for and try again."))
1328 return 1328 return
1329 1329
1330 if not self.confirmAllBuffersSaved(): 1330 if not self.confirmAllBuffersSaved():
1331 return 1331 return
1332 1332
1357 aw = e5App().getObject("ViewManager").activeWindow() 1357 aw = e5App().getObject("ViewManager").activeWindow()
1358 1358
1359 if aw is None: 1359 if aw is None:
1360 return 1360 return
1361 1361
1362 title = self.trUtf8("Introduce Parameter") 1362 title = self.tr("Introduce Parameter")
1363 if not aw.hasSelectedText(): 1363 if not aw.hasSelectedText():
1364 # no selection available 1364 # no selection available
1365 E5MessageBox.warning( 1365 E5MessageBox.warning(
1366 self.__ui, title, 1366 self.__ui, title,
1367 self.trUtf8("Highlight the code for the new parameter" 1367 self.tr("Highlight the code for the new parameter"
1368 " and try again.")) 1368 " and try again."))
1369 return 1369 return
1370 1370
1371 if not self.confirmAllBuffersSaved(): 1371 if not self.confirmAllBuffersSaved():
1372 return 1372 return
1373 1373
1398 """ 1398 """
1399 Private slot to organize imports. 1399 Private slot to organize imports.
1400 """ 1400 """
1401 from rope.refactor.importutils import ImportOrganizer 1401 from rope.refactor.importutils import ImportOrganizer
1402 self.__doImports( 1402 self.__doImports(
1403 self.trUtf8("Organize Imports"), 1403 self.tr("Organize Imports"),
1404 ImportOrganizer.organize_imports) 1404 ImportOrganizer.organize_imports)
1405 1405
1406 def __importsExpandStar(self): 1406 def __importsExpandStar(self):
1407 """ 1407 """
1408 Private slot to expand star imports. 1408 Private slot to expand star imports.
1409 """ 1409 """
1410 from rope.refactor.importutils import ImportOrganizer 1410 from rope.refactor.importutils import ImportOrganizer
1411 self.__doImports( 1411 self.__doImports(
1412 self.trUtf8("Expand Star Imports"), 1412 self.tr("Expand Star Imports"),
1413 ImportOrganizer.expand_star_imports) 1413 ImportOrganizer.expand_star_imports)
1414 1414
1415 def __importsRelativeToAbsolute(self): 1415 def __importsRelativeToAbsolute(self):
1416 """ 1416 """
1417 Private slot to transform relative to absolute imports. 1417 Private slot to transform relative to absolute imports.
1418 """ 1418 """
1419 from rope.refactor.importutils import ImportOrganizer 1419 from rope.refactor.importutils import ImportOrganizer
1420 self.__doImports( 1420 self.__doImports(
1421 self.trUtf8("Relative to Absolute"), 1421 self.tr("Relative to Absolute"),
1422 ImportOrganizer.relatives_to_absolutes) 1422 ImportOrganizer.relatives_to_absolutes)
1423 1423
1424 def __importsFromToImport(self): 1424 def __importsFromToImport(self):
1425 """ 1425 """
1426 Private slot to transform from imports to plain imports. 1426 Private slot to transform from imports to plain imports.
1427 """ 1427 """
1428 from rope.refactor.importutils import ImportOrganizer 1428 from rope.refactor.importutils import ImportOrganizer
1429 self.__doImports( 1429 self.__doImports(
1430 self.trUtf8("Froms to Imports"), 1430 self.tr("Froms to Imports"),
1431 ImportOrganizer.froms_to_imports) 1431 ImportOrganizer.froms_to_imports)
1432 1432
1433 def __importsHandleLong(self): 1433 def __importsHandleLong(self):
1434 """ 1434 """
1435 Private slot to handle long imports. 1435 Private slot to handle long imports.
1436 """ 1436 """
1437 from rope.refactor.importutils import ImportOrganizer 1437 from rope.refactor.importutils import ImportOrganizer
1438 self.__doImports( 1438 self.__doImports(
1439 self.trUtf8("Handle Long Imports"), 1439 self.tr("Handle Long Imports"),
1440 ImportOrganizer.handle_long_imports) 1440 ImportOrganizer.handle_long_imports)
1441 1441
1442 def __doImports(self, title, method): 1442 def __doImports(self, title, method):
1443 """ 1443 """
1444 Private method to perform the various imports refactorings. 1444 Private method to perform the various imports refactorings.
1476 if self.__e5project.isDirty(): 1476 if self.__e5project.isDirty():
1477 self.__e5project.saveProject() 1477 self.__e5project.saveProject()
1478 else: 1478 else:
1479 E5MessageBox.information( 1479 E5MessageBox.information(
1480 self.__ui, title, 1480 self.__ui, title,
1481 self.trUtf8("The selected refactoring did not produce" 1481 self.tr("The selected refactoring did not produce"
1482 " any change.")) 1482 " any change."))
1483 except Exception as err: 1483 except Exception as err:
1484 self.handleRopeError(err, title) 1484 self.handleRopeError(err, title)
1485 1485
1486 ##################################################### 1486 #####################################################
1487 ## Various refactorings 1487 ## Various refactorings
1490 def __restructure(self): 1490 def __restructure(self):
1491 """ 1491 """
1492 Private slot to restructure code. 1492 Private slot to restructure code.
1493 """ 1493 """
1494 from RestructureDialog import RestructureDialog 1494 from RestructureDialog import RestructureDialog
1495 title = self.trUtf8("Restructure") 1495 title = self.tr("Restructure")
1496 self.dlg = RestructureDialog(self, title, parent=self.__ui) 1496 self.dlg = RestructureDialog(self, title, parent=self.__ui)
1497 self.dlg.show() 1497 self.dlg.show()
1498 1498
1499 def __changeSignature(self): 1499 def __changeSignature(self):
1500 """ 1500 """
1503 aw = e5App().getObject("ViewManager").activeWindow() 1503 aw = e5App().getObject("ViewManager").activeWindow()
1504 1504
1505 if aw is None: 1505 if aw is None:
1506 return 1506 return
1507 1507
1508 title = self.trUtf8("Change Method Signature") 1508 title = self.tr("Change Method Signature")
1509 if not aw.hasSelectedText(): 1509 if not aw.hasSelectedText():
1510 # no selection available 1510 # no selection available
1511 E5MessageBox.warning( 1511 E5MessageBox.warning(
1512 self.__ui, title, 1512 self.__ui, title,
1513 self.trUtf8("Highlight the method or function to change" 1513 self.tr("Highlight the method or function to change"
1514 " and try again.")) 1514 " and try again."))
1515 return 1515 return
1516 1516
1517 if not self.confirmAllBuffersSaved(): 1517 if not self.confirmAllBuffersSaved():
1518 return 1518 return
1519 1519
1544 aw = e5App().getObject("ViewManager").activeWindow() 1544 aw = e5App().getObject("ViewManager").activeWindow()
1545 1545
1546 if aw is None: 1546 if aw is None:
1547 return 1547 return
1548 1548
1549 title = self.trUtf8("Inline Argument Default") 1549 title = self.tr("Inline Argument Default")
1550 if not aw.hasSelectedText(): 1550 if not aw.hasSelectedText():
1551 # no selection available 1551 # no selection available
1552 E5MessageBox.warning( 1552 E5MessageBox.warning(
1553 self.__ui, title, 1553 self.__ui, title,
1554 self.trUtf8("Highlight the method or function to inline" 1554 self.tr("Highlight the method or function to inline"
1555 " a parameter's default and try again.")) 1555 " a parameter's default and try again."))
1556 return 1556 return
1557 1557
1558 if not self.confirmAllBuffersSaved(): 1558 if not self.confirmAllBuffersSaved():
1559 return 1559 return
1560 1560
1584 aw = e5App().getObject("ViewManager").activeWindow() 1584 aw = e5App().getObject("ViewManager").activeWindow()
1585 1585
1586 if aw is None: 1586 if aw is None:
1587 return 1587 return
1588 1588
1589 title = self.trUtf8("Transform Module to Package") 1589 title = self.tr("Transform Module to Package")
1590 1590
1591 if not self.confirmAllBuffersSaved(): 1591 if not self.confirmAllBuffersSaved():
1592 return 1592 return
1593 1593
1594 filename = aw.getFileName() 1594 filename = aw.getFileName()
1613 aw = e5App().getObject("ViewManager").activeWindow() 1613 aw = e5App().getObject("ViewManager").activeWindow()
1614 1614
1615 if aw is None: 1615 if aw is None:
1616 return 1616 return
1617 1617
1618 title = self.trUtf8("Encapsulate Attribute") 1618 title = self.tr("Encapsulate Attribute")
1619 if not aw.hasSelectedText(): 1619 if not aw.hasSelectedText():
1620 # no selection available 1620 # no selection available
1621 E5MessageBox.warning( 1621 E5MessageBox.warning(
1622 self.__ui, title, 1622 self.__ui, title,
1623 self.trUtf8("Highlight the attribute to encapsulate" 1623 self.tr("Highlight the attribute to encapsulate"
1624 " and try again.")) 1624 " and try again."))
1625 return 1625 return
1626 1626
1627 if not self.confirmAllBuffersSaved(): 1627 if not self.confirmAllBuffersSaved():
1628 return 1628 return
1629 1629
1671 aw = e5App().getObject("ViewManager").activeWindow() 1671 aw = e5App().getObject("ViewManager").activeWindow()
1672 1672
1673 if aw is None: 1673 if aw is None:
1674 return 1674 return
1675 1675
1676 title = self.trUtf8("Local Variable to Attribute") 1676 title = self.tr("Local Variable to Attribute")
1677 if not aw.hasSelectedText(): 1677 if not aw.hasSelectedText():
1678 # no selection available 1678 # no selection available
1679 E5MessageBox.warning( 1679 E5MessageBox.warning(
1680 self.__ui, title, 1680 self.__ui, title,
1681 self.trUtf8("Highlight the local variable to make an attribute" 1681 self.tr("Highlight the local variable to make an attribute"
1682 " and try again.")) 1682 " and try again."))
1683 return 1683 return
1684 1684
1685 if not self.confirmAllBuffersSaved(): 1685 if not self.confirmAllBuffersSaved():
1686 return 1686 return
1687 1687
1712 aw = e5App().getObject("ViewManager").activeWindow() 1712 aw = e5App().getObject("ViewManager").activeWindow()
1713 1713
1714 if aw is None: 1714 if aw is None:
1715 return 1715 return
1716 1716
1717 title = self.trUtf8("Replace Method With Method Object") 1717 title = self.tr("Replace Method With Method Object")
1718 if not aw.hasSelectedText(): 1718 if not aw.hasSelectedText():
1719 # no selection available 1719 # no selection available
1720 E5MessageBox.warning( 1720 E5MessageBox.warning(
1721 self.__ui, title, 1721 self.__ui, title,
1722 self.trUtf8("Highlight the method or function to convert" 1722 self.tr("Highlight the method or function to convert"
1723 " and try again.")) 1723 " and try again."))
1724 return 1724 return
1725 1725
1726 if not self.confirmAllBuffersSaved(): 1726 if not self.confirmAllBuffersSaved():
1727 return 1727 return
1728 1728
1751 1751
1752 def __undo(self): 1752 def __undo(self):
1753 """ 1753 """
1754 Private slot to undo the last refactoring. 1754 Private slot to undo the last refactoring.
1755 """ 1755 """
1756 title = self.trUtf8("Undo refactoring") 1756 title = self.tr("Undo refactoring")
1757 history = self.__project.history 1757 history = self.__project.history
1758 res = E5MessageBox.yesNo( 1758 res = E5MessageBox.yesNo(
1759 None, 1759 None,
1760 title, 1760 title,
1761 self.trUtf8("""Shall the refactoring <b>{0}</b> be undone?""") 1761 self.tr("""Shall the refactoring <b>{0}</b> be undone?""")
1762 .format(Utilities.html_encode( 1762 .format(Utilities.html_encode(
1763 history.undo_list[-1].description))) 1763 history.undo_list[-1].description)))
1764 if res: 1764 if res:
1765 if not self.confirmAllBuffersSaved(): 1765 if not self.confirmAllBuffersSaved():
1766 return 1766 return
1767 1767
1768 from ProgressHandle import ProgressHandle 1768 from ProgressHandle import ProgressHandle
1769 changes = history.undo_list[-1] 1769 changes = history.undo_list[-1]
1770 handle = ProgressHandle(self.trUtf8("Undo"), False, self.__ui) 1770 handle = ProgressHandle(self.tr("Undo"), False, self.__ui)
1771 handle.show() 1771 handle.show()
1772 QApplication.processEvents() 1772 QApplication.processEvents()
1773 try: 1773 try:
1774 history.undo(task_handle=handle) 1774 history.undo(task_handle=handle)
1775 except Exception as err: 1775 except Exception as err:
1781 1781
1782 def __redo(self): 1782 def __redo(self):
1783 """ 1783 """
1784 Private slot to redo the last refactoring. 1784 Private slot to redo the last refactoring.
1785 """ 1785 """
1786 title = self.trUtf8("Redo refactoring") 1786 title = self.tr("Redo refactoring")
1787 history = self.__project.history 1787 history = self.__project.history
1788 res = E5MessageBox.yesNo( 1788 res = E5MessageBox.yesNo(
1789 None, 1789 None,
1790 title, 1790 title,
1791 self.trUtf8("""Shall the refactoring <b>{0}</b> be redone?""") 1791 self.tr("""Shall the refactoring <b>{0}</b> be redone?""")
1792 .format(Utilities.html_encode( 1792 .format(Utilities.html_encode(
1793 history.redo_list[-1].description))) 1793 history.redo_list[-1].description)))
1794 if res: 1794 if res:
1795 if not self.confirmAllBuffersSaved(): 1795 if not self.confirmAllBuffersSaved():
1796 return 1796 return
1797 1797
1798 from ProgressHandle import ProgressHandle 1798 from ProgressHandle import ProgressHandle
1799 changes = history.redo_list[-1] 1799 changes = history.redo_list[-1]
1800 handle = ProgressHandle(self.trUtf8("Redo"), False, self.__ui) 1800 handle = ProgressHandle(self.tr("Redo"), False, self.__ui)
1801 handle.show() 1801 handle.show()
1802 QApplication.processEvents() 1802 QApplication.processEvents()
1803 try: 1803 try:
1804 history.redo(task_handle=handle) 1804 history.redo(task_handle=handle)
1805 except Exception as err: 1805 except Exception as err:
1867 """ 1867 """
1868 Private slot to clear the redo and undo lists. 1868 Private slot to clear the redo and undo lists.
1869 """ 1869 """
1870 res = E5MessageBox.yesNo( 1870 res = E5MessageBox.yesNo(
1871 None, 1871 None,
1872 self.trUtf8("Clear History"), 1872 self.tr("Clear History"),
1873 self.trUtf8("""Do you really want to clear the undo""" 1873 self.tr("""Do you really want to clear the undo"""
1874 """ and redo history?""")) 1874 """ and redo history?"""))
1875 if res: 1875 if res:
1876 self.__project.history.clear() 1876 self.__project.history.clear()
1877 1877
1878 ##################################################### 1878 #####################################################
1879 ## Find actions 1879 ## Find actions
1886 aw = e5App().getObject("ViewManager").activeWindow() 1886 aw = e5App().getObject("ViewManager").activeWindow()
1887 1887
1888 if aw is None: 1888 if aw is None:
1889 return 1889 return
1890 1890
1891 title = self.trUtf8("Find Occurrences") 1891 title = self.tr("Find Occurrences")
1892 if not aw.hasSelectedText(): 1892 if not aw.hasSelectedText():
1893 # no selection available 1893 # no selection available
1894 E5MessageBox.warning( 1894 E5MessageBox.warning(
1895 self.__ui, title, 1895 self.__ui, title,
1896 self.trUtf8("Highlight the class, method, function or variable" 1896 self.tr("Highlight the class, method, function or variable"
1897 " to search for and try again.")) 1897 " to search for and try again."))
1898 return 1898 return
1899 1899
1900 if not self.confirmAllBuffersSaved(): 1900 if not self.confirmAllBuffersSaved():
1901 return 1901 return
1902 1902
1928 self.dlg.addEntry( 1928 self.dlg.addEntry(
1929 occurrence.resource, occurrence.lineno, occurrence.unsure) 1929 occurrence.resource, occurrence.lineno, occurrence.unsure)
1930 else: 1930 else:
1931 E5MessageBox.warning( 1931 E5MessageBox.warning(
1932 self.__ui, title, 1932 self.__ui, title,
1933 self.trUtf8("No occurrences found.")) 1933 self.tr("No occurrences found."))
1934 1934
1935 def __queryDefinition(self): 1935 def __queryDefinition(self):
1936 """ 1936 """
1937 Private slot to handle the Find Definition action. 1937 Private slot to handle the Find Definition action.
1938 """ 1938 """
1939 aw = e5App().getObject("ViewManager").activeWindow() 1939 aw = e5App().getObject("ViewManager").activeWindow()
1940 1940
1941 if aw is None: 1941 if aw is None:
1942 return 1942 return
1943 1943
1944 title = self.trUtf8("Find &Definition") 1944 title = self.tr("Find &Definition")
1945 if not aw.hasSelectedText(): 1945 if not aw.hasSelectedText():
1946 # no selection available 1946 # no selection available
1947 E5MessageBox.warning( 1947 E5MessageBox.warning(
1948 self.__ui, title, 1948 self.__ui, title,
1949 self.trUtf8("Highlight the class, method, function or" 1949 self.tr("Highlight the class, method, function or"
1950 " variable reference to search definition for and" 1950 " variable reference to search definition for and"
1951 " try again.")) 1951 " try again."))
1952 return 1952 return
1953 1953
1954 if not self.confirmAllBuffersSaved(): 1954 if not self.confirmAllBuffersSaved():
1955 return 1955 return
1956 1956
1974 self.dlg.show() 1974 self.dlg.show()
1975 self.dlg.addEntry(location.resource, location.lineno) 1975 self.dlg.addEntry(location.resource, location.lineno)
1976 else: 1976 else:
1977 E5MessageBox.warning( 1977 E5MessageBox.warning(
1978 self.__ui, title, 1978 self.__ui, title,
1979 self.trUtf8("No matching definition found.")) 1979 self.tr("No matching definition found."))
1980 1980
1981 def __queryImplementations(self): 1981 def __queryImplementations(self):
1982 """ 1982 """
1983 Private slot to handle the Find Implementations action. 1983 Private slot to handle the Find Implementations action.
1984 """ 1984 """
1985 aw = e5App().getObject("ViewManager").activeWindow() 1985 aw = e5App().getObject("ViewManager").activeWindow()
1986 1986
1987 if aw is None: 1987 if aw is None:
1988 return 1988 return
1989 1989
1990 title = self.trUtf8("Find Implementations") 1990 title = self.tr("Find Implementations")
1991 if not aw.hasSelectedText(): 1991 if not aw.hasSelectedText():
1992 # no selection available 1992 # no selection available
1993 E5MessageBox.warning( 1993 E5MessageBox.warning(
1994 self.__ui, title, 1994 self.__ui, title,
1995 self.trUtf8("Highlight the method to search for" 1995 self.tr("Highlight the method to search for"
1996 " and try again.")) 1996 " and try again."))
1997 return 1997 return
1998 1998
1999 if not self.confirmAllBuffersSaved(): 1999 if not self.confirmAllBuffersSaved():
2000 return 2000 return
2001 2001
2025 for occurrence in occurrences: 2025 for occurrence in occurrences:
2026 self.dlg.addEntry( 2026 self.dlg.addEntry(
2027 occurrence.resource, occurrence.lineno, occurrence.unsure) 2027 occurrence.resource, occurrence.lineno, occurrence.unsure)
2028 else: 2028 else:
2029 E5MessageBox.warning( 2029 E5MessageBox.warning(
2030 self.__ui, title, self.trUtf8("No occurrences found.")) 2030 self.__ui, title, self.tr("No occurrences found."))
2031 2031
2032 ##################################################### 2032 #####################################################
2033 ## Various actions 2033 ## Various actions
2034 ##################################################### 2034 #####################################################
2035 2035
2047 self.__editor.show() 2047 self.__editor.show()
2048 self.__editor.editorSaved.connect(self.__configChanged) 2048 self.__editor.editorSaved.connect(self.__configChanged)
2049 else: 2049 else:
2050 E5MessageBox.critical( 2050 E5MessageBox.critical(
2051 self.__ui, 2051 self.__ui,
2052 self.trUtf8("Configure Rope"), 2052 self.tr("Configure Rope"),
2053 self.trUtf8("""The Rope configuration file '{0}' does""" 2053 self.tr("""The Rope configuration file '{0}' does"""
2054 """ not exist.""").format(configfile)) 2054 """ not exist.""").format(configfile))
2055 else: 2055 else:
2056 E5MessageBox.critical( 2056 E5MessageBox.critical(
2057 self.__ui, 2057 self.__ui,
2058 self.trUtf8("Configure Rope"), 2058 self.tr("Configure Rope"),
2059 self.trUtf8("""The Rope admin directory does not exist.""")) 2059 self.tr("""The Rope admin directory does not exist."""))
2060 2060
2061 def __updateConfig(self): 2061 def __updateConfig(self):
2062 """ 2062 """
2063 Private slot to update the configuration file. 2063 Private slot to update the configuration file.
2064 """ 2064 """
2065 res = E5MessageBox.yesNo( 2065 res = E5MessageBox.yesNo(
2066 self.__ui, 2066 self.__ui,
2067 self.trUtf8("Update Configuration"), 2067 self.tr("Update Configuration"),
2068 self.trUtf8("""Shall rope's current configuration be replaced """ 2068 self.tr("""Shall rope's current configuration be replaced """
2069 """by a new default configuration?""")) 2069 """by a new default configuration?"""))
2070 if res: 2070 if res:
2071 src = self.__defaultConfig() 2071 src = self.__defaultConfig()
2072 cname = self.__ropeConfigFile() 2072 cname = self.__ropeConfigFile()
2073 if src != "" and cname is not None: 2073 if src != "" and cname is not None:
2074 try: 2074 try:
2078 self.__configChanged() 2078 self.__configChanged()
2079 self.__editConfig() 2079 self.__editConfig()
2080 except IOError as err: 2080 except IOError as err:
2081 E5MessageBox.critical( 2081 E5MessageBox.critical(
2082 None, 2082 None,
2083 self.trUtf8("Update Configuration"), 2083 self.tr("Update Configuration"),
2084 self.trUtf8("""<p>The configuration could not be""" 2084 self.tr("""<p>The configuration could not be"""
2085 """ updated.</p><p>Reason: {0}</p>""") 2085 """ updated.</p><p>Reason: {0}</p>""")
2086 .format(str(err))) 2086 .format(str(err)))
2087 2087
2088 def __showRopeHelp(self): 2088 def __showRopeHelp(self):
2089 """ 2089 """
2090 Private slot to show help about the refactorings offered by Rope. 2090 Private slot to show help about the refactorings offered by Rope.
2096 else: 2096 else:
2097 dir = 'rope_py2' 2097 dir = 'rope_py2'
2098 helpfile = os.path.join(os.path.dirname(__file__), 2098 helpfile = os.path.join(os.path.dirname(__file__),
2099 dir, "rope", "docs", "overview.txt") 2099 dir, "rope", "docs", "overview.txt")
2100 self.__helpDialog = \ 2100 self.__helpDialog = \
2101 HelpDialog(self.trUtf8("Help about rope refactorings"), 2101 HelpDialog(self.tr("Help about rope refactorings"),
2102 helpfile) 2102 helpfile)
2103 self.__helpDialog.show() 2103 self.__helpDialog.show()
2104 2104
2105 def __performSOA(self): 2105 def __performSOA(self):
2106 """ 2106 """
2107 Private slot to perform SOA on all modules. 2107 Private slot to perform SOA on all modules.
2108 """ 2108 """
2109 title = self.trUtf8("Analyse all modules") 2109 title = self.tr("Analyse all modules")
2110 res = E5MessageBox.yesNo( 2110 res = E5MessageBox.yesNo(
2111 self.__ui, 2111 self.__ui,
2112 title, 2112 title,
2113 self.trUtf8("""This action might take some time. """ 2113 self.tr("""This action might take some time. """
2114 """Do you really want to perform SOA?""")) 2114 """Do you really want to perform SOA?"""))
2115 if res: 2115 if res:
2116 from ProgressHandle import ProgressHandle 2116 from ProgressHandle import ProgressHandle
2117 handle = ProgressHandle(title, True, self.__ui) 2117 handle = ProgressHandle(title, True, self.__ui)
2118 handle.show() 2118 handle.show()
2119 QApplication.processEvents() 2119 QApplication.processEvents()
2122 self.__project, task_handle=handle) 2122 self.__project, task_handle=handle)
2123 handle.reset() 2123 handle.reset()
2124 E5MessageBox.information( 2124 E5MessageBox.information(
2125 self.__ui, 2125 self.__ui,
2126 title, 2126 title,
2127 self.trUtf8("""Static object analysis (SOA) done. """ 2127 self.tr("""Static object analysis (SOA) done. """
2128 """SOA database updated.""")) 2128 """SOA database updated."""))
2129 except Exception as err: 2129 except Exception as err:
2130 self.handleRopeError(err, title, handle) 2130 self.handleRopeError(err, title, handle)
2131 2131
2132 ################################################################## 2132 ##################################################################
2133 ## methods below are private utility methods 2133 ## methods below are private utility methods
2234 self.__project.validate(self.__project.root) 2234 self.__project.validate(self.__project.root)
2235 return res 2235 return res
2236 2236
2237 def confirmAllBuffersSaved(self): 2237 def confirmAllBuffersSaved(self):
2238 """ 2238 """
2239 Private method to check, if any editor has unsaved changes. 2239 Public method to check, if any editor has unsaved changes.
2240 2240
2241 @return flag indicating, that no editor contains unsaved edits 2241 @return flag indicating, that no editor contains unsaved edits
2242 (boolean) 2242 (boolean)
2243 """ 2243 """
2244 res = e5App().getObject("ViewManager").checkAllDirty() 2244 res = e5App().getObject("ViewManager").checkAllDirty()

eric ide

mercurial