src/eric7/QScintilla/APIsManager.py

branch
eric7
changeset 9401
38514063ecee
parent 9361
718bc86e1c3f
child 9402
f5d9aa5c62db
equal deleted inserted replaced
9400:5494faeaead2 9401:38514063ecee
195 @return list of installed API files (list of strings) 195 @return list of installed API files (list of strings)
196 """ 196 """
197 if self.__apis is not None: 197 if self.__apis is not None:
198 qtDataDir = QLibraryInfo.path(QLibraryInfo.LibraryPath.DataPath) 198 qtDataDir = QLibraryInfo.path(QLibraryInfo.LibraryPath.DataPath)
199 apisDir = os.path.join(qtDataDir, "qsci", "api") 199 apisDir = os.path.join(qtDataDir, "qsci", "api")
200 if os.path.exists(apisDir): 200 if os.path.exists(apisDir) and self.__lexer.language():
201 if self.__lexer.language(): 201 apiDir = os.path.join(apisDir, self.__lexer.language())
202 apiDir = os.path.join(apisDir, self.__lexer.language()) 202 if not os.path.exists(apiDir):
203 if not os.path.exists(apiDir): 203 # use lower case language
204 # use lower case language 204 apiDir = os.path.join(apisDir, self.__lexer.language().lower())
205 apiDir = os.path.join(apisDir, self.__lexer.language().lower()) 205 fnames = {
206 fnames = { 206 os.path.join(apiDir, f)
207 os.path.join(apiDir, f) 207 for f in glob.glob("*.api", root_dir=apiDir)
208 for f in glob.glob("*.api", root_dir=apiDir) 208 }
209 } 209 # combine with the QScintilla standard behavior
210 # combine with the QScintilla standard behavior 210 fnames |= {
211 fnames |= { 211 os.path.join(apiDir, f)
212 os.path.join(apiDir, f) 212 for f in glob.glob(
213 for f in glob.glob( 213 "*.api",
214 "*.api", 214 root_dir=os.path.join(apisDir, self.__lexer.lexer()),
215 root_dir=os.path.join(apisDir, self.__lexer.lexer()), 215 )
216 ) 216 }
217 } 217 return sorted(fnames)
218 return sorted(fnames) 218
219 else: 219 return []
220 return []
221 else:
222 return []
223 220
224 def __preparedName(self): 221 def __preparedName(self):
225 """ 222 """
226 Private method returning the default name of a prepared API file. 223 Private method returning the default name of a prepared API file.
227 224

eric ide

mercurial