19 from E5Gui.E5Completers import E5FileCompleter, E5DirCompleter |
19 from E5Gui.E5Completers import E5FileCompleter, E5DirCompleter |
20 from E5Gui import E5FileDialog |
20 from E5Gui import E5FileDialog |
21 |
21 |
22 from .Ui_EricapiConfigDialog import Ui_EricapiConfigDialog |
22 from .Ui_EricapiConfigDialog import Ui_EricapiConfigDialog |
23 import Utilities |
23 import Utilities |
|
24 import UI.PixmapCache |
24 import DocumentationTools |
25 import DocumentationTools |
25 |
26 |
26 from eric5config import getConfig |
27 from eric5config import getConfig |
27 |
28 |
28 |
29 |
38 @param parms parameters to set in the dialog |
39 @param parms parameters to set in the dialog |
39 @param parent parent widget of this dialog |
40 @param parent parent widget of this dialog |
40 """ |
41 """ |
41 super(EricapiConfigDialog, self).__init__(parent) |
42 super(EricapiConfigDialog, self).__init__(parent) |
42 self.setupUi(self) |
43 self.setupUi(self) |
|
44 |
|
45 self.outputFileButton.setIcon(UI.PixmapCache.getIcon("open.png")) |
|
46 self.ignoreDirButton.setIcon(UI.PixmapCache.getIcon("open.png")) |
43 |
47 |
44 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) |
48 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) |
45 for language in sorted( |
49 for language in sorted( |
46 DocumentationTools.supportedExtensionsDictForApis.keys()): |
50 DocumentationTools.supportedExtensionsDictForApis.keys()): |
47 self.languagesList.addItem(language) |
51 self.languagesList.addItem(language) |
180 Private slot to select the output file. |
184 Private slot to select the output file. |
181 |
185 |
182 It displays a file selection dialog to |
186 It displays a file selection dialog to |
183 select the file the api is written to. |
187 select the file the api is written to. |
184 """ |
188 """ |
|
189 startFile = Utilities.fromNativeSeparators(self.outputFileEdit.text()) |
|
190 if not startFile: |
|
191 startFile = self.project.getProjectName() + ".api" |
185 filename = E5FileDialog.getSaveFileName( |
192 filename = E5FileDialog.getSaveFileName( |
186 self, |
193 self, |
187 self.trUtf8("Select output file"), |
194 self.tr("Select output file"), |
188 self.outputFileEdit.text(), |
195 startFile, |
189 self.trUtf8("API files (*.api);;All files (*)")) |
196 self.tr("API files (*.api);;All files (*)")) |
190 |
197 |
191 if filename: |
198 if filename: |
192 # make it relative, if it is in a subdirectory of the project path |
199 # make it relative, if it is in a subdirectory of the project path |
193 fn = Utilities.toNativeSeparators(filename) |
200 fn = Utilities.toNativeSeparators(filename) |
194 fn = self.project.getRelativePath(fn) |
201 fn = self.project.getRelativePath(fn) |
208 Private slot to select a directory to be ignored. |
215 Private slot to select a directory to be ignored. |
209 |
216 |
210 It displays a directory selection dialog to |
217 It displays a directory selection dialog to |
211 select a directory to be ignored. |
218 select a directory to be ignored. |
212 """ |
219 """ |
213 startDir = self.ignoreDirEdit.text() |
220 startDir = Utilities.fromNativeSeparators(self.ignoreDirEdit.text()) |
214 if not startDir: |
221 if not startDir: |
215 startDir = self.ppath |
222 startDir = self.ppath |
216 directory = E5FileDialog.getExistingDirectory( |
223 directory = E5FileDialog.getExistingDirectory( |
217 self, |
224 self, |
218 self.trUtf8("Select directory to exclude"), |
225 self.tr("Select directory to exclude"), |
219 startDir, |
226 startDir, |
220 E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) |
227 E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) |
221 |
228 |
222 if directory: |
229 if directory: |
223 # make it relative, if it is a subdirectory of the project path |
230 # make it relative, if it is a subdirectory of the project path |