78 """ |
78 """ |
79 Private method to load the APIs. |
79 Private method to load the APIs. |
80 """ |
80 """ |
81 if self.__apis.isPrepared(): |
81 if self.__apis.isPrepared(): |
82 # load a prepared API file |
82 # load a prepared API file |
83 if not self.__forPreparation and \ |
83 if ( |
84 Preferences.getEditor("AutoPrepareAPIs"): |
84 not self.__forPreparation and |
|
85 Preferences.getEditor("AutoPrepareAPIs") |
|
86 ): |
85 self.prepareAPIs() |
87 self.prepareAPIs() |
86 self.__apis.loadPrepared(self.__preparedName()) |
88 self.__apis.loadPrepared(self.__preparedName()) |
87 else: |
89 else: |
88 # load the raw files and prepare the API file |
90 # load the raw files and prepare the API file |
89 if not self.__forPreparation and \ |
91 if ( |
90 Preferences.getEditor("AutoPrepareAPIs"): |
92 not self.__forPreparation and |
|
93 Preferences.getEditor("AutoPrepareAPIs") |
|
94 ): |
91 self.prepareAPIs(ondemand=True) |
95 self.prepareAPIs(ondemand=True) |
92 |
96 |
93 def reloadAPIs(self): |
97 def reloadAPIs(self): |
94 """ |
98 """ |
95 Public method to reload the API information. |
99 Public method to reload the API information. |
96 """ |
100 """ |
97 if not self.__forPreparation and \ |
101 if ( |
98 Preferences.getEditor("AutoPrepareAPIs"): |
102 not self.__forPreparation and |
|
103 Preferences.getEditor("AutoPrepareAPIs") |
|
104 ): |
99 self.prepareAPIs() |
105 self.prepareAPIs() |
100 self.__loadAPIs() |
106 self.__loadAPIs() |
101 |
107 |
102 def getQsciAPIs(self): |
108 def getQsciAPIs(self): |
103 """ |
109 """ |
104 Public method to get a reference to QsciAPIs object. |
110 Public method to get a reference to QsciAPIs object. |
105 |
111 |
106 @return reference to the QsciAPIs object (QsciAPIs) |
112 @return reference to the QsciAPIs object (QsciAPIs) |
107 """ |
113 """ |
108 if not self.__forPreparation and \ |
114 if ( |
109 Preferences.getEditor("AutoPrepareAPIs"): |
115 not self.__forPreparation and |
|
116 Preferences.getEditor("AutoPrepareAPIs") |
|
117 ): |
110 self.prepareAPIs() |
118 self.prepareAPIs() |
111 return self.__apis |
119 return self.__apis |
112 |
120 |
113 def isEmpty(self): |
121 def isEmpty(self): |
114 """ |
122 """ |
166 apifiles = sorted(Preferences.getEditorAPI( |
174 apifiles = sorted(Preferences.getEditorAPI( |
167 self.__language, self.__projectType)) |
175 self.__language, self.__projectType)) |
168 if self.__apifiles != apifiles: |
176 if self.__apifiles != apifiles: |
169 needsPreparation = True |
177 needsPreparation = True |
170 for apifile in apifiles: |
178 for apifile in apifiles: |
171 if QFileInfo(apifile).lastModified() > \ |
179 if ( |
172 preparedAPIsTime: |
180 QFileInfo(apifile).lastModified() > |
|
181 preparedAPIsTime |
|
182 ): |
173 needsPreparation = True |
183 needsPreparation = True |
174 break |
184 break |
175 |
185 |
176 if needsPreparation: |
186 if needsPreparation: |
177 # do the preparation |
187 # do the preparation |
286 try: |
296 try: |
287 return self.__apis[(language, projectType)] |
297 return self.__apis[(language, projectType)] |
288 except KeyError: |
298 except KeyError: |
289 if language in Lexers.getSupportedApiLanguages(): |
299 if language in Lexers.getSupportedApiLanguages(): |
290 # create the api object |
300 # create the api object |
291 self.__apis[(language, projectType)] = \ |
301 self.__apis[(language, projectType)] = APIs( |
292 APIs(language, projectType=projectType) |
302 language, projectType=projectType) |
293 return self.__apis[(language, projectType)] |
303 return self.__apis[(language, projectType)] |
294 else: |
304 else: |
295 return None |
305 return None |