27 |
27 |
28 class EditorAPIsPage(ConfigurationPageBase, Ui_EditorAPIsPage): |
28 class EditorAPIsPage(ConfigurationPageBase, Ui_EditorAPIsPage): |
29 """ |
29 """ |
30 Class implementing the Editor APIs configuration page. |
30 Class implementing the Editor APIs configuration page. |
31 """ |
31 """ |
|
32 |
32 def __init__(self): |
33 def __init__(self): |
33 """ |
34 """ |
34 Constructor |
35 Constructor |
35 """ |
36 """ |
36 super().__init__() |
37 super().__init__() |
37 self.setupUi(self) |
38 self.setupUi(self) |
38 self.setObjectName("EditorAPIsPage") |
39 self.setObjectName("EditorAPIsPage") |
39 |
40 |
40 self.apiFilePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
41 self.apiFilePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
41 self.apiFilePicker.setToolTip(self.tr( |
42 self.apiFilePicker.setToolTip( |
42 "Press to select an API file via a selection dialog")) |
43 self.tr("Press to select an API file via a selection dialog") |
43 self.apiFilePicker.setFilters(self.tr( |
44 ) |
44 "API File (*.api);;All Files (*)")) |
45 self.apiFilePicker.setFilters(self.tr("API File (*.api);;All Files (*)")) |
45 |
46 |
46 self.prepareApiButton.setText(self.tr("Compile APIs")) |
47 self.prepareApiButton.setText(self.tr("Compile APIs")) |
47 self.__currentAPI = None |
48 self.__currentAPI = None |
48 self.__inPreparation = False |
49 self.__inPreparation = False |
49 |
50 |
50 # set initial values |
51 # set initial values |
51 self.pluginManager = ericApp().getObject("PluginManager") |
52 self.pluginManager = ericApp().getObject("PluginManager") |
52 self.apiAutoPrepareCheckBox.setChecked( |
53 self.apiAutoPrepareCheckBox.setChecked(Preferences.getEditor("AutoPrepareAPIs")) |
53 Preferences.getEditor("AutoPrepareAPIs")) |
54 |
54 |
|
55 import QScintilla.Lexers |
55 import QScintilla.Lexers |
|
56 |
56 self.apis = {} |
57 self.apis = {} |
57 apiLanguages = sorted( |
58 apiLanguages = sorted([""] + list(QScintilla.Lexers.getSupportedApiLanguages())) |
58 [''] + list(QScintilla.Lexers.getSupportedApiLanguages())) |
|
59 for lang in apiLanguages: |
59 for lang in apiLanguages: |
60 self.apiLanguageComboBox.addItem( |
60 self.apiLanguageComboBox.addItem( |
61 QScintilla.Lexers.getLanguageIcon(lang, False), |
61 QScintilla.Lexers.getLanguageIcon(lang, False), lang |
62 lang) |
62 ) |
63 self.__currentApiLanguage = "" |
63 self.__currentApiLanguage = "" |
64 self.on_apiLanguageComboBox_activated(0) |
64 self.on_apiLanguageComboBox_activated(0) |
65 |
65 |
66 def __apiKey(self, language, projectType): |
66 def __apiKey(self, language, projectType): |
67 """ |
67 """ |
68 Private method to generate a key for the apis dictionary. |
68 Private method to generate a key for the apis dictionary. |
69 |
69 |
70 @param language programming language of the API |
70 @param language programming language of the API |
71 @type str |
71 @type str |
72 @param projectType project type of the API |
72 @param projectType project type of the API |
73 @type str |
73 @type str |
74 @return key to be used |
74 @return key to be used |
75 @rtype str |
75 @rtype str |
76 """ |
76 """ |
77 key = (language, projectType) if projectType else (language, "") |
77 key = (language, projectType) if projectType else (language, "") |
78 return key |
78 return key |
79 |
79 |
80 def save(self): |
80 def save(self): |
81 """ |
81 """ |
82 Public slot to save the Editor APIs configuration. |
82 Public slot to save the Editor APIs configuration. |
83 """ |
83 """ |
84 Preferences.setEditor( |
84 Preferences.setEditor( |
85 "AutoPrepareAPIs", |
85 "AutoPrepareAPIs", self.apiAutoPrepareCheckBox.isChecked() |
86 self.apiAutoPrepareCheckBox.isChecked()) |
86 ) |
87 |
87 |
88 language = self.apiLanguageComboBox.currentText() |
88 language = self.apiLanguageComboBox.currentText() |
89 projectType = self.projectTypeComboBox.itemData( |
89 projectType = self.projectTypeComboBox.itemData( |
90 self.projectTypeComboBox.currentIndex()) |
90 self.projectTypeComboBox.currentIndex() |
|
91 ) |
91 key = self.__apiKey(language, projectType) |
92 key = self.__apiKey(language, projectType) |
92 self.apis[key] = self.__editorGetApisFromApiList() |
93 self.apis[key] = self.__editorGetApisFromApiList() |
93 |
94 |
94 for (language, projectType), apis in self.apis.items(): |
95 for (language, projectType), apis in self.apis.items(): |
95 Preferences.setEditorAPI(language, projectType, apis) |
96 Preferences.setEditorAPI(language, projectType, apis) |
96 |
97 |
97 @pyqtSlot(int) |
98 @pyqtSlot(int) |
98 def on_projectTypeComboBox_activated(self, index): |
99 def on_projectTypeComboBox_activated(self, index): |
99 """ |
100 """ |
100 Private slot to handle the selection of a project type. |
101 Private slot to handle the selection of a project type. |
101 |
102 |
102 @param index index of the selected entry |
103 @param index index of the selected entry |
103 @type str |
104 @type str |
104 """ |
105 """ |
105 if self.__currentApiProjectTypeIndex == index: |
106 if self.__currentApiProjectTypeIndex == index: |
106 return |
107 return |
107 |
108 |
108 self.__currentApiProjectTypeIndex = index |
109 self.__currentApiProjectTypeIndex = index |
109 self.__fillApisList() |
110 self.__fillApisList() |
110 |
111 |
111 @pyqtSlot(int) |
112 @pyqtSlot(int) |
112 def on_apiLanguageComboBox_activated(self, index): |
113 def on_apiLanguageComboBox_activated(self, index): |
113 """ |
114 """ |
114 Private slot to fill the api listbox of the api page. |
115 Private slot to fill the api listbox of the api page. |
115 |
116 |
116 @param index index of the selected entry |
117 @param index index of the selected entry |
117 @type int |
118 @type int |
118 """ |
119 """ |
119 language = self.apiLanguageComboBox.itemText(index) |
120 language = self.apiLanguageComboBox.itemText(index) |
120 |
121 |
121 if self.__currentApiLanguage == language: |
122 if self.__currentApiLanguage == language: |
122 return |
123 return |
123 |
124 |
124 self.__fillProjectTypeComboBox(language) |
125 self.__fillProjectTypeComboBox(language) |
125 |
126 |
126 def __fillProjectTypeComboBox(self, language): |
127 def __fillProjectTypeComboBox(self, language): |
127 """ |
128 """ |
128 Private slot to fill the selection of available project types for the |
129 Private slot to fill the selection of available project types for the |
129 given language. |
130 given language. |
130 |
131 |
131 @param language selected API language |
132 @param language selected API language |
132 @type str |
133 @type str |
133 """ |
134 """ |
134 self.projectTypeComboBox.clear() |
135 self.projectTypeComboBox.clear() |
135 |
136 |
136 apiProjectTypes = [("", "")] |
137 apiProjectTypes = [("", "")] |
137 with contextlib.suppress(KeyError): |
138 with contextlib.suppress(KeyError): |
138 apiProjectTypes += sorted( |
139 apiProjectTypes += sorted( |
139 (trans, ptype) for ptype, trans in |
140 (trans, ptype) |
140 ericApp().getObject("Project").getProjectTypes(language).items() |
141 for ptype, trans in ericApp() |
|
142 .getObject("Project") |
|
143 .getProjectTypes(language) |
|
144 .items() |
141 ) |
145 ) |
142 for projectTypeStr, projectType in apiProjectTypes: |
146 for projectTypeStr, projectType in apiProjectTypes: |
143 self.projectTypeComboBox.addItem(projectTypeStr, projectType) |
147 self.projectTypeComboBox.addItem(projectTypeStr, projectType) |
144 |
148 |
145 self.__currentApiProjectTypeIndex = -1 |
149 self.__currentApiProjectTypeIndex = -1 |
146 self.__currentApiProjectType = "" |
150 self.__currentApiProjectType = "" |
147 |
151 |
148 self.on_projectTypeComboBox_activated(0) |
152 self.on_projectTypeComboBox_activated(0) |
149 |
153 |
150 def __fillApisList(self): |
154 def __fillApisList(self): |
151 """ |
155 """ |
152 Private slot to fill the list of API files. |
156 Private slot to fill the list of API files. |
153 """ |
157 """ |
154 self.apis[ |
158 self.apis[ |
155 self.__apiKey(self.__currentApiLanguage, |
159 self.__apiKey(self.__currentApiLanguage, self.__currentApiProjectType) |
156 self.__currentApiProjectType) |
|
157 ] = self.__editorGetApisFromApiList() |
160 ] = self.__editorGetApisFromApiList() |
158 |
161 |
159 self.__currentApiLanguage = self.apiLanguageComboBox.currentText() |
162 self.__currentApiLanguage = self.apiLanguageComboBox.currentText() |
160 self.__currentApiProjectType = self.projectTypeComboBox.itemData( |
163 self.__currentApiProjectType = self.projectTypeComboBox.itemData( |
161 self.projectTypeComboBox.currentIndex()) |
164 self.projectTypeComboBox.currentIndex() |
|
165 ) |
162 self.apiList.clear() |
166 self.apiList.clear() |
163 |
167 |
164 if not self.__currentApiLanguage: |
168 if not self.__currentApiLanguage: |
165 self.apiGroup.setEnabled(False) |
169 self.apiGroup.setEnabled(False) |
166 return |
170 return |
167 |
171 |
168 self.apiGroup.setEnabled(True) |
172 self.apiGroup.setEnabled(True) |
169 self.deleteApiFileButton.setEnabled(False) |
173 self.deleteApiFileButton.setEnabled(False) |
170 self.addApiFileButton.setEnabled(False) |
174 self.addApiFileButton.setEnabled(False) |
171 self.apiFilePicker.clear() |
175 self.apiFilePicker.clear() |
172 |
176 |
173 key = self.__apiKey(self.__currentApiLanguage, |
177 key = self.__apiKey(self.__currentApiLanguage, self.__currentApiProjectType) |
174 self.__currentApiProjectType) |
|
175 if key not in self.apis: |
178 if key not in self.apis: |
176 # populate on demand |
179 # populate on demand |
177 self.apis[key] = Preferences.getEditorAPI( |
180 self.apis[key] = Preferences.getEditorAPI( |
178 self.__currentApiLanguage, |
181 self.__currentApiLanguage, projectType=self.__currentApiProjectType |
179 projectType=self.__currentApiProjectType)[:] |
182 )[:] |
180 for api in self.apis[key]: |
183 for api in self.apis[key]: |
181 if api: |
184 if api: |
182 self.apiList.addItem(api) |
185 self.apiList.addItem(api) |
183 self.prepareApiButton.setEnabled(self.apiList.count() > 0) |
186 self.prepareApiButton.setEnabled(self.apiList.count() > 0) |
184 |
187 |
185 from QScintilla.APIsManager import APIsManager |
188 from QScintilla.APIsManager import APIsManager |
|
189 |
186 self.__currentAPI = APIsManager().getAPIs( |
190 self.__currentAPI = APIsManager().getAPIs( |
187 self.__currentApiLanguage, |
191 self.__currentApiLanguage, projectType=self.__currentApiProjectType |
188 projectType=self.__currentApiProjectType) |
192 ) |
189 if self.__currentAPI is not None: |
193 if self.__currentAPI is not None: |
190 self.__currentAPI.apiPreparationFinished.connect( |
194 self.__currentAPI.apiPreparationFinished.connect( |
191 self.__apiPreparationFinished) |
195 self.__apiPreparationFinished |
|
196 ) |
192 self.__currentAPI.apiPreparationCancelled.connect( |
197 self.__currentAPI.apiPreparationCancelled.connect( |
193 self.__apiPreparationCancelled) |
198 self.__apiPreparationCancelled |
|
199 ) |
194 self.__currentAPI.apiPreparationStarted.connect( |
200 self.__currentAPI.apiPreparationStarted.connect( |
195 self.__apiPreparationStarted) |
201 self.__apiPreparationStarted |
|
202 ) |
196 self.addInstalledApiFileButton.setEnabled( |
203 self.addInstalledApiFileButton.setEnabled( |
197 len(self.__currentAPI.installedAPIFiles()) > 0) |
204 len(self.__currentAPI.installedAPIFiles()) > 0 |
|
205 ) |
198 else: |
206 else: |
199 self.addInstalledApiFileButton.setEnabled(False) |
207 self.addInstalledApiFileButton.setEnabled(False) |
200 |
208 |
201 self.addPluginApiFileButton.setEnabled( |
209 self.addPluginApiFileButton.setEnabled( |
202 len(self.pluginManager.getPluginApiFiles( |
210 len(self.pluginManager.getPluginApiFiles(self.__currentApiLanguage)) > 0 |
203 self.__currentApiLanguage)) > 0) |
211 ) |
204 |
212 |
205 def __editorGetApisFromApiList(self): |
213 def __editorGetApisFromApiList(self): |
206 """ |
214 """ |
207 Private slot to retrieve the api filenames from the list. |
215 Private slot to retrieve the api filenames from the list. |
208 |
216 |
209 @return list of api filenames (list of strings) |
217 @return list of api filenames (list of strings) |
210 """ |
218 """ |
211 apis = [] |
219 apis = [] |
212 for row in range(self.apiList.count()): |
220 for row in range(self.apiList.count()): |
213 apis.append(self.apiList.item(row).text()) |
221 apis.append(self.apiList.item(row).text()) |
214 return apis |
222 return apis |
215 |
223 |
216 @pyqtSlot() |
224 @pyqtSlot() |
217 def on_addApiFileButton_clicked(self): |
225 def on_addApiFileButton_clicked(self): |
218 """ |
226 """ |
219 Private slot to add the api file displayed to the listbox. |
227 Private slot to add the api file displayed to the listbox. |
220 """ |
228 """ |
221 file = self.apiFilePicker.text() |
229 file = self.apiFilePicker.text() |
222 if file: |
230 if file: |
223 self.apiList.addItem(Utilities.toNativeSeparators(file)) |
231 self.apiList.addItem(Utilities.toNativeSeparators(file)) |
224 self.apiFilePicker.clear() |
232 self.apiFilePicker.clear() |
225 self.prepareApiButton.setEnabled(self.apiList.count() > 0) |
233 self.prepareApiButton.setEnabled(self.apiList.count() > 0) |
226 |
234 |
227 @pyqtSlot() |
235 @pyqtSlot() |
228 def on_deleteApiFileButton_clicked(self): |
236 def on_deleteApiFileButton_clicked(self): |
229 """ |
237 """ |
230 Private slot to delete the currently selected file of the listbox. |
238 Private slot to delete the currently selected file of the listbox. |
231 """ |
239 """ |
232 crow = self.apiList.currentRow() |
240 crow = self.apiList.currentRow() |
233 if crow >= 0: |
241 if crow >= 0: |
234 itm = self.apiList.takeItem(crow) # __IGNORE_WARNING__ |
242 itm = self.apiList.takeItem(crow) # __IGNORE_WARNING__ |
235 del itm |
243 del itm |
236 self.prepareApiButton.setEnabled(self.apiList.count() > 0) |
244 self.prepareApiButton.setEnabled(self.apiList.count() > 0) |
237 |
245 |
238 @pyqtSlot() |
246 @pyqtSlot() |
239 def on_addInstalledApiFileButton_clicked(self): |
247 def on_addInstalledApiFileButton_clicked(self): |
240 """ |
248 """ |
241 Private slot to add an API file from the list of installed API files |
249 Private slot to add an API file from the list of installed API files |
242 for the selected lexer language. |
250 for the selected lexer language. |
243 """ |
251 """ |
244 installedAPIFiles = self.__currentAPI.installedAPIFiles() |
252 installedAPIFiles = self.__currentAPI.installedAPIFiles() |
245 if installedAPIFiles: |
253 if installedAPIFiles: |
246 installedAPIFilesPath = pathlib.Path(installedAPIFiles[0]).parent |
254 installedAPIFilesPath = pathlib.Path(installedAPIFiles[0]).parent |
247 installedAPIFilesShort = [ |
255 installedAPIFilesShort = [pathlib.Path(f).name for f in installedAPIFiles] |
248 pathlib.Path(f).name for f in installedAPIFiles |
|
249 ] |
|
250 dlg = EricListSelectionDialog( |
256 dlg = EricListSelectionDialog( |
251 sorted(installedAPIFilesShort), |
257 sorted(installedAPIFilesShort), |
252 title=self.tr("Add from installed APIs"), |
258 title=self.tr("Add from installed APIs"), |
253 message=self.tr("Select from the list of installed API files"), |
259 message=self.tr("Select from the list of installed API files"), |
254 checkBoxSelection=True, |
260 checkBoxSelection=True, |
255 parent=self |
261 parent=self, |
256 ) |
262 ) |
257 if dlg.exec() == QDialog.DialogCode.Accepted: |
263 if dlg.exec() == QDialog.DialogCode.Accepted: |
258 self.apiList.addItems([ |
264 self.apiList.addItems( |
259 str(installedAPIFilesPath / s) for s in dlg.getSelection() |
265 [str(installedAPIFilesPath / s) for s in dlg.getSelection()] |
260 ]) |
266 ) |
261 else: |
267 else: |
262 EricMessageBox.warning( |
268 EricMessageBox.warning( |
263 self, |
269 self, |
264 self.tr("Add from installed APIs"), |
270 self.tr("Add from installed APIs"), |
265 self.tr("""There are no APIs installed yet.""" |
271 self.tr( |
266 """ Selection is not available.""")) |
272 """There are no APIs installed yet.""" |
|
273 """ Selection is not available.""" |
|
274 ), |
|
275 ) |
267 self.addInstalledApiFileButton.setEnabled(False) |
276 self.addInstalledApiFileButton.setEnabled(False) |
268 self.prepareApiButton.setEnabled(self.apiList.count() > 0) |
277 self.prepareApiButton.setEnabled(self.apiList.count() > 0) |
269 |
278 |
270 @pyqtSlot() |
279 @pyqtSlot() |
271 def on_addPluginApiFileButton_clicked(self): |
280 def on_addPluginApiFileButton_clicked(self): |
272 """ |
281 """ |
273 Private slot to add an API file from the list of API files installed |
282 Private slot to add an API file from the list of API files installed |
274 by plugins for the selected lexer language. |
283 by plugins for the selected lexer language. |
275 """ |
284 """ |
276 pluginAPIFiles = self.pluginManager.getPluginApiFiles( |
285 pluginAPIFiles = self.pluginManager.getPluginApiFiles(self.__currentApiLanguage) |
277 self.__currentApiLanguage) |
|
278 pluginAPIFilesDict = { |
286 pluginAPIFilesDict = { |
279 pathlib.Path(f).name: pathlib.Path(f) for f in pluginAPIFiles |
287 pathlib.Path(f).name: pathlib.Path(f) for f in pluginAPIFiles |
280 } |
288 } |
281 dlg = EricListSelectionDialog( |
289 dlg = EricListSelectionDialog( |
282 sorted(pluginAPIFilesDict.keys()), |
290 sorted(pluginAPIFilesDict.keys()), |
283 title=self.tr("Add from Plugin APIs"), |
291 title=self.tr("Add from Plugin APIs"), |
284 message=self.tr( |
292 message=self.tr("Select from the list of API files installed by plugins"), |
285 "Select from the list of API files installed by plugins"), |
|
286 checkBoxSelection=True, |
293 checkBoxSelection=True, |
287 parent=self |
294 parent=self, |
288 ) |
295 ) |
289 if dlg.exec() == QDialog.DialogCode.Accepted: |
296 if dlg.exec() == QDialog.DialogCode.Accepted: |
290 self.apiList.addItems([ |
297 self.apiList.addItems( |
291 str(pluginAPIFilesDict[s]) for s in dlg.getSelection() |
298 [str(pluginAPIFilesDict[s]) for s in dlg.getSelection()] |
292 ]) |
299 ) |
293 self.prepareApiButton.setEnabled(self.apiList.count() > 0) |
300 self.prepareApiButton.setEnabled(self.apiList.count() > 0) |
294 |
301 |
295 @pyqtSlot() |
302 @pyqtSlot() |
296 def on_prepareApiButton_clicked(self): |
303 def on_prepareApiButton_clicked(self): |
297 """ |
304 """ |
298 Private slot to prepare the API file for the currently selected |
305 Private slot to prepare the API file for the currently selected |
299 language. |
306 language. |
301 if self.__inPreparation: |
308 if self.__inPreparation: |
302 self.__currentAPI and self.__currentAPI.cancelPreparation() |
309 self.__currentAPI and self.__currentAPI.cancelPreparation() |
303 else: |
310 else: |
304 if self.__currentAPI is not None: |
311 if self.__currentAPI is not None: |
305 self.__currentAPI.prepareAPIs( |
312 self.__currentAPI.prepareAPIs( |
306 ondemand=True, |
313 ondemand=True, rawList=self.__editorGetApisFromApiList() |
307 rawList=self.__editorGetApisFromApiList()) |
314 ) |
308 |
315 |
309 def __apiPreparationFinished(self): |
316 def __apiPreparationFinished(self): |
310 """ |
317 """ |
311 Private method called after the API preparation has finished. |
318 Private method called after the API preparation has finished. |
312 """ |
319 """ |
313 self.prepareApiProgressBar.reset() |
320 self.prepareApiProgressBar.reset() |
314 self.prepareApiProgressBar.setRange(0, 100) |
321 self.prepareApiProgressBar.setRange(0, 100) |
315 self.prepareApiProgressBar.setValue(0) |
322 self.prepareApiProgressBar.setValue(0) |
316 self.prepareApiButton.setText(self.tr("Compile APIs")) |
323 self.prepareApiButton.setText(self.tr("Compile APIs")) |
317 self.__inPreparation = False |
324 self.__inPreparation = False |
318 |
325 |
319 def __apiPreparationCancelled(self): |
326 def __apiPreparationCancelled(self): |
320 """ |
327 """ |
321 Private slot called after the API preparation has been cancelled. |
328 Private slot called after the API preparation has been cancelled. |
322 """ |
329 """ |
323 self.__apiPreparationFinished() |
330 self.__apiPreparationFinished() |
324 |
331 |
325 def __apiPreparationStarted(self): |
332 def __apiPreparationStarted(self): |
326 """ |
333 """ |
327 Private method called after the API preparation has started. |
334 Private method called after the API preparation has started. |
328 """ |
335 """ |
329 self.prepareApiProgressBar.setRange(0, 0) |
336 self.prepareApiProgressBar.setRange(0, 0) |
330 self.prepareApiProgressBar.setValue(0) |
337 self.prepareApiProgressBar.setValue(0) |
331 self.prepareApiButton.setText(self.tr("Cancel compilation")) |
338 self.prepareApiButton.setText(self.tr("Cancel compilation")) |
332 self.__inPreparation = True |
339 self.__inPreparation = True |
333 |
340 |
334 def saveState(self): |
341 def saveState(self): |
335 """ |
342 """ |
336 Public method to save the current state of the widget. |
343 Public method to save the current state of the widget. |
337 |
344 |
338 @return tuple containing the index of the selected lexer language |
345 @return tuple containing the index of the selected lexer language |
339 and the index of the selected project type |
346 and the index of the selected project type |
340 @rtype tuple of int and int |
347 @rtype tuple of int and int |
341 """ |
348 """ |
342 return ( |
349 return ( |
343 self.apiLanguageComboBox.currentIndex(), |
350 self.apiLanguageComboBox.currentIndex(), |
344 self.projectTypeComboBox.currentIndex() |
351 self.projectTypeComboBox.currentIndex(), |
345 ) |
352 ) |
346 |
353 |
347 def setState(self, state): |
354 def setState(self, state): |
348 """ |
355 """ |
349 Public method to set the state of the widget. |
356 Public method to set the state of the widget. |
350 |
357 |
351 @param state state data generated by saveState |
358 @param state state data generated by saveState |
352 """ |
359 """ |
353 self.apiLanguageComboBox.setCurrentIndex(state[0]) |
360 self.apiLanguageComboBox.setCurrentIndex(state[0]) |
354 self.on_apiLanguageComboBox_activated( |
361 self.on_apiLanguageComboBox_activated(self.apiLanguageComboBox.currentIndex()) |
355 self.apiLanguageComboBox.currentIndex()) |
362 |
356 |
|
357 self.projectTypeComboBox.setCurrentIndex(state[1]) |
363 self.projectTypeComboBox.setCurrentIndex(state[1]) |
358 self.on_projectTypeComboBox_activated(state[1]) |
364 self.on_projectTypeComboBox_activated(state[1]) |
359 |
365 |
360 @pyqtSlot() |
366 @pyqtSlot() |
361 def on_apiList_itemSelectionChanged(self): |
367 def on_apiList_itemSelectionChanged(self): |
362 """ |
368 """ |
363 Private slot to react on changes of API selections. |
369 Private slot to react on changes of API selections. |
364 """ |
370 """ |
365 self.deleteApiFileButton.setEnabled( |
371 self.deleteApiFileButton.setEnabled(len(self.apiList.selectedItems()) > 0) |
366 len(self.apiList.selectedItems()) > 0) |
372 |
367 |
|
368 @pyqtSlot(str) |
373 @pyqtSlot(str) |
369 def on_apiFilePicker_textChanged(self, txt): |
374 def on_apiFilePicker_textChanged(self, txt): |
370 """ |
375 """ |
371 Private slot to handle the entering of an API file name. |
376 Private slot to handle the entering of an API file name. |
372 |
377 |
373 @param txt text of the line edit (string) |
378 @param txt text of the line edit (string) |
374 """ |
379 """ |
375 enable = txt != "" |
380 enable = txt != "" |
376 |
381 |
377 if enable: |
382 if enable: |
378 # check for already added file |
383 # check for already added file |
379 for row in range(self.apiList.count()): |
384 for row in range(self.apiList.count()): |
380 if txt == self.apiList.item(row).text(): |
385 if txt == self.apiList.item(row).text(): |
381 enable = False |
386 enable = False |
382 break |
387 break |
383 |
388 |
384 self.addApiFileButton.setEnabled(enable) |
389 self.addApiFileButton.setEnabled(enable) |
385 |
390 |
386 |
391 |
387 def create(dlg): |
392 def create(dlg): |
388 """ |
393 """ |
389 Module function to create the configuration page. |
394 Module function to create the configuration page. |
390 |
395 |
391 @param dlg reference to the configuration dialog |
396 @param dlg reference to the configuration dialog |
392 @return reference to the instantiated page (ConfigurationPageBase) |
397 @return reference to the instantiated page (ConfigurationPageBase) |
393 """ |
398 """ |
394 page = EditorAPIsPage() |
399 page = EditorAPIsPage() |
395 return page |
400 return page |