Preferences/ConfigurationPages/EditorAPIsPage.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2525
8b507a9a2d40
parent 3010
befeff46ec0f
child 3058
0a02c433f52d
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
108 self.__currentAPI.installedAPIFiles() != "") 108 self.__currentAPI.installedAPIFiles() != "")
109 else: 109 else:
110 self.addInstalledApiFileButton.setEnabled(False) 110 self.addInstalledApiFileButton.setEnabled(False)
111 111
112 self.addPluginApiFileButton.setEnabled( 112 self.addPluginApiFileButton.setEnabled(
113 len(self.pluginManager.getPluginApiFiles(self.currentApiLanguage)) > 0) 113 len(self.pluginManager.getPluginApiFiles(self.currentApiLanguage))
114 > 0)
114 115
115 def __editorGetApisFromApiList(self): 116 def __editorGetApisFromApiList(self):
116 """ 117 """
117 Private slot to retrieve the api filenames from the list. 118 Private slot to retrieve the api filenames from the list.
118 119
166 installedAPIFiles = self.__currentAPI.installedAPIFiles() 167 installedAPIFiles = self.__currentAPI.installedAPIFiles()
167 if installedAPIFiles: 168 if installedAPIFiles:
168 installedAPIFilesPath = QFileInfo(installedAPIFiles[0]).path() 169 installedAPIFilesPath = QFileInfo(installedAPIFiles[0]).path()
169 installedAPIFilesShort = [] 170 installedAPIFilesShort = []
170 for installedAPIFile in installedAPIFiles: 171 for installedAPIFile in installedAPIFiles:
171 installedAPIFilesShort.append(QFileInfo(installedAPIFile).fileName()) 172 installedAPIFilesShort.append(
173 QFileInfo(installedAPIFile).fileName())
172 file, ok = QInputDialog.getItem( 174 file, ok = QInputDialog.getItem(
173 self, 175 self,
174 self.trUtf8("Add from installed APIs"), 176 self.trUtf8("Add from installed APIs"),
175 self.trUtf8("Select from the list of installed API files"), 177 self.trUtf8("Select from the list of installed API files"),
176 installedAPIFilesShort, 178 installedAPIFilesShort,
177 0, False) 179 0, False)
178 if ok: 180 if ok:
179 self.apiList.addItem(Utilities.toNativeSeparators( 181 self.apiList.addItem(Utilities.toNativeSeparators(
180 QFileInfo(QDir(installedAPIFilesPath), file).absoluteFilePath())) 182 QFileInfo(QDir(installedAPIFilesPath), file)
183 .absoluteFilePath()))
181 else: 184 else:
182 E5MessageBox.warning(self, 185 E5MessageBox.warning(self,
183 self.trUtf8("Add from installed APIs"), 186 self.trUtf8("Add from installed APIs"),
184 self.trUtf8("""There are no APIs installed yet.""" 187 self.trUtf8("""There are no APIs installed yet."""
185 """ Selection is not available.""")) 188 """ Selection is not available."""))
189 def on_addPluginApiFileButton_clicked(self): 192 def on_addPluginApiFileButton_clicked(self):
190 """ 193 """
191 Private slot to add an API file from the list of API files installed 194 Private slot to add an API file from the list of API files installed
192 by plugins for the selected lexer language. 195 by plugins for the selected lexer language.
193 """ 196 """
194 pluginAPIFiles = self.pluginManager.getPluginApiFiles(self.currentApiLanguage) 197 pluginAPIFiles = self.pluginManager.getPluginApiFiles(
198 self.currentApiLanguage)
195 pluginAPIFilesDict = {} 199 pluginAPIFilesDict = {}
196 for apiFile in pluginAPIFiles: 200 for apiFile in pluginAPIFiles:
197 pluginAPIFilesDict[QFileInfo(apiFile).fileName()] = apiFile 201 pluginAPIFilesDict[QFileInfo(apiFile).fileName()] = apiFile
198 file, ok = QInputDialog.getItem( 202 file, ok = QInputDialog.getItem(
199 self, 203 self,
207 pluginAPIFilesDict[file])) 211 pluginAPIFilesDict[file]))
208 212
209 @pyqtSlot() 213 @pyqtSlot()
210 def on_prepareApiButton_clicked(self): 214 def on_prepareApiButton_clicked(self):
211 """ 215 """
212 Private slot to prepare the API file for the currently selected language. 216 Private slot to prepare the API file for the currently selected
217 language.
213 """ 218 """
214 if self.__inPreparation: 219 if self.__inPreparation:
215 self.__currentAPI and self.__currentAPI.cancelPreparation() 220 self.__currentAPI and self.__currentAPI.cancelPreparation()
216 else: 221 else:
217 if self.__currentAPI is not None: 222 if self.__currentAPI is not None:
257 Public method to set the state of the widget. 262 Public method to set the state of the widget.
258 263
259 @param state state data generated by saveState 264 @param state state data generated by saveState
260 """ 265 """
261 self.apiLanguageComboBox.setCurrentIndex(state) 266 self.apiLanguageComboBox.setCurrentIndex(state)
262 self.on_apiLanguageComboBox_activated(self.apiLanguageComboBox.currentText()) 267 self.on_apiLanguageComboBox_activated(
268 self.apiLanguageComboBox.currentText())
263 269
264 270
265 def create(dlg): 271 def create(dlg):
266 """ 272 """
267 Module function to create the configuration page. 273 Module function to create the configuration page.
268 274
269 @param dlg reference to the configuration dialog 275 @param dlg reference to the configuration dialog
276 @return reference to the instantiated page (ConfigurationPageBase)
270 """ 277 """
271 page = EditorAPIsPage() 278 page = EditorAPIsPage()
272 return page 279 return page

eric ide

mercurial