23 # Start-Of-Header |
23 # Start-Of-Header |
24 name = "Assistant Eric Plugin" |
24 name = "Assistant Eric Plugin" |
25 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
25 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
26 autoactivate = True |
26 autoactivate = True |
27 deactivateable = True |
27 deactivateable = True |
28 version = "2.6.0" |
28 version = "2.6.1" |
29 className = "AssistantEricPlugin" |
29 className = "AssistantEricPlugin" |
30 packageName = "AssistantEric" |
30 packageName = "AssistantEric" |
31 shortDescription = "Alternative autocompletion and calltips provider." |
31 shortDescription = "Alternative autocompletion and calltips provider." |
32 longDescription = """This plugin implements an alternative autocompletion and""" \ |
32 longDescription = \ |
|
33 """This plugin implements an alternative autocompletion and""" \ |
33 """ calltips provider.""" |
34 """ calltips provider.""" |
34 needsRestart = True |
35 needsRestart = True |
35 pyqtApi = 2 |
36 pyqtApi = 2 |
36 # End-Of-Header |
37 # End-Of-Header |
37 |
38 |
42 |
43 |
43 def createAutoCompletionPage(configDlg): |
44 def createAutoCompletionPage(configDlg): |
44 """ |
45 """ |
45 Module function to create the autocompletion configuration page. |
46 Module function to create the autocompletion configuration page. |
46 |
47 |
|
48 @param configDlg reference to the configuration dialog |
47 @return reference to the configuration page |
49 @return reference to the configuration page |
48 """ |
50 """ |
49 global assistantEricPluginObject |
51 global assistantEricPluginObject |
50 from AssistantEric.ConfigurationPages.AutoCompletionEricPage \ |
52 from AssistantEric.ConfigurationPages.AutoCompletionEricPage \ |
51 import AutoCompletionEricPage |
53 import AutoCompletionEricPage |
55 |
57 |
56 def createCallTipsPage(configDlg): |
58 def createCallTipsPage(configDlg): |
57 """ |
59 """ |
58 Module function to create the calltips configuration page. |
60 Module function to create the calltips configuration page. |
59 |
61 |
|
62 @param configDlg reference to the configuration dialog |
60 @return reference to the configuration page |
63 @return reference to the configuration page |
61 """ |
64 """ |
62 global assistantEricPluginObject |
65 global assistantEricPluginObject |
63 from AssistantEric.ConfigurationPages.CallTipsEricPage \ |
66 from AssistantEric.ConfigurationPages.CallTipsEricPage \ |
64 import CallTipsEricPage |
67 import CallTipsEricPage |
71 Module function returning data as required by the configuration dialog. |
74 Module function returning data as required by the configuration dialog. |
72 |
75 |
73 @return dictionary containing the relevant data |
76 @return dictionary containing the relevant data |
74 """ |
77 """ |
75 return { |
78 return { |
76 "ericAutoCompletionPage": \ |
79 "ericAutoCompletionPage": [ |
77 [QApplication.translate("AssistantEricPlugin", "Eric"), |
80 QApplication.translate("AssistantEricPlugin", "Eric"), |
78 os.path.join("AssistantEric", "ConfigurationPages", |
81 os.path.join("AssistantEric", "ConfigurationPages", |
79 "eric.png"), |
82 "eric.png"), |
80 createAutoCompletionPage, "editorAutocompletionPage", None], |
83 createAutoCompletionPage, "editorAutocompletionPage", None], |
81 "ericCallTipsPage": \ |
84 "ericCallTipsPage": [ |
82 [QApplication.translate("AssistantEricPlugin", "Eric"), |
85 QApplication.translate("AssistantEricPlugin", "Eric"), |
83 os.path.join("AssistantEric", "ConfigurationPages", |
86 os.path.join("AssistantEric", "ConfigurationPages", |
84 "eric.png"), |
87 "eric.png"), |
85 createCallTipsPage, "editorCalltipsPage", None], |
88 createCallTipsPage, "editorCalltipsPage", None], |
86 } |
89 } |
87 |
90 |
88 |
91 |
89 def prepareUninstall(): |
92 def prepareUninstall(): |
90 """ |
93 """ |
201 Private method to load the translation file. |
204 Private method to load the translation file. |
202 """ |
205 """ |
203 if self.__ui is not None: |
206 if self.__ui is not None: |
204 loc = self.__ui.getLocale() |
207 loc = self.__ui.getLocale() |
205 if loc and loc != "C": |
208 if loc and loc != "C": |
206 locale_dir = \ |
209 locale_dir = os.path.join( |
207 os.path.join(os.path.dirname(__file__), "AssistantEric", "i18n") |
210 os.path.dirname(__file__), "AssistantEric", "i18n") |
208 translation = "assistant_{0}".format(loc) |
211 translation = "assistant_{0}".format(loc) |
209 translator = QTranslator(None) |
212 translator = QTranslator(None) |
210 loaded = translator.load(translation, locale_dir) |
213 loaded = translator.load(translation, locale_dir) |
211 if loaded: |
214 if loaded: |
212 self.__translator = translator |
215 self.__translator = translator |
213 e5App().installTranslator(self.__translator) |
216 e5App().installTranslator(self.__translator) |
214 else: |
217 else: |
215 print("Warning: translation file '{0}' could not be loaded."\ |
218 print("Warning: translation file '{0}' could not be" |
216 .format(translation)) |
219 " loaded.".format(translation)) |
217 print("Using default.") |
220 print("Using default.") |
218 |
221 |
219 def getPreferences(self, key): |
222 def getPreferences(self, key): |
220 """ |
223 """ |
221 Public method to retrieve the various refactoring settings. |
224 Public method to retrieve the various refactoring settings. |
222 |
225 |
223 @param key the key of the value to get |
226 @param key the key of the value to get |
224 @param prefClass preferences class used as the storage area |
|
225 @return the requested refactoring setting |
227 @return the requested refactoring setting |
226 """ |
228 """ |
227 if key in ["AutoCompletionEnabled", "AutoCompletionFollowHierarchy", |
229 if key in ["AutoCompletionEnabled", "AutoCompletionFollowHierarchy", |
228 "CalltipsEnabled", "CallTipsContextShown", |
230 "CalltipsEnabled", "CallTipsContextShown", |
229 "CallTipsFollowHierarchy"]: |
231 "CallTipsFollowHierarchy"]: |
237 """ |
239 """ |
238 Public method to store the various refactoring settings. |
240 Public method to store the various refactoring settings. |
239 |
241 |
240 @param key the key of the setting to be set (string) |
242 @param key the key of the setting to be set (string) |
241 @param value the value to be set |
243 @param value the value to be set |
242 @param prefClass preferences class used as the storage area |
244 """ |
243 """ |
245 Preferences.Prefs.settings.setValue( |
244 Preferences.Prefs.settings.setValue(self.PreferencesKey + "/" + key, value) |
246 self.PreferencesKey + "/" + key, value) |
245 |
247 |
246 if key in ["AutoCompletionEnabled", "CalltipsEnabled"]: |
248 if key in ["AutoCompletionEnabled", "CalltipsEnabled"]: |
247 self.__object.setEnabled(key, value) |
249 self.__object.setEnabled(key, value) |