20 from .Ui_EricapiConfigDialog import Ui_EricapiConfigDialog |
20 from .Ui_EricapiConfigDialog import Ui_EricapiConfigDialog |
21 import Utilities |
21 import Utilities |
22 import DocumentationTools |
22 import DocumentationTools |
23 |
23 |
24 from eric5config import getConfig |
24 from eric5config import getConfig |
|
25 |
25 |
26 |
26 class EricapiConfigDialog(QDialog, Ui_EricapiConfigDialog): |
27 class EricapiConfigDialog(QDialog, Ui_EricapiConfigDialog): |
27 """ |
28 """ |
28 Class implementing a dialog to enter the parameters for eric5_api. |
29 Class implementing a dialog to enter the parameters for eric5_api. |
29 """ |
30 """ |
30 def __init__(self, project, parms = None, parent = None): |
31 def __init__(self, project, parms=None, parent=None): |
31 """ |
32 """ |
32 Constructor |
33 Constructor |
33 |
34 |
34 @param project reference to the project object (Project.Project) |
35 @param project reference to the project object (Project.Project) |
35 @param parms parameters to set in the dialog |
36 @param parms parameters to set in the dialog |
36 @param parent parent widget of this dialog |
37 @param parent parent widget of this dialog |
37 """ |
38 """ |
38 QDialog.__init__(self,parent) |
39 QDialog.__init__(self, parent) |
39 self.setupUi(self) |
40 self.setupUi(self) |
40 |
41 |
41 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) |
42 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) |
42 for language in sorted(DocumentationTools.supportedExtensionsDictForApis.keys()): |
43 for language in sorted(DocumentationTools.supportedExtensionsDictForApis.keys()): |
43 self.languagesList.addItem(language) |
44 self.languagesList.addItem(language) |
76 items = self.languagesList.findItems(language, Qt.MatchFlags(Qt.MatchExactly)) |
77 items = self.languagesList.findItems(language, Qt.MatchFlags(Qt.MatchExactly)) |
77 items and items[0].setSelected(True) |
78 items and items[0].setSelected(True) |
78 |
79 |
79 def __initializeDefaults(self): |
80 def __initializeDefaults(self): |
80 """ |
81 """ |
81 Private method to set the default values. |
82 Private method to set the default values. |
82 |
83 |
83 These are needed later on to generate the commandline |
84 These are needed later on to generate the commandline |
84 parameters. |
85 parameters. |
85 """ |
86 """ |
86 self.defaults = { |
87 self.defaults = { |
87 'useRecursion' : False, |
88 'useRecursion': False, |
88 'includePrivate' : False, |
89 'includePrivate': False, |
89 'outputFile' : '', |
90 'outputFile': '', |
90 'basePackage' : '', |
91 'basePackage': '', |
91 'ignoreDirectories' : [], |
92 'ignoreDirectories': [], |
92 'ignoreFilePatterns' : [], |
93 'ignoreFilePatterns': [], |
93 'sourceExtensions' : [], |
94 'sourceExtensions': [], |
94 } |
95 } |
95 |
96 |
96 lang = self.project.getProjectLanguage() |
97 lang = self.project.getProjectLanguage() |
97 if lang in DocumentationTools.supportedExtensionsDictForApis: |
98 if lang in DocumentationTools.supportedExtensionsDictForApis: |
98 self.defaults['languages'] = [lang] |
99 self.defaults['languages'] = [lang] |
171 self.trUtf8("Select output file"), |
172 self.trUtf8("Select output file"), |
172 self.outputFileEdit.text(), |
173 self.outputFileEdit.text(), |
173 self.trUtf8("API files (*.api);;All files (*)")) |
174 self.trUtf8("API files (*.api);;All files (*)")) |
174 |
175 |
175 if filename: |
176 if filename: |
176 # make it relative, if it is in a subdirectory of the project path |
177 # make it relative, if it is in a subdirectory of the project path |
177 fn = Utilities.toNativeSeparators(filename) |
178 fn = Utilities.toNativeSeparators(filename) |
178 fn = self.project.getRelativePath(fn) |
179 fn = self.project.getRelativePath(fn) |
179 self.outputFileEdit.setText(fn) |
180 self.outputFileEdit.setText(fn) |
180 |
181 |
181 def on_outputFileEdit_textChanged(self, filename): |
182 def on_outputFileEdit_textChanged(self, filename): |
202 self.trUtf8("Select directory to exclude"), |
203 self.trUtf8("Select directory to exclude"), |
203 startDir, |
204 startDir, |
204 E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) |
205 E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) |
205 |
206 |
206 if directory: |
207 if directory: |
207 # make it relative, if it is a subdirectory of the project path |
208 # make it relative, if it is a subdirectory of the project path |
208 dn = Utilities.toNativeSeparators(directory) |
209 dn = Utilities.toNativeSeparators(directory) |
209 dn = self.project.getRelativePath(dn) |
210 dn = self.project.getRelativePath(dn) |
210 while dn.endswith(os.sep): |
211 while dn.endswith(os.sep): |
211 dn = dn[:-1] |
212 dn = dn[:-1] |
212 self.ignoreDirEdit.setText(dn) |
213 self.ignoreDirEdit.setText(dn) |
230 itm = self.ignoreDirsList.takeItem(self.ignoreDirsList.currentRow()) |
231 itm = self.ignoreDirsList.takeItem(self.ignoreDirsList.currentRow()) |
231 del itm |
232 del itm |
232 |
233 |
233 def accept(self): |
234 def accept(self): |
234 """ |
235 """ |
235 Protected slot called by the Ok button. |
236 Protected slot called by the Ok button. |
236 |
237 |
237 It saves the values in the parameters dictionary. |
238 It saves the values in the parameters dictionary. |
238 """ |
239 """ |
239 self.parameters['useRecursion'] = self.recursionCheckBox.isChecked() |
240 self.parameters['useRecursion'] = self.recursionCheckBox.isChecked() |
240 self.parameters['includePrivate'] = self.includePrivateCheckBox.isChecked() |
241 self.parameters['includePrivate'] = self.includePrivateCheckBox.isChecked() |