Preferences/ConfigurationPages/EditorAPIsPage.py

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

eric ide

mercurial