src/eric7/QScintilla/APIsManager.py

branch
eric7
changeset 10431
64157aeb0312
parent 10373
093dcebe5ecb
child 10439
21c28b0f9e41
equal deleted inserted replaced
10430:e440aaf179ce 10431:64157aeb0312
95 95
96 def getQsciAPIs(self): 96 def getQsciAPIs(self):
97 """ 97 """
98 Public method to get a reference to QsciAPIs object. 98 Public method to get a reference to QsciAPIs object.
99 99
100 @return reference to the QsciAPIs object (QsciAPIs) 100 @return reference to the QsciAPIs object
101 @rtype QsciAPIs
101 """ 102 """
102 if not self.__forPreparation and Preferences.getEditor("AutoPrepareAPIs"): 103 if not self.__forPreparation and Preferences.getEditor("AutoPrepareAPIs"):
103 self.prepareAPIs() 104 self.prepareAPIs()
104 return self.__apis 105 return self.__apis
105 106
106 def isEmpty(self): 107 def isEmpty(self):
107 """ 108 """
108 Public method to check, if the object has API files configured. 109 Public method to check, if the object has API files configured.
109 110
110 @return flag indicating no API files have been configured (boolean) 111 @return flag indicating no API files have been configured
112 @rtype bool
111 """ 113 """
112 return len(self.__apifiles) == 0 114 return len(self.__apifiles) == 0
113 115
114 def __apiPreparationFinished(self): 116 def __apiPreparationFinished(self):
115 """ 117 """
136 138
137 def prepareAPIs(self, ondemand=False, rawList=None): 139 def prepareAPIs(self, ondemand=False, rawList=None):
138 """ 140 """
139 Public method to prepare the APIs if necessary. 141 Public method to prepare the APIs if necessary.
140 142
141 @param ondemand flag indicating a requested preparation (boolean) 143 @param ondemand flag indicating a requested preparation
142 @param rawList list of raw API files (list of strings) 144 @type bool
145 @param rawList list of raw API files
146 @type list of str
143 """ 147 """
144 if self.__apis is None or self.__inPreparation: 148 if self.__apis is None or self.__inPreparation:
145 return 149 return
146 150
147 needsPreparation = False 151 needsPreparation = False
190 194
191 def installedAPIFiles(self): 195 def installedAPIFiles(self):
192 """ 196 """
193 Public method to get a list of installed API files. 197 Public method to get a list of installed API files.
194 198
195 @return list of installed API files (list of strings) 199 @return list of installed API files
200 @rtype list of str
196 """ 201 """
197 if self.__apis is not None: 202 if self.__apis is not None:
198 qtDataDir = QLibraryInfo.path(QLibraryInfo.LibraryPath.DataPath) 203 qtDataDir = QLibraryInfo.path(QLibraryInfo.LibraryPath.DataPath)
199 apisDir = os.path.join(qtDataDir, "qsci", "api") 204 apisDir = os.path.join(qtDataDir, "qsci", "api")
200 if os.path.exists(apisDir) and self.__lexer.language(): 205 if os.path.exists(apisDir) and self.__lexer.language():
216 221
217 def __preparedName(self): 222 def __preparedName(self):
218 """ 223 """
219 Private method returning the default name of a prepared API file. 224 Private method returning the default name of a prepared API file.
220 225
221 @return complete filename for the Prepared APIs file (string) 226 @return complete filename for the Prepared APIs file
227 @rtype str
222 """ 228 """
223 apisDir = os.path.join(Globals.getConfigDir(), "APIs") 229 apisDir = os.path.join(Globals.getConfigDir(), "APIs")
224 if self.__apis is not None: 230 if self.__apis is not None:
225 if self.__projectType: 231 if self.__projectType:
226 filename = "{0}_{1}.pap".format(self.__language, self.__projectType) 232 filename = "{0}_{1}.pap".format(self.__language, self.__projectType)
239 245
240 def __init__(self, parent=None): 246 def __init__(self, parent=None):
241 """ 247 """
242 Constructor 248 Constructor
243 249
244 @param parent reference to the parent object (QObject) 250 @param parent reference to the parent object
251 @type QObject
245 """ 252 """
246 super().__init__(parent) 253 super().__init__(parent)
247 self.setObjectName("APIsManager") 254 self.setObjectName("APIsManager")
248 255
249 self.__apis = {} 256 self.__apis = {}

eric ide

mercurial