Preferences/ConfigurationPages/EditorAPIsPage.py

Wed, 30 Nov 2016 19:59:57 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 30 Nov 2016 19:59:57 +0100
branch
APIs
changeset 5349
bccda3b5920a
parent 4830
f609a22f43bd
child 5350
57e82ffafdfc
permissions
-rw-r--r--

Started implementing project type specific APIs.

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
4631
5c1a96925da4 Updated copyright for 2016.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4575
diff changeset
3 # Copyright (c) 2006 - 2016 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
3145
a9de05d4a22f # __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3142
diff changeset
10 from __future__ import unicode_literals
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2408
diff changeset
11
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
12 from PyQt5.QtCore import QDir, pyqtSlot, QFileInfo
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
13 from PyQt5.QtWidgets import QInputDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
15 from E5Gui.E5Application import e5App
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
16 from E5Gui import E5MessageBox
464a6b049f89 Changed the Python2 debugger and Editor APIs pages to use the path picker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4554
diff changeset
17 from E5Gui.E5PathPicker import E5PathPickerModes
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
19 from .ConfigurationPageBase import ConfigurationPageBase
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
20 from .Ui_EditorAPIsPage import Ui_EditorAPIsPage
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 import Preferences
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 import Utilities
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
25
5349
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
26 # TODO: add combo box to select project type
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
27 # getEditorAPI und setEditorAPI
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 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 def __init__(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2408
diff changeset
36 super(EditorAPIsPage, self).__init__()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.setupUi(self)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 self.setObjectName("EditorAPIsPage")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39
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
40 self.apiFilePicker.setMode(E5PathPickerModes.OpenFileMode)
464a6b049f89 Changed the Python2 debugger and Editor APIs pages to use the path picker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4554
diff changeset
41 self.apiFilePicker.setToolTip(self.tr(
464a6b049f89 Changed the Python2 debugger and Editor APIs pages to use the path picker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4554
diff changeset
42 "Press to select an API file via a selection dialog"))
464a6b049f89 Changed the Python2 debugger and Editor APIs pages to use the path picker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4554
diff changeset
43 self.apiFilePicker.setFilters(self.tr(
464a6b049f89 Changed the Python2 debugger and Editor APIs pages to use the path picker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4554
diff changeset
44 "API File (*.api);;All Files (*)"))
3186
a05eff845522 Changed all the file or directory selection buttons to QToolButton and gave them an icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
45
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3186
diff changeset
46 self.prepareApiButton.setText(self.tr("Compile APIs"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 self.__currentAPI = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 self.__inPreparation = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 # set initial values
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 20
diff changeset
51 self.pluginManager = e5App().getObject("PluginManager")
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
52 self.apiAutoPrepareCheckBox.setChecked(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 Preferences.getEditor("AutoPrepareAPIs"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54
2408
dc3a7c9d8f6e Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
55 import QScintilla.Lexers
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 self.apis = {}
3025
67064c71df21 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
57 apiLanguages = sorted(
67064c71df21 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
58 [''] + list(QScintilla.Lexers.getSupportedLanguages().keys()))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 for lang in apiLanguages:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 if lang != "Guessed":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 self.apiLanguageComboBox.addItem(lang)
5349
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
62 apiProjectTypes = sorted(
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
63 [("", "")] + [(trans, ptype) for ptype, trans in
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
64 e5App().getObject("Project").getProjectTypes().items()]
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
65 )
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
66 for projectTypeStr, projectType in apiProjectTypes:
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
67 self.projectTypeComboBox.addItem(projectTypeStr, projectType)
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
68 self.__currentApiLanguage = ""
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
69 self.__currentApiProjectType = ""
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
70 self.on_apiLanguageComboBox_activated(self.__currentApiLanguage)
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
71 ## self.on_projectTypeComboBox_activated(self.__currentApiProjectType)
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
72 ##
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
73 ## for lang in apiLanguages[1:]:
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
74 ## self.apis[lang] = Preferences.getEditorAPI(lang)[:]
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
75
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
76 def __apiKey(self, language, projectType):
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
77 """
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
78 Private method to generate a key for the apis dictionary.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79
5349
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
80 @param language programming language of the API
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
81 @type str
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
82 @param projectType project type of the API
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
83 @type str
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
84 @return key to be used
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
85 @rtype str
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
86 """
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
87 if projectType:
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
88 key = (language, projectType)
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
89 else:
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
90 key = (language, "")
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
91 return key
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
92
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 def save(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 Public slot to save the Editor APIs configuration.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 """
3025
67064c71df21 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
97 Preferences.setEditor(
67064c71df21 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
98 "AutoPrepareAPIs",
7
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
99 self.apiAutoPrepareCheckBox.isChecked())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 lang = self.apiLanguageComboBox.currentText()
5349
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
102 self.apis[self.__apiKey()] = self.__editorGetApisFromApiList()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103
5349
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
104 for (language, projectType), apis in self.apis.items():
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
105 Preferences.setEditorAPI(lang, projectType, apis)
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
106
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
107 # TODO: carry on from here
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
108 @pyqtSlot(str)
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
109 def on_projectTypeComboBox_activated(self, p0):
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
110 """
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
111 Slot documentation goes here.
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
112
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
113 @param p0 DESCRIPTION
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
114 @type str
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
115 """
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
116 return
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
117 # TODO: not implemented yet
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
118 raise NotImplementedError
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 @pyqtSlot(str)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 def on_apiLanguageComboBox_activated(self, language):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 Private slot to fill the api listbox of the api page.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 @param language selected API language (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 """
5349
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
127 if self.__currentApiLanguage == language:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129
5349
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
130 self.apis[self.__currentApiLanguage] = self.__editorGetApisFromApiList()
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
131 self.__currentApiLanguage = language
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 self.apiList.clear()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 if not language:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 self.apiGroup.setEnabled(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 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
139 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
140 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
141 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
142
5349
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
143 for api in self.apis[self.__currentApiLanguage]:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 if api:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 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
146 self.prepareApiButton.setEnabled(self.apiList.count() > 0)
2408
dc3a7c9d8f6e Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
147
5349
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
148 # TODO: add project type
2408
dc3a7c9d8f6e Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
149 from QScintilla.APIsManager import APIsManager
5349
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
150 self.__currentAPI = APIsManager().getAPIs(self.__currentApiLanguage)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 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
152 self.__currentAPI.apiPreparationFinished.connect(
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 130
diff changeset
153 self.__apiPreparationFinished)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 130
diff changeset
154 self.__currentAPI.apiPreparationCancelled.connect(
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 130
diff changeset
155 self.__apiPreparationCancelled)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 130
diff changeset
156 self.__currentAPI.apiPreparationStarted.connect(
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 130
diff changeset
157 self.__apiPreparationStarted)
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
158 self.addInstalledApiFileButton.setEnabled(
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
159 len(self.__currentAPI.installedAPIFiles()) > 0)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 self.addInstalledApiFileButton.setEnabled(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163 self.addPluginApiFileButton.setEnabled(
4830
f609a22f43bd Fixed a few code style issues detected by the updated pep8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
164 len(self.pluginManager.getPluginApiFiles(
5349
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
165 self.__currentApiLanguage)) > 0)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 def __editorGetApisFromApiList(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 Private slot to retrieve the api filenames from the list.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 @return list of api filenames (list of strings)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 apis = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174 for row in range(self.apiList.count()):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 apis.append(self.apiList.item(row).text())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 return apis
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 @pyqtSlot()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 def on_addApiFileButton_clicked(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 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
182 """
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
183 file = self.apiFilePicker.text()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184 if file:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 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
186 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
187 self.prepareApiButton.setEnabled(self.apiList.count() > 0)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 @pyqtSlot()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 def on_deleteApiFileButton_clicked(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 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
193 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 crow = self.apiList.currentRow()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 if crow >= 0:
4554
f3428ddd577c Fixed a few style and coding issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
196 itm = self.apiList.takeItem(crow) # __IGNORE_WARNING__
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197 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
198 self.prepareApiButton.setEnabled(self.apiList.count() > 0)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 @pyqtSlot()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 def on_addInstalledApiFileButton_clicked(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 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
204 for the selected lexer language.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206 installedAPIFiles = self.__currentAPI.installedAPIFiles()
1118
2ff50209a57f Fixed a bug in the editor APIs page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
207 if installedAPIFiles:
2ff50209a57f Fixed a bug in the editor APIs page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
208 installedAPIFilesPath = QFileInfo(installedAPIFiles[0]).path()
2ff50209a57f Fixed a bug in the editor APIs page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
209 installedAPIFilesShort = []
2ff50209a57f Fixed a bug in the editor APIs page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
210 for installedAPIFile in installedAPIFiles:
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
211 installedAPIFilesShort.append(
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
212 QFileInfo(installedAPIFile).fileName())
1118
2ff50209a57f Fixed a bug in the editor APIs page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
213 file, ok = QInputDialog.getItem(
2ff50209a57f Fixed a bug in the editor APIs page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
214 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3186
diff changeset
215 self.tr("Add from installed APIs"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3186
diff changeset
216 self.tr("Select from the list of installed API files"),
1118
2ff50209a57f Fixed a bug in the editor APIs page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
217 installedAPIFilesShort,
2ff50209a57f Fixed a bug in the editor APIs page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
218 0, False)
2ff50209a57f Fixed a bug in the editor APIs page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
219 if ok:
2ff50209a57f Fixed a bug in the editor APIs page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
220 self.apiList.addItem(Utilities.toNativeSeparators(
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
221 QFileInfo(QDir(installedAPIFilesPath), file)
3038
7fe9a53280bd Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3025
diff changeset
222 .absoluteFilePath()))
1118
2ff50209a57f Fixed a bug in the editor APIs page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
223 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
224 E5MessageBox.warning(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3010
diff changeset
225 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3186
diff changeset
226 self.tr("Add from installed APIs"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3186
diff changeset
227 self.tr("""There are no APIs installed yet."""
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3186
diff changeset
228 """ Selection is not available."""))
1118
2ff50209a57f Fixed a bug in the editor APIs page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
229 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
230 self.prepareApiButton.setEnabled(self.apiList.count() > 0)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232 @pyqtSlot()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233 def on_addPluginApiFileButton_clicked(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235 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
236 by plugins for the selected lexer language.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237 """
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
238 pluginAPIFiles = self.pluginManager.getPluginApiFiles(
5349
bccda3b5920a Started implementing project type specific APIs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4830
diff changeset
239 self.__currentApiLanguage)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 pluginAPIFilesDict = {}
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
241 for apiFile in pluginAPIFiles:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 pluginAPIFilesDict[QFileInfo(apiFile).fileName()] = apiFile
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
243 file, ok = QInputDialog.getItem(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3186
diff changeset
245 self.tr("Add from Plugin APIs"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3186
diff changeset
246 self.tr(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 "Select from the list of API files installed by plugins"),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 sorted(pluginAPIFilesDict.keys()),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 0, False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 if ok:
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
251 self.apiList.addItem(Utilities.toNativeSeparators(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252 pluginAPIFilesDict[file]))
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
253 self.prepareApiButton.setEnabled(self.apiList.count() > 0)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255 @pyqtSlot()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 def on_prepareApiButton_clicked(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 """
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
258 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
259 language.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 if self.__inPreparation:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 self.__currentAPI and self.__currentAPI.cancelPreparation()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 if self.__currentAPI is not None:
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
265 self.__currentAPI.prepareAPIs(
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
266 ondemand=True,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
267 rawList=self.__editorGetApisFromApiList())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 def __apiPreparationFinished(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 Private method called after the API preparation has finished.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
272 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 self.prepareApiProgressBar.reset()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 self.prepareApiProgressBar.setRange(0, 100)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 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
276 self.prepareApiButton.setText(self.tr("Compile APIs"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277 self.__inPreparation = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 def __apiPreparationCancelled(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281 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
282 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 self.__apiPreparationFinished()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 def __apiPreparationStarted(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 Private method called after the API preparation has started.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 self.prepareApiProgressBar.setRange(0, 0)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 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
291 self.prepareApiButton.setText(self.tr("Cancel compilation"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 self.__inPreparation = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 def saveState(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 Public method to save the current state of the widget.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 @return index of the selected lexer language (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
299 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 return self.apiLanguageComboBox.currentIndex()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302 def setState(self, state):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
303 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304 Public method to set the state of the widget.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306 @param state state data generated by saveState
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 self.apiLanguageComboBox.setCurrentIndex(state)
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
309 self.on_apiLanguageComboBox_activated(
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2964
diff changeset
310 self.apiLanguageComboBox.currentText())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311
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
312 @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
313 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
314 """
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
315 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
316 """
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
317 self.deleteApiFileButton.setEnabled(
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
318 len(self.apiList.selectedItems()) > 0)
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
319
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
320 @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
321 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
322 """
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
323 Private slot to handle the entering of an API file name.
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
324
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
325 @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
326 """
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
327 enable = txt != ""
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
328
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
329 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
330 # 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
331 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
332 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
333 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
334 break
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
335
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
336 self.addApiFileButton.setEnabled(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
337
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
338
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
339 def create(dlg):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
340 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
341 Module function to create the configuration page.
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 @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
344 @return reference to the instantiated page (ConfigurationPageBase)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
345 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
346 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
347 return page

eric ide

mercurial