88 if not language: |
88 if not language: |
89 self.apiGroup.setEnabled(False) |
89 self.apiGroup.setEnabled(False) |
90 return |
90 return |
91 |
91 |
92 self.apiGroup.setEnabled(True) |
92 self.apiGroup.setEnabled(True) |
|
93 self.deleteApiFileButton.setEnabled(False) |
|
94 self.addApiFileButton.setEnabled(False) |
|
95 self.apiFileEdit.clear() |
|
96 |
93 for api in self.apis[self.currentApiLanguage]: |
97 for api in self.apis[self.currentApiLanguage]: |
94 if api: |
98 if api: |
95 self.apiList.addItem(api) |
99 self.apiList.addItem(api) |
|
100 self.prepareApiButton.setEnabled(self.apiList.count() > 0) |
96 |
101 |
97 from QScintilla.APIsManager import APIsManager |
102 from QScintilla.APIsManager import APIsManager |
98 self.__currentAPI = APIsManager().getAPIs(self.currentApiLanguage) |
103 self.__currentAPI = APIsManager().getAPIs(self.currentApiLanguage) |
99 if self.__currentAPI is not None: |
104 if self.__currentAPI is not None: |
100 self.__currentAPI.apiPreparationFinished.connect( |
105 self.__currentAPI.apiPreparationFinished.connect( |
102 self.__currentAPI.apiPreparationCancelled.connect( |
107 self.__currentAPI.apiPreparationCancelled.connect( |
103 self.__apiPreparationCancelled) |
108 self.__apiPreparationCancelled) |
104 self.__currentAPI.apiPreparationStarted.connect( |
109 self.__currentAPI.apiPreparationStarted.connect( |
105 self.__apiPreparationStarted) |
110 self.__apiPreparationStarted) |
106 self.addInstalledApiFileButton.setEnabled( |
111 self.addInstalledApiFileButton.setEnabled( |
107 self.__currentAPI.installedAPIFiles() != "") |
112 len(self.__currentAPI.installedAPIFiles()) > 0) |
108 else: |
113 else: |
109 self.addInstalledApiFileButton.setEnabled(False) |
114 self.addInstalledApiFileButton.setEnabled(False) |
110 |
115 |
111 self.addPluginApiFileButton.setEnabled( |
116 self.addPluginApiFileButton.setEnabled( |
112 len(self.pluginManager.getPluginApiFiles(self.currentApiLanguage)) |
117 len(self.pluginManager.getPluginApiFiles(self.currentApiLanguage)) |
144 """ |
149 """ |
145 file = self.apiFileEdit.text() |
150 file = self.apiFileEdit.text() |
146 if file: |
151 if file: |
147 self.apiList.addItem(Utilities.toNativeSeparators(file)) |
152 self.apiList.addItem(Utilities.toNativeSeparators(file)) |
148 self.apiFileEdit.clear() |
153 self.apiFileEdit.clear() |
|
154 self.prepareApiButton.setEnabled(self.apiList.count() > 0) |
149 |
155 |
150 @pyqtSlot() |
156 @pyqtSlot() |
151 def on_deleteApiFileButton_clicked(self): |
157 def on_deleteApiFileButton_clicked(self): |
152 """ |
158 """ |
153 Private slot to delete the currently selected file of the listbox. |
159 Private slot to delete the currently selected file of the listbox. |
154 """ |
160 """ |
155 crow = self.apiList.currentRow() |
161 crow = self.apiList.currentRow() |
156 if crow >= 0: |
162 if crow >= 0: |
157 itm = self.apiList.takeItem(crow) |
163 itm = self.apiList.takeItem(crow) |
158 del itm |
164 del itm |
|
165 self.prepareApiButton.setEnabled(self.apiList.count() > 0) |
159 |
166 |
160 @pyqtSlot() |
167 @pyqtSlot() |
161 def on_addInstalledApiFileButton_clicked(self): |
168 def on_addInstalledApiFileButton_clicked(self): |
162 """ |
169 """ |
163 Private slot to add an API file from the list of installed API files |
170 Private slot to add an API file from the list of installed API files |
185 self, |
192 self, |
186 self.trUtf8("Add from installed APIs"), |
193 self.trUtf8("Add from installed APIs"), |
187 self.trUtf8("""There are no APIs installed yet.""" |
194 self.trUtf8("""There are no APIs installed yet.""" |
188 """ Selection is not available.""")) |
195 """ Selection is not available.""")) |
189 self.addInstalledApiFileButton.setEnabled(False) |
196 self.addInstalledApiFileButton.setEnabled(False) |
|
197 self.prepareApiButton.setEnabled(self.apiList.count() > 0) |
190 |
198 |
191 @pyqtSlot() |
199 @pyqtSlot() |
192 def on_addPluginApiFileButton_clicked(self): |
200 def on_addPluginApiFileButton_clicked(self): |
193 """ |
201 """ |
194 Private slot to add an API file from the list of API files installed |
202 Private slot to add an API file from the list of API files installed |
207 sorted(pluginAPIFilesDict.keys()), |
215 sorted(pluginAPIFilesDict.keys()), |
208 0, False) |
216 0, False) |
209 if ok: |
217 if ok: |
210 self.apiList.addItem(Utilities.toNativeSeparators( |
218 self.apiList.addItem(Utilities.toNativeSeparators( |
211 pluginAPIFilesDict[file])) |
219 pluginAPIFilesDict[file])) |
|
220 self.prepareApiButton.setEnabled(self.apiList.count() > 0) |
212 |
221 |
213 @pyqtSlot() |
222 @pyqtSlot() |
214 def on_prepareApiButton_clicked(self): |
223 def on_prepareApiButton_clicked(self): |
215 """ |
224 """ |
216 Private slot to prepare the API file for the currently selected |
225 Private slot to prepare the API file for the currently selected |
265 """ |
274 """ |
266 self.apiLanguageComboBox.setCurrentIndex(state) |
275 self.apiLanguageComboBox.setCurrentIndex(state) |
267 self.on_apiLanguageComboBox_activated( |
276 self.on_apiLanguageComboBox_activated( |
268 self.apiLanguageComboBox.currentText()) |
277 self.apiLanguageComboBox.currentText()) |
269 |
278 |
|
279 @pyqtSlot() |
|
280 def on_apiList_itemSelectionChanged(self): |
|
281 """ |
|
282 Private slot to react on changes of API selections. |
|
283 """ |
|
284 self.deleteApiFileButton.setEnabled( |
|
285 len(self.apiList.selectedItems()) > 0) |
|
286 |
|
287 @pyqtSlot(str) |
|
288 def on_apiFileEdit_textChanged(self, txt): |
|
289 """ |
|
290 Private slot to handle the entering of an API file name. |
|
291 |
|
292 @param txt text of the line edit (string) |
|
293 """ |
|
294 enable = txt != "" |
|
295 |
|
296 if enable: |
|
297 # check for already added file |
|
298 for row in range(self.apiList.count()): |
|
299 if txt == self.apiList.item(row).text(): |
|
300 enable = False |
|
301 break |
|
302 |
|
303 self.addApiFileButton.setEnabled(enable) |
|
304 |
270 |
305 |
271 def create(dlg): |
306 def create(dlg): |
272 """ |
307 """ |
273 Module function to create the configuration page. |
308 Module function to create the configuration page. |
274 |
309 |