11 import pathlib |
11 import pathlib |
12 |
12 |
13 from PyQt6.QtCore import pyqtSlot |
13 from PyQt6.QtCore import pyqtSlot |
14 from PyQt6.QtWidgets import QDialog |
14 from PyQt6.QtWidgets import QDialog |
15 |
15 |
16 from EricWidgets.EricApplication import ericApp |
16 from eric7.EricWidgets.EricApplication import ericApp |
17 from EricWidgets import EricMessageBox |
17 from eric7.EricWidgets import EricMessageBox |
18 from EricWidgets.EricListSelectionDialog import EricListSelectionDialog |
18 from eric7.EricWidgets.EricListSelectionDialog import EricListSelectionDialog |
19 from EricWidgets.EricPathPicker import EricPathPickerModes |
19 from eric7.EricWidgets.EricPathPicker import EricPathPickerModes |
20 |
20 |
21 from .ConfigurationPageBase import ConfigurationPageBase |
21 from .ConfigurationPageBase import ConfigurationPageBase |
22 from .Ui_EditorAPIsPage import Ui_EditorAPIsPage |
22 from .Ui_EditorAPIsPage import Ui_EditorAPIsPage |
23 |
23 |
24 import Preferences |
24 from eric7 import Preferences, Utilities |
25 import Utilities |
|
26 |
25 |
27 |
26 |
28 class EditorAPIsPage(ConfigurationPageBase, Ui_EditorAPIsPage): |
27 class EditorAPIsPage(ConfigurationPageBase, Ui_EditorAPIsPage): |
29 """ |
28 """ |
30 Class implementing the Editor APIs configuration page. |
29 Class implementing the Editor APIs configuration page. |
50 |
49 |
51 # set initial values |
50 # set initial values |
52 self.pluginManager = ericApp().getObject("PluginManager") |
51 self.pluginManager = ericApp().getObject("PluginManager") |
53 self.apiAutoPrepareCheckBox.setChecked(Preferences.getEditor("AutoPrepareAPIs")) |
52 self.apiAutoPrepareCheckBox.setChecked(Preferences.getEditor("AutoPrepareAPIs")) |
54 |
53 |
55 import QScintilla.Lexers |
54 from eric7.QScintilla import Lexers |
56 |
55 |
57 self.apis = {} |
56 self.apis = {} |
58 apiLanguages = sorted([""] + list(QScintilla.Lexers.getSupportedApiLanguages())) |
57 apiLanguages = sorted([""] + list(Lexers.getSupportedApiLanguages())) |
59 for lang in apiLanguages: |
58 for lang in apiLanguages: |
60 self.apiLanguageComboBox.addItem( |
59 self.apiLanguageComboBox.addItem(Lexers.getLanguageIcon(lang, False), lang) |
61 QScintilla.Lexers.getLanguageIcon(lang, False), lang |
|
62 ) |
|
63 self.__currentApiLanguage = "" |
60 self.__currentApiLanguage = "" |
64 self.on_apiLanguageComboBox_activated(0) |
61 self.on_apiLanguageComboBox_activated(0) |
65 |
62 |
66 def __apiKey(self, language, projectType): |
63 def __apiKey(self, language, projectType): |
67 """ |
64 """ |
183 for api in self.apis[key]: |
180 for api in self.apis[key]: |
184 if api: |
181 if api: |
185 self.apiList.addItem(api) |
182 self.apiList.addItem(api) |
186 self.prepareApiButton.setEnabled(self.apiList.count() > 0) |
183 self.prepareApiButton.setEnabled(self.apiList.count() > 0) |
187 |
184 |
188 from QScintilla.APIsManager import APIsManager |
185 from eric7.QScintilla.APIsManager import APIsManager |
189 |
186 |
190 self.__currentAPI = APIsManager().getAPIs( |
187 self.__currentAPI = APIsManager().getAPIs( |
191 self.__currentApiLanguage, projectType=self.__currentApiProjectType |
188 self.__currentApiLanguage, projectType=self.__currentApiProjectType |
192 ) |
189 ) |
193 if self.__currentAPI is not None: |
190 if self.__currentAPI is not None: |