8 """ |
8 """ |
9 |
9 |
10 from PyQt6.QtCore import QDir, pyqtSlot, QFileInfo |
10 from PyQt6.QtCore import QDir, pyqtSlot, QFileInfo |
11 from PyQt6.QtWidgets import QInputDialog |
11 from PyQt6.QtWidgets import QInputDialog |
12 |
12 |
13 from E5Gui.E5Application import e5App |
13 from E5Gui.EricApplication import ericApp |
14 from E5Gui import E5MessageBox |
14 from E5Gui import EricMessageBox |
15 from E5Gui.E5PathPicker import E5PathPickerModes |
15 from E5Gui.EricPathPicker import EricPathPickerModes |
16 |
16 |
17 from .ConfigurationPageBase import ConfigurationPageBase |
17 from .ConfigurationPageBase import ConfigurationPageBase |
18 from .Ui_EditorAPIsPage import Ui_EditorAPIsPage |
18 from .Ui_EditorAPIsPage import Ui_EditorAPIsPage |
19 |
19 |
20 import Preferences |
20 import Preferences |
31 """ |
31 """ |
32 super().__init__() |
32 super().__init__() |
33 self.setupUi(self) |
33 self.setupUi(self) |
34 self.setObjectName("EditorAPIsPage") |
34 self.setObjectName("EditorAPIsPage") |
35 |
35 |
36 self.apiFilePicker.setMode(E5PathPickerModes.OPEN_FILE_MODE) |
36 self.apiFilePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
37 self.apiFilePicker.setToolTip(self.tr( |
37 self.apiFilePicker.setToolTip(self.tr( |
38 "Press to select an API file via a selection dialog")) |
38 "Press to select an API file via a selection dialog")) |
39 self.apiFilePicker.setFilters(self.tr( |
39 self.apiFilePicker.setFilters(self.tr( |
40 "API File (*.api);;All Files (*)")) |
40 "API File (*.api);;All Files (*)")) |
41 |
41 |
42 self.prepareApiButton.setText(self.tr("Compile APIs")) |
42 self.prepareApiButton.setText(self.tr("Compile APIs")) |
43 self.__currentAPI = None |
43 self.__currentAPI = None |
44 self.__inPreparation = False |
44 self.__inPreparation = False |
45 |
45 |
46 # set initial values |
46 # set initial values |
47 self.pluginManager = e5App().getObject("PluginManager") |
47 self.pluginManager = ericApp().getObject("PluginManager") |
48 self.apiAutoPrepareCheckBox.setChecked( |
48 self.apiAutoPrepareCheckBox.setChecked( |
49 Preferences.getEditor("AutoPrepareAPIs")) |
49 Preferences.getEditor("AutoPrepareAPIs")) |
50 |
50 |
51 import QScintilla.Lexers |
51 import QScintilla.Lexers |
52 self.apis = {} |
52 self.apis = {} |
130 self.projectTypeComboBox.clear() |
130 self.projectTypeComboBox.clear() |
131 |
131 |
132 apiProjectTypes = sorted( |
132 apiProjectTypes = sorted( |
133 [("", "")] + |
133 [("", "")] + |
134 [(trans, ptype) for ptype, trans in |
134 [(trans, ptype) for ptype, trans in |
135 e5App().getObject("Project").getProjectTypes(language).items() |
135 ericApp().getObject("Project").getProjectTypes(language).items() |
136 ] |
136 ] |
137 ) |
137 ) |
138 for projectTypeStr, projectType in apiProjectTypes: |
138 for projectTypeStr, projectType in apiProjectTypes: |
139 self.projectTypeComboBox.addItem(projectTypeStr, projectType) |
139 self.projectTypeComboBox.addItem(projectTypeStr, projectType) |
140 |
140 |
253 if ok: |
253 if ok: |
254 self.apiList.addItem(Utilities.toNativeSeparators( |
254 self.apiList.addItem(Utilities.toNativeSeparators( |
255 QFileInfo(QDir(installedAPIFilesPath), file) |
255 QFileInfo(QDir(installedAPIFilesPath), file) |
256 .absoluteFilePath())) |
256 .absoluteFilePath())) |
257 else: |
257 else: |
258 E5MessageBox.warning( |
258 EricMessageBox.warning( |
259 self, |
259 self, |
260 self.tr("Add from installed APIs"), |
260 self.tr("Add from installed APIs"), |
261 self.tr("""There are no APIs installed yet.""" |
261 self.tr("""There are no APIs installed yet.""" |
262 """ Selection is not available.""")) |
262 """ Selection is not available.""")) |
263 self.addInstalledApiFileButton.setEnabled(False) |
263 self.addInstalledApiFileButton.setEnabled(False) |