Plugins/DocumentationPlugins/Ericdoc/EricdocConfigDialog.py

changeset 945
8cd4d08fa9f6
parent 908
d00447340771
child 1112
8a7d1b9d18db
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
20 from .Ui_EricdocConfigDialog import Ui_EricdocConfigDialog 20 from .Ui_EricdocConfigDialog import Ui_EricdocConfigDialog
21 from DocumentationTools.Config import eric5docDefaultColors, eric5docColorParameterNames 21 from DocumentationTools.Config import eric5docDefaultColors, eric5docColorParameterNames
22 import Utilities 22 import Utilities
23 23
24 from eric5config import getConfig 24 from eric5config import getConfig
25
25 26
26 class EricdocConfigDialog(QDialog, Ui_EricdocConfigDialog): 27 class EricdocConfigDialog(QDialog, Ui_EricdocConfigDialog):
27 """ 28 """
28 Class implementing a dialog to enter the parameters for eric5_doc. 29 Class implementing a dialog to enter the parameters for eric5_doc.
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.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) 42 self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok)
42 43
43 self.__initializeDefaults() 44 self.__initializeDefaults()
111 self.qtHelpGenerateCollectionCheckBox.setChecked( 112 self.qtHelpGenerateCollectionCheckBox.setChecked(
112 self.parameters['qtHelpCreateCollection']) 113 self.parameters['qtHelpCreateCollection'])
113 114
114 def __initializeDefaults(self): 115 def __initializeDefaults(self):
115 """ 116 """
116 Private method to set the default values. 117 Private method to set the default values.
117 118
118 These are needed later on to generate the commandline 119 These are needed later on to generate the commandline
119 parameters. 120 parameters.
120 """ 121 """
121 self.defaults = { 122 self.defaults = {
122 'useRecursion' : 0, 123 'useRecursion': 0,
123 'noindex' : 0, 124 'noindex': 0,
124 'noempty' : 0, 125 'noempty': 0,
125 'outputDirectory' : '', 126 'outputDirectory': '',
126 'ignoreDirectories' : [], 127 'ignoreDirectories': [],
127 'ignoreFilePatterns' : [], 128 'ignoreFilePatterns': [],
128 'cssFile' : '', 129 'cssFile': '',
129 'sourceExtensions' : [], 130 'sourceExtensions': [],
130 131
131 'qtHelpEnabled' : False, 132 'qtHelpEnabled': False,
132 'qtHelpOutputDirectory' : '', 133 'qtHelpOutputDirectory': '',
133 'qtHelpNamespace' : '', 134 'qtHelpNamespace': '',
134 'qtHelpVirtualFolder' : 'source', 135 'qtHelpVirtualFolder': 'source',
135 'qtHelpFilterName' : 'unknown', 136 'qtHelpFilterName': 'unknown',
136 'qtHelpFilterAttributes' : '', 137 'qtHelpFilterAttributes': '',
137 'qtHelpTitle' : '', 138 'qtHelpTitle': '',
138 'qtHelpCreateCollection' : False, 139 'qtHelpCreateCollection': False,
139 } 140 }
140 141
141 def generateParameters(self): 142 def generateParameters(self):
142 """ 143 """
143 Public method that generates the commandline parameters. 144 Public method that generates the commandline parameters.
263 self.trUtf8("Select output directory"), 264 self.trUtf8("Select output directory"),
264 self.outputDirEdit.text(), 265 self.outputDirEdit.text(),
265 E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) 266 E5FileDialog.Options(E5FileDialog.ShowDirsOnly))
266 267
267 if directory: 268 if directory:
268 # make it relative, if it is a subdirectory of the project path 269 # make it relative, if it is a subdirectory of the project path
269 dn = Utilities.toNativeSeparators(directory) 270 dn = Utilities.toNativeSeparators(directory)
270 dn = self.project.getRelativePath(dn) 271 dn = self.project.getRelativePath(dn)
271 while dn.endswith(os.sep): 272 while dn.endswith(os.sep):
272 dn = dn[:-1] 273 dn = dn[:-1]
273 self.outputDirEdit.setText(dn) 274 self.outputDirEdit.setText(dn)
288 self.trUtf8("Select directory to exclude"), 289 self.trUtf8("Select directory to exclude"),
289 startDir, 290 startDir,
290 E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) 291 E5FileDialog.Options(E5FileDialog.ShowDirsOnly))
291 292
292 if directory: 293 if directory:
293 # make it relative, if it is a subdirectory of the project path 294 # make it relative, if it is a subdirectory of the project path
294 dn = Utilities.toNativeSeparators(directory) 295 dn = Utilities.toNativeSeparators(directory)
295 dn = self.project.getRelativePath(dn) 296 dn = self.project.getRelativePath(dn)
296 while dn.endswith(os.sep): 297 while dn.endswith(os.sep):
297 dn = dn[:-1] 298 dn = dn[:-1]
298 self.ignoreDirEdit.setText(dn) 299 self.ignoreDirEdit.setText(dn)
326 self.trUtf8("Select CSS style sheet"), 327 self.trUtf8("Select CSS style sheet"),
327 getConfig('ericCSSDir'), 328 getConfig('ericCSSDir'),
328 self.trUtf8("Style sheet (*.css);;All files (*)")) 329 self.trUtf8("Style sheet (*.css);;All files (*)"))
329 330
330 if cssFile: 331 if cssFile:
331 # make it relative, if it is in a subdirectory of the project path 332 # make it relative, if it is in a subdirectory of the project path
332 cf = Utilities.toNativeSeparators(cssFile) 333 cf = Utilities.toNativeSeparators(cssFile)
333 cf = self.project.getRelativePath(cf) 334 cf = self.project.getRelativePath(cf)
334 self.cssEdit.setText(cf) 335 self.cssEdit.setText(cf)
335 336
336 def __selectColor(self, colorKey): 337 def __selectColor(self, colorKey):
474 self.trUtf8("Select output directory for QtHelp files"), 475 self.trUtf8("Select output directory for QtHelp files"),
475 self.qtHelpDirEdit.text(), 476 self.qtHelpDirEdit.text(),
476 E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) 477 E5FileDialog.Options(E5FileDialog.ShowDirsOnly))
477 478
478 if directory: 479 if directory:
479 # make it relative, if it is a subdirectory of the project path 480 # make it relative, if it is a subdirectory of the project path
480 dn = Utilities.toNativeSeparators(directory) 481 dn = Utilities.toNativeSeparators(directory)
481 dn = self.project.getRelativePath(dn) 482 dn = self.project.getRelativePath(dn)
482 while dn.endswith(os.sep): 483 while dn.endswith(os.sep):
483 dn = dn[:-1] 484 dn = dn[:-1]
484 self.qtHelpDirEdit.setText(dn) 485 self.qtHelpDirEdit.setText(dn)
485 486
486 def accept(self): 487 def accept(self):
487 """ 488 """
488 Protected slot called by the Ok button. 489 Protected slot called by the Ok button.
489 490
490 It saves the values in the parameters dictionary. 491 It saves the values in the parameters dictionary.
491 """ 492 """
492 self.parameters['useRecursion'] = self.recursionCheckBox.isChecked() 493 self.parameters['useRecursion'] = self.recursionCheckBox.isChecked()
493 self.parameters['noindex'] = self.noindexCheckBox.isChecked() 494 self.parameters['noindex'] = self.noindexCheckBox.isChecked()

eric ide

mercurial