24 # Start-Of-Header |
24 # Start-Of-Header |
25 name = "Refactoring Rope Plugin" |
25 name = "Refactoring Rope Plugin" |
26 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
26 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
27 autoactivate = True |
27 autoactivate = True |
28 deactivateable = True |
28 deactivateable = True |
29 version = "4.2.7" |
29 version = "4.3.0" |
30 className = "RefactoringRopePlugin" |
30 className = "RefactoringRopePlugin" |
31 packageName = "RefactoringRope" |
31 packageName = "RefactoringRope" |
32 internalPackages = "rope" |
32 internalPackages = "rope" |
33 shortDescription = "Refactoring using the Rope library." |
33 shortDescription = "Refactoring using the Rope library." |
34 longDescription = """This plug-in implements refactoring functionality""" \ |
34 longDescription = """This plug-in implements refactoring functionality""" \ |
103 "ropeCallTipsPage": [ |
103 "ropeCallTipsPage": [ |
104 QCoreApplication.translate("RefactoringRopePlugin", "Rope"), |
104 QCoreApplication.translate("RefactoringRopePlugin", "Rope"), |
105 os.path.join("RefactoringRope", "ConfigurationPage", |
105 os.path.join("RefactoringRope", "ConfigurationPage", |
106 "preferences-refactoring.png"), |
106 "preferences-refactoring.png"), |
107 createCallTipsPage, "editorCalltipsPage", None], |
107 createCallTipsPage, "editorCalltipsPage", None], |
108 } |
108 "ropeMouseClickHandlerPage": [ |
109 |
|
110 if e5App().getObject("UserInterface").versionIsNewer("6.0.99", "20150627"): |
|
111 data["ropeMouseClickHandlerPage"] = [ |
|
112 QCoreApplication.translate("RefactoringRopePlugin", "Rope"), |
109 QCoreApplication.translate("RefactoringRopePlugin", "Rope"), |
113 os.path.join("RefactoringRope", "ConfigurationPage", |
110 os.path.join("RefactoringRope", "ConfigurationPage", |
114 "preferences-refactoring.png"), |
111 "preferences-refactoring.png"), |
115 createMouseClickHandlerPage, "1editorMouseClickHandlers", None] |
112 createMouseClickHandlerPage, "1editorMouseClickHandlers", None], |
|
113 } |
116 |
114 |
117 return data |
115 return data |
118 |
116 |
119 |
117 |
120 def prepareUninstall(): |
118 def prepareUninstall(): |
142 |
140 |
143 self.__defaults = { |
141 self.__defaults = { |
144 "CodeAssistEnabled": False, |
142 "CodeAssistEnabled": False, |
145 "MaxFixes": 10, |
143 "MaxFixes": 10, |
146 "CodeAssistTimeout": 100, |
144 "CodeAssistTimeout": 100, |
147 "ShowQScintillaCompletions": True, |
|
148 |
145 |
149 "CodeAssistCalltipsEnabled": False, |
146 "CodeAssistCalltipsEnabled": False, |
150 "CalltipsMaxFixes": 10, |
147 "CalltipsMaxFixes": 10, |
151 |
148 |
152 "MouseClickEnabled": True, |
149 "MouseClickEnabled": True, |
177 |
174 |
178 self.__currentEditor = None |
175 self.__currentEditor = None |
179 self.__savedEditorName = None |
176 self.__savedEditorName = None |
180 self.__oldEditorText = "" |
177 self.__oldEditorText = "" |
181 |
178 |
182 def __checkUiVersion(self): |
|
183 """ |
|
184 Private method to check, if the IDE has a suitable version. |
|
185 |
|
186 @return flag indicating a suitable version (boolean) |
|
187 """ |
|
188 global error |
|
189 |
|
190 suitable = self.__ui.versionIsNewer("5.99.99", "20140701") |
|
191 if not suitable: |
|
192 error = self.tr("Your version of eric6 is not supported.") |
|
193 return suitable |
|
194 |
|
195 def activate(self): |
179 def activate(self): |
196 """ |
180 """ |
197 Public method to activate this plugin. |
181 Public method to activate this plugin. |
198 |
182 |
199 @return tuple of None and activation status (boolean) |
183 @return tuple of None and activation status (boolean) |
200 """ |
184 """ |
201 global error |
185 global error |
202 error = "" # clear previous error |
186 error = "" # clear previous error |
203 |
|
204 if not self.__checkUiVersion(): |
|
205 return None, False |
|
206 |
187 |
207 global refactoringRopePluginObject |
188 global refactoringRopePluginObject |
208 refactoringRopePluginObject = self |
189 refactoringRopePluginObject = self |
209 |
190 |
210 from RefactoringRope.Refactoring import Refactoring |
191 from RefactoringRope.Refactoring import Refactoring |
324 |
305 |
325 @param key the key of the value to get |
306 @param key the key of the value to get |
326 @return the requested refactoring setting |
307 @return the requested refactoring setting |
327 """ |
308 """ |
328 if key in ["CodeAssistEnabled", "CodeAssistCalltipsEnabled", |
309 if key in ["CodeAssistEnabled", "CodeAssistCalltipsEnabled", |
329 "ShowQScintillaCompletions", "MouseClickEnabled"]: |
310 "MouseClickEnabled"]: |
330 return Preferences.toBool(Preferences.Prefs.settings.value( |
311 return Preferences.toBool(Preferences.Prefs.settings.value( |
331 self.PreferencesKey + "/" + key, self.__defaults[key])) |
312 self.PreferencesKey + "/" + key, self.__defaults[key])) |
332 else: |
313 else: |
333 return int(Preferences.Prefs.settings.value( |
314 return int(Preferences.Prefs.settings.value( |
334 self.PreferencesKey + "/" + key, self.__defaults[key])) |
315 self.PreferencesKey + "/" + key, self.__defaults[key])) |
598 |
579 |
599 if self.__currentEditor is not None: |
580 if self.__currentEditor is not None: |
600 if self.__currentEditor.isListActive(): |
581 if self.__currentEditor.isListActive(): |
601 self.__currentEditor.cancelList() |
582 self.__currentEditor.cancelList() |
602 completions = self.getCompletionsList(self.__currentEditor, False) |
583 completions = self.getCompletionsList(self.__currentEditor, False) |
603 if len(completions) == 0 and \ |
584 if len(completions) == 0: |
604 self.getPreferences("ShowQScintillaCompletions"): |
|
605 # try QScintilla autocompletion |
585 # try QScintilla autocompletion |
606 self.__currentEditor.autoCompleteQScintilla() |
586 self.__currentEditor.autoCompleteQScintilla() |
607 else: |
587 else: |
608 completions.sort() |
588 completions.sort() |
609 self.__currentEditor.showUserList(EditorAutoCompletionListID, |
589 self.__currentEditor.showUserList(EditorAutoCompletionListID, |