Wed, 13 Jul 2022 14:55:47 +0200
Reformatted the source code using the 'Black' utility.
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
8881
54e42bc2437a
Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8366
diff
changeset
|
3 | # Copyright (c) 2006 - 2022 Detlev Offenbach <detlev@die-offenbachs.de> |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing the Editor APIs configuration page. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
9185
8975ed45c22d
Fixed an issue causing the standalone configuration script to crash on the API page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9152
diff
changeset
|
10 | import contextlib |
9151
8c5296fe3056
Changed API configuration page to allow to select multiple API files at once.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
11 | import pathlib |
8c5296fe3056
Changed API configuration page to allow to select multiple API files at once.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
12 | |
8c5296fe3056
Changed API configuration page to allow to select multiple API files at once.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
13 | from PyQt6.QtCore import pyqtSlot |
8c5296fe3056
Changed API configuration page to allow to select multiple API files at once.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
14 | from PyQt6.QtWidgets import QDialog |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
15 | |
8358
144a6b854f70
Sorted the eric specific extensions into packages named like the corresponding PyQt packages (i.e. EricCore,EricGui and EricWidgets).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8356
diff
changeset
|
16 | from EricWidgets.EricApplication import ericApp |
144a6b854f70
Sorted the eric specific extensions into packages named like the corresponding PyQt packages (i.e. EricCore,EricGui and EricWidgets).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8356
diff
changeset
|
17 | from EricWidgets import EricMessageBox |
9151
8c5296fe3056
Changed API configuration page to allow to select multiple API files at once.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
18 | from EricWidgets.EricListSelectionDialog import EricListSelectionDialog |
8358
144a6b854f70
Sorted the eric specific extensions into packages named like the corresponding PyQt packages (i.e. EricCore,EricGui and EricWidgets).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8356
diff
changeset
|
19 | from EricWidgets.EricPathPicker import EricPathPickerModes |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
20 | |
12
1d8dd9706f46
First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7
diff
changeset
|
21 | from .ConfigurationPageBase import ConfigurationPageBase |
1d8dd9706f46
First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7
diff
changeset
|
22 | from .Ui_EditorAPIsPage import Ui_EditorAPIsPage |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
23 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
24 | import Preferences |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | import Utilities |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
882
diff
changeset
|
27 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
28 | class EditorAPIsPage(ConfigurationPageBase, Ui_EditorAPIsPage): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
30 | Class implementing the Editor APIs configuration page. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
31 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
32 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | def __init__(self): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | Constructor |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | """ |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8151
diff
changeset
|
37 | super().__init__() |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
38 | self.setupUi(self) |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
39 | self.setObjectName("EditorAPIsPage") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
40 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8327
diff
changeset
|
41 | self.apiFilePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
42 | self.apiFilePicker.setToolTip( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
43 | self.tr("Press to select an API file via a selection dialog") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
44 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
45 | self.apiFilePicker.setFilters(self.tr("API File (*.api);;All Files (*)")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
46 | |
3190
a9a94491c4fd
Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3186
diff
changeset
|
47 | self.prepareApiButton.setText(self.tr("Compile APIs")) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
48 | self.__currentAPI = None |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
49 | self.__inPreparation = False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
50 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
51 | # set initial values |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8327
diff
changeset
|
52 | self.pluginManager = ericApp().getObject("PluginManager") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
53 | self.apiAutoPrepareCheckBox.setChecked(Preferences.getEditor("AutoPrepareAPIs")) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
54 | |
2408
dc3a7c9d8f6e
Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
55 | import QScintilla.Lexers |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
56 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
57 | self.apis = {} |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
58 | apiLanguages = sorted([""] + list(QScintilla.Lexers.getSupportedApiLanguages())) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
59 | for lang in apiLanguages: |
5427
614e88cfbd84
Added some eye candy.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
60 | self.apiLanguageComboBox.addItem( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
61 | QScintilla.Lexers.getLanguageIcon(lang, False), lang |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
62 | ) |
5349
bccda3b5920a
Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4830
diff
changeset
|
63 | self.__currentApiLanguage = "" |
8151
8c1445825e7b
Changed code to not use QComboBox.activated[str] and QComboBoc.highlighted[str] signals but the int variants instead.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
64 | self.on_apiLanguageComboBox_activated(0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
65 | |
5349
bccda3b5920a
Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4830
diff
changeset
|
66 | def __apiKey(self, language, projectType): |
bccda3b5920a
Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4830
diff
changeset
|
67 | """ |
bccda3b5920a
Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4830
diff
changeset
|
68 | Private method to generate a key for the apis dictionary. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
69 | |
5349
bccda3b5920a
Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4830
diff
changeset
|
70 | @param language programming language of the API |
bccda3b5920a
Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4830
diff
changeset
|
71 | @type str |
bccda3b5920a
Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4830
diff
changeset
|
72 | @param projectType project type of the API |
bccda3b5920a
Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4830
diff
changeset
|
73 | @type str |
bccda3b5920a
Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4830
diff
changeset
|
74 | @return key to be used |
bccda3b5920a
Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4830
diff
changeset
|
75 | @rtype str |
bccda3b5920a
Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4830
diff
changeset
|
76 | """ |
8234
fcb6b4b96274
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
77 | key = (language, projectType) if projectType else (language, "") |
5349
bccda3b5920a
Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4830
diff
changeset
|
78 | return key |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
79 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
80 | def save(self): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
81 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
82 | Public slot to save the Editor APIs configuration. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
83 | """ |
3025
67064c71df21
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3020
diff
changeset
|
84 | Preferences.setEditor( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
85 | "AutoPrepareAPIs", self.apiAutoPrepareCheckBox.isChecked() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
86 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
87 | |
5350
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
88 | language = self.apiLanguageComboBox.currentText() |
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
89 | projectType = self.projectTypeComboBox.itemData( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
90 | self.projectTypeComboBox.currentIndex() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
91 | ) |
5350
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
92 | key = self.__apiKey(language, projectType) |
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
93 | self.apis[key] = self.__editorGetApisFromApiList() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
94 | |
5349
bccda3b5920a
Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4830
diff
changeset
|
95 | for (language, projectType), apis in self.apis.items(): |
5350
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
96 | Preferences.setEditorAPI(language, projectType, apis) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
97 | |
5350
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
98 | @pyqtSlot(int) |
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
99 | def on_projectTypeComboBox_activated(self, index): |
5349
bccda3b5920a
Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4830
diff
changeset
|
100 | """ |
5350
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
101 | Private slot to handle the selection of a project type. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
102 | |
5350
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
103 | @param index index of the selected entry |
5349
bccda3b5920a
Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4830
diff
changeset
|
104 | @type str |
bccda3b5920a
Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4830
diff
changeset
|
105 | """ |
5350
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
106 | if self.__currentApiProjectTypeIndex == index: |
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
107 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
108 | |
5350
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
109 | self.__currentApiProjectTypeIndex = index |
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
110 | self.__fillApisList() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
111 | |
8151
8c1445825e7b
Changed code to not use QComboBox.activated[str] and QComboBoc.highlighted[str] signals but the int variants instead.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
112 | @pyqtSlot(int) |
8c1445825e7b
Changed code to not use QComboBox.activated[str] and QComboBoc.highlighted[str] signals but the int variants instead.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
113 | def on_apiLanguageComboBox_activated(self, index): |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
114 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
115 | Private slot to fill the api listbox of the api page. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
116 | |
8151
8c1445825e7b
Changed code to not use QComboBox.activated[str] and QComboBoc.highlighted[str] signals but the int variants instead.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
117 | @param index index of the selected entry |
8c1445825e7b
Changed code to not use QComboBox.activated[str] and QComboBoc.highlighted[str] signals but the int variants instead.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
118 | @type int |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
119 | """ |
8151
8c1445825e7b
Changed code to not use QComboBox.activated[str] and QComboBoc.highlighted[str] signals but the int variants instead.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
120 | language = self.apiLanguageComboBox.itemText(index) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
121 | |
5349
bccda3b5920a
Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4830
diff
changeset
|
122 | if self.__currentApiLanguage == language: |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
123 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
124 | |
7164
6da6a0a5a448
Made "MicroPython" a selectable programming language in order to not mess with the normal API selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
125 | self.__fillProjectTypeComboBox(language) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
126 | |
7164
6da6a0a5a448
Made "MicroPython" a selectable programming language in order to not mess with the normal API selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
127 | def __fillProjectTypeComboBox(self, language): |
6da6a0a5a448
Made "MicroPython" a selectable programming language in order to not mess with the normal API selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
128 | """ |
6da6a0a5a448
Made "MicroPython" a selectable programming language in order to not mess with the normal API selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
129 | Private slot to fill the selection of available project types for the |
6da6a0a5a448
Made "MicroPython" a selectable programming language in order to not mess with the normal API selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
130 | given language. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
131 | |
7164
6da6a0a5a448
Made "MicroPython" a selectable programming language in order to not mess with the normal API selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
132 | @param language selected API language |
6da6a0a5a448
Made "MicroPython" a selectable programming language in order to not mess with the normal API selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
133 | @type str |
6da6a0a5a448
Made "MicroPython" a selectable programming language in order to not mess with the normal API selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
134 | """ |
6da6a0a5a448
Made "MicroPython" a selectable programming language in order to not mess with the normal API selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
135 | self.projectTypeComboBox.clear() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
136 | |
9185
8975ed45c22d
Fixed an issue causing the standalone configuration script to crash on the API page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9152
diff
changeset
|
137 | apiProjectTypes = [("", "")] |
8975ed45c22d
Fixed an issue causing the standalone configuration script to crash on the API page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9152
diff
changeset
|
138 | with contextlib.suppress(KeyError): |
8975ed45c22d
Fixed an issue causing the standalone configuration script to crash on the API page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9152
diff
changeset
|
139 | apiProjectTypes += sorted( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
140 | (trans, ptype) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
141 | for ptype, trans in ericApp() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
142 | .getObject("Project") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
143 | .getProjectTypes(language) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
144 | .items() |
9185
8975ed45c22d
Fixed an issue causing the standalone configuration script to crash on the API page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9152
diff
changeset
|
145 | ) |
7164
6da6a0a5a448
Made "MicroPython" a selectable programming language in order to not mess with the normal API selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
146 | for projectTypeStr, projectType in apiProjectTypes: |
6da6a0a5a448
Made "MicroPython" a selectable programming language in order to not mess with the normal API selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
147 | self.projectTypeComboBox.addItem(projectTypeStr, projectType) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
148 | |
7164
6da6a0a5a448
Made "MicroPython" a selectable programming language in order to not mess with the normal API selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
149 | self.__currentApiProjectTypeIndex = -1 |
6da6a0a5a448
Made "MicroPython" a selectable programming language in order to not mess with the normal API selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
150 | self.__currentApiProjectType = "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
151 | |
7164
6da6a0a5a448
Made "MicroPython" a selectable programming language in order to not mess with the normal API selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
152 | self.on_projectTypeComboBox_activated(0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
153 | |
5350
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
154 | def __fillApisList(self): |
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
155 | """ |
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
156 | Private slot to fill the list of API files. |
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
157 | """ |
7263
c1af2e327675
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
158 | self.apis[ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
159 | self.__apiKey(self.__currentApiLanguage, self.__currentApiProjectType) |
7263
c1af2e327675
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
160 | ] = self.__editorGetApisFromApiList() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
161 | |
5350
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
162 | self.__currentApiLanguage = self.apiLanguageComboBox.currentText() |
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
163 | self.__currentApiProjectType = self.projectTypeComboBox.itemData( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
164 | self.projectTypeComboBox.currentIndex() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
165 | ) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
166 | self.apiList.clear() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
167 | |
5350
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
168 | if not self.__currentApiLanguage: |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
169 | self.apiGroup.setEnabled(False) |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
170 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
171 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
172 | self.apiGroup.setEnabled(True) |
3098
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
173 | self.deleteApiFileButton.setEnabled(False) |
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
174 | self.addApiFileButton.setEnabled(False) |
4575
464a6b049f89
Changed the Python2 debugger and Editor APIs pages to use the path picker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4554
diff
changeset
|
175 | self.apiFilePicker.clear() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
176 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
177 | key = self.__apiKey(self.__currentApiLanguage, self.__currentApiProjectType) |
5350
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
178 | if key not in self.apis: |
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
179 | # populate on demand |
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
180 | self.apis[key] = Preferences.getEditorAPI( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
181 | self.__currentApiLanguage, projectType=self.__currentApiProjectType |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
182 | )[:] |
5350
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
183 | for api in self.apis[key]: |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
184 | if api: |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
185 | self.apiList.addItem(api) |
3098
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
186 | self.prepareApiButton.setEnabled(self.apiList.count() > 0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
187 | |
2408
dc3a7c9d8f6e
Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
188 | from QScintilla.APIsManager import APIsManager |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
189 | |
5350
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
190 | self.__currentAPI = APIsManager().getAPIs( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
191 | self.__currentApiLanguage, projectType=self.__currentApiProjectType |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
192 | ) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
193 | if self.__currentAPI is not None: |
500
c3abc7895a01
Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
130
diff
changeset
|
194 | self.__currentAPI.apiPreparationFinished.connect( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
195 | self.__apiPreparationFinished |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
196 | ) |
500
c3abc7895a01
Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
130
diff
changeset
|
197 | self.__currentAPI.apiPreparationCancelled.connect( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
198 | self.__apiPreparationCancelled |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
199 | ) |
500
c3abc7895a01
Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
130
diff
changeset
|
200 | self.__currentAPI.apiPreparationStarted.connect( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
201 | self.__apiPreparationStarted |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
202 | ) |
564
b3d966393ba9
Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
500
diff
changeset
|
203 | self.addInstalledApiFileButton.setEnabled( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
204 | len(self.__currentAPI.installedAPIFiles()) > 0 |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
205 | ) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
206 | else: |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
207 | self.addInstalledApiFileButton.setEnabled(False) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
208 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
209 | self.addPluginApiFileButton.setEnabled( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
210 | len(self.pluginManager.getPluginApiFiles(self.__currentApiLanguage)) > 0 |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
211 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
212 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
213 | def __editorGetApisFromApiList(self): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
214 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
215 | Private slot to retrieve the api filenames from the list. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
216 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
217 | @return list of api filenames (list of strings) |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
218 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
219 | apis = [] |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
220 | for row in range(self.apiList.count()): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
221 | apis.append(self.apiList.item(row).text()) |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
222 | return apis |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
223 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
224 | @pyqtSlot() |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
225 | def on_addApiFileButton_clicked(self): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
226 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
227 | Private slot to add the api file displayed to the listbox. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
228 | """ |
4575
464a6b049f89
Changed the Python2 debugger and Editor APIs pages to use the path picker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4554
diff
changeset
|
229 | file = self.apiFilePicker.text() |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
230 | if file: |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
231 | self.apiList.addItem(Utilities.toNativeSeparators(file)) |
4575
464a6b049f89
Changed the Python2 debugger and Editor APIs pages to use the path picker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4554
diff
changeset
|
232 | self.apiFilePicker.clear() |
3098
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
233 | self.prepareApiButton.setEnabled(self.apiList.count() > 0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
234 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
235 | @pyqtSlot() |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
236 | def on_deleteApiFileButton_clicked(self): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
237 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
238 | Private slot to delete the currently selected file of the listbox. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
239 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
240 | crow = self.apiList.currentRow() |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
241 | if crow >= 0: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
242 | itm = self.apiList.takeItem(crow) # __IGNORE_WARNING__ |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
243 | del itm |
3098
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
244 | self.prepareApiButton.setEnabled(self.apiList.count() > 0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
245 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
246 | @pyqtSlot() |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
247 | def on_addInstalledApiFileButton_clicked(self): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
248 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
249 | Private slot to add an API file from the list of installed API files |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
250 | for the selected lexer language. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
251 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
252 | installedAPIFiles = self.__currentAPI.installedAPIFiles() |
1118
2ff50209a57f
Fixed a bug in the editor APIs page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
945
diff
changeset
|
253 | if installedAPIFiles: |
9151
8c5296fe3056
Changed API configuration page to allow to select multiple API files at once.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
254 | installedAPIFilesPath = pathlib.Path(installedAPIFiles[0]).parent |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
255 | installedAPIFilesShort = [pathlib.Path(f).name for f in installedAPIFiles] |
9151
8c5296fe3056
Changed API configuration page to allow to select multiple API files at once.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
256 | dlg = EricListSelectionDialog( |
8c5296fe3056
Changed API configuration page to allow to select multiple API files at once.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
257 | sorted(installedAPIFilesShort), |
8c5296fe3056
Changed API configuration page to allow to select multiple API files at once.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
258 | title=self.tr("Add from installed APIs"), |
8c5296fe3056
Changed API configuration page to allow to select multiple API files at once.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
259 | message=self.tr("Select from the list of installed API files"), |
8c5296fe3056
Changed API configuration page to allow to select multiple API files at once.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
260 | checkBoxSelection=True, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
261 | parent=self, |
9151
8c5296fe3056
Changed API configuration page to allow to select multiple API files at once.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
262 | ) |
8c5296fe3056
Changed API configuration page to allow to select multiple API files at once.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
263 | if dlg.exec() == QDialog.DialogCode.Accepted: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
264 | self.apiList.addItems( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
265 | [str(installedAPIFilesPath / s) for s in dlg.getSelection()] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
266 | ) |
1118
2ff50209a57f
Fixed a bug in the editor APIs page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
945
diff
changeset
|
267 | else: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8327
diff
changeset
|
268 | EricMessageBox.warning( |
3020
542e97d4ecb3
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3010
diff
changeset
|
269 | self, |
3190
a9a94491c4fd
Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3186
diff
changeset
|
270 | self.tr("Add from installed APIs"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
271 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
272 | """There are no APIs installed yet.""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
273 | """ Selection is not available.""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
274 | ), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
275 | ) |
1118
2ff50209a57f
Fixed a bug in the editor APIs page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
945
diff
changeset
|
276 | self.addInstalledApiFileButton.setEnabled(False) |
3098
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
277 | self.prepareApiButton.setEnabled(self.apiList.count() > 0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
278 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
279 | @pyqtSlot() |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
280 | def on_addPluginApiFileButton_clicked(self): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
281 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
282 | Private slot to add an API file from the list of API files installed |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
283 | by plugins for the selected lexer language. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
284 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
285 | pluginAPIFiles = self.pluginManager.getPluginApiFiles(self.__currentApiLanguage) |
9151
8c5296fe3056
Changed API configuration page to allow to select multiple API files at once.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
286 | pluginAPIFilesDict = { |
9152
8a68afaf1ba2
Started replacing the use of "QFileInfo()" with Python equivalents.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9151
diff
changeset
|
287 | pathlib.Path(f).name: pathlib.Path(f) for f in pluginAPIFiles |
9151
8c5296fe3056
Changed API configuration page to allow to select multiple API files at once.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
288 | } |
8c5296fe3056
Changed API configuration page to allow to select multiple API files at once.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
289 | dlg = EricListSelectionDialog( |
8c5296fe3056
Changed API configuration page to allow to select multiple API files at once.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
290 | sorted(pluginAPIFilesDict.keys()), |
8c5296fe3056
Changed API configuration page to allow to select multiple API files at once.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
291 | title=self.tr("Add from Plugin APIs"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
292 | message=self.tr("Select from the list of API files installed by plugins"), |
9151
8c5296fe3056
Changed API configuration page to allow to select multiple API files at once.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
293 | checkBoxSelection=True, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
294 | parent=self, |
9151
8c5296fe3056
Changed API configuration page to allow to select multiple API files at once.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
295 | ) |
8c5296fe3056
Changed API configuration page to allow to select multiple API files at once.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
296 | if dlg.exec() == QDialog.DialogCode.Accepted: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
297 | self.apiList.addItems( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
298 | [str(pluginAPIFilesDict[s]) for s in dlg.getSelection()] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
299 | ) |
3098
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
300 | self.prepareApiButton.setEnabled(self.apiList.count() > 0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
301 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
302 | @pyqtSlot() |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
303 | def on_prepareApiButton_clicked(self): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
304 | """ |
3010
befeff46ec0f
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2964
diff
changeset
|
305 | Private slot to prepare the API file for the currently selected |
befeff46ec0f
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2964
diff
changeset
|
306 | language. |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
307 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
308 | if self.__inPreparation: |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
309 | self.__currentAPI and self.__currentAPI.cancelPreparation() |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
310 | else: |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
311 | if self.__currentAPI is not None: |
564
b3d966393ba9
Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
500
diff
changeset
|
312 | self.__currentAPI.prepareAPIs( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
313 | ondemand=True, rawList=self.__editorGetApisFromApiList() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
314 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
315 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
316 | def __apiPreparationFinished(self): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
317 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
318 | Private method called after the API preparation has finished. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
319 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
320 | self.prepareApiProgressBar.reset() |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
321 | self.prepareApiProgressBar.setRange(0, 100) |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
322 | self.prepareApiProgressBar.setValue(0) |
3190
a9a94491c4fd
Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3186
diff
changeset
|
323 | self.prepareApiButton.setText(self.tr("Compile APIs")) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
324 | self.__inPreparation = False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
325 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
326 | def __apiPreparationCancelled(self): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
327 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
328 | Private slot called after the API preparation has been cancelled. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
329 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
330 | self.__apiPreparationFinished() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
331 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
332 | def __apiPreparationStarted(self): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
333 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
334 | Private method called after the API preparation has started. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
335 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
336 | self.prepareApiProgressBar.setRange(0, 0) |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
337 | self.prepareApiProgressBar.setValue(0) |
3190
a9a94491c4fd
Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3186
diff
changeset
|
338 | self.prepareApiButton.setText(self.tr("Cancel compilation")) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
339 | self.__inPreparation = True |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
340 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
341 | def saveState(self): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
342 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
343 | Public method to save the current state of the widget. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
344 | |
5350
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
345 | @return tuple containing the index of the selected lexer language |
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
346 | and the index of the selected project type |
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
347 | @rtype tuple of int and int |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
348 | """ |
5350
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
349 | return ( |
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
350 | self.apiLanguageComboBox.currentIndex(), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
351 | self.projectTypeComboBox.currentIndex(), |
5350
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
352 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
353 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
354 | def setState(self, state): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
355 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
356 | Public method to set the state of the widget. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
357 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
358 | @param state state data generated by saveState |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
359 | """ |
5350
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
360 | self.apiLanguageComboBox.setCurrentIndex(state[0]) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
361 | self.on_apiLanguageComboBox_activated(self.apiLanguageComboBox.currentIndex()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
362 | |
7164
6da6a0a5a448
Made "MicroPython" a selectable programming language in order to not mess with the normal API selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
363 | self.projectTypeComboBox.setCurrentIndex(state[1]) |
5350
57e82ffafdfc
Adjusted the APIs configuration page to support project type specific API sets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5349
diff
changeset
|
364 | self.on_projectTypeComboBox_activated(state[1]) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
365 | |
3098
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
366 | @pyqtSlot() |
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
367 | def on_apiList_itemSelectionChanged(self): |
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
368 | """ |
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
369 | Private slot to react on changes of API selections. |
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
370 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
371 | self.deleteApiFileButton.setEnabled(len(self.apiList.selectedItems()) > 0) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
372 | |
3098
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
373 | @pyqtSlot(str) |
4575
464a6b049f89
Changed the Python2 debugger and Editor APIs pages to use the path picker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4554
diff
changeset
|
374 | def on_apiFilePicker_textChanged(self, txt): |
3098
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
375 | """ |
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
376 | Private slot to handle the entering of an API file name. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
377 | |
3098
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
378 | @param txt text of the line edit (string) |
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
379 | """ |
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
380 | enable = txt != "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
381 | |
3098
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
382 | if enable: |
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
383 | # check for already added file |
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
384 | for row in range(self.apiList.count()): |
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
385 | if txt == self.apiList.item(row).text(): |
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
386 | enable = False |
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
387 | break |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
388 | |
3098
02ee75d31584
Fixed a bug in the APIs configuration page of the config dialog and improved its functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3038
diff
changeset
|
389 | self.addApiFileButton.setEnabled(enable) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
390 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
882
diff
changeset
|
391 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
392 | def create(dlg): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
393 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
394 | Module function to create the configuration page. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
395 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
396 | @param dlg reference to the configuration dialog |
2964
84b65fb9e780
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2408
diff
changeset
|
397 | @return reference to the instantiated page (ConfigurationPageBase) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
398 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
399 | page = EditorAPIsPage() |
880
52ed20236a1c
Added the option to not use the native file dialog to prevent crashes on Linux.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
400 | return page |