Plugins/DocumentationPlugins/Ericdoc/EricdocConfigDialog.py

changeset 248
f4561c24989a
parent 55
b5c84934de9c
child 253
3ccdf551bde7
equal deleted inserted replaced
247:b3da30a52337 248:f4561c24989a
24 24
25 class EricdocConfigDialog(QDialog, Ui_EricdocConfigDialog): 25 class EricdocConfigDialog(QDialog, Ui_EricdocConfigDialog):
26 """ 26 """
27 Class implementing a dialog to enter the parameters for eric5-doc. 27 Class implementing a dialog to enter the parameters for eric5-doc.
28 """ 28 """
29 def __init__(self, ppath, parms = None, parent = None): 29 def __init__(self, project, parms = None, parent = None):
30 """ 30 """
31 Constructor 31 Constructor
32 32
33 @param ppath project path of the current project (string) 33 @param project reference to the project object (Project.Project)
34 @param parms parameters to set in the dialog 34 @param parms parameters to set in the dialog
35 @param parent parent widget of this dialog 35 @param parent parent widget of this dialog
36 """ 36 """
37 QDialog.__init__(self,parent) 37 QDialog.__init__(self,parent)
38 self.setupUi(self) 38 self.setupUi(self)
70 if key.endswith("Color"): 70 if key.endswith("Color"):
71 self.colors[key] = parms[key] 71 self.colors[key] = parms[key]
72 else: 72 else:
73 self.parameters[key] = parms[key] 73 self.parameters[key] = parms[key]
74 74
75 self.ppath = ppath 75 self.ppath = project.getProjectPath()
76 self.project = project
76 77
77 self.outputDirCompleter = E5DirCompleter(self.outputDirEdit) 78 self.outputDirCompleter = E5DirCompleter(self.outputDirEdit)
78 self.ignoreDirCompleter = E5DirCompleter(self.ignoreDirEdit) 79 self.ignoreDirCompleter = E5DirCompleter(self.ignoreDirEdit)
79 self.qtHelpDirCompleter = E5DirCompleter(self.qtHelpDirEdit) 80 self.qtHelpDirCompleter = E5DirCompleter(self.qtHelpDirEdit)
80 81
245 QFileDialog.Options(QFileDialog.ShowDirsOnly)) 246 QFileDialog.Options(QFileDialog.ShowDirsOnly))
246 247
247 if directory: 248 if directory:
248 # make it relative, if it is a subdirectory of the project path 249 # make it relative, if it is a subdirectory of the project path
249 dn = Utilities.toNativeSeparators(directory) 250 dn = Utilities.toNativeSeparators(directory)
250 dn = dn.replace(self.ppath + os.sep, '') 251 dn = self.project.getRelativePath(dn)
251 while dn.endswith(os.sep): 252 while dn.endswith(os.sep):
252 dn = dn[:-1] 253 dn = dn[:-1]
253 self.outputDirEdit.setText(dn) 254 self.outputDirEdit.setText(dn)
254 255
255 @pyqtSlot() 256 @pyqtSlot()
270 QFileDialog.Options(QFileDialog.ShowDirsOnly)) 271 QFileDialog.Options(QFileDialog.ShowDirsOnly))
271 272
272 if directory: 273 if directory:
273 # make it relative, if it is a subdirectory of the project path 274 # make it relative, if it is a subdirectory of the project path
274 dn = Utilities.toNativeSeparators(directory) 275 dn = Utilities.toNativeSeparators(directory)
275 dn = dn.replace(self.ppath + os.sep, '') 276 dn = self.project.getRelativePath(dn)
276 while dn.endswith(os.sep): 277 while dn.endswith(os.sep):
277 dn = dn[:-1] 278 dn = dn[:-1]
278 self.ignoreDirEdit.setText(dn) 279 self.ignoreDirEdit.setText(dn)
279 280
280 @pyqtSlot() 281 @pyqtSlot()
308 self.trUtf8("Style sheet (*.css);;All files (*)")) 309 self.trUtf8("Style sheet (*.css);;All files (*)"))
309 310
310 if cssFile: 311 if cssFile:
311 # make it relative, if it is in a subdirectory of the project path 312 # make it relative, if it is in a subdirectory of the project path
312 cf = Utilities.toNativeSeparators(cssFile) 313 cf = Utilities.toNativeSeparators(cssFile)
313 cf = cf.replace(self.ppath + os.sep, '') 314 cf = self.project.getRelativePath(cf)
314 self.cssEdit.setText(cf) 315 self.cssEdit.setText(cf)
315 316
316 def __selectColor(self, colorKey): 317 def __selectColor(self, colorKey):
317 """ 318 """
318 Private method to select a color. 319 Private method to select a color.
456 QFileDialog.Options(QFileDialog.ShowDirsOnly)) 457 QFileDialog.Options(QFileDialog.ShowDirsOnly))
457 458
458 if directory: 459 if directory:
459 # make it relative, if it is a subdirectory of the project path 460 # make it relative, if it is a subdirectory of the project path
460 dn = Utilities.toNativeSeparators(directory) 461 dn = Utilities.toNativeSeparators(directory)
461 dn = dn.replace(self.ppath + os.sep, '') 462 dn = self.project.getRelativePath(dn)
462 while dn.endswith(os.sep): 463 while dn.endswith(os.sep):
463 dn = dn[:-1] 464 dn = dn[:-1]
464 self.qtHelpDirEdit.setText(dn) 465 self.qtHelpDirEdit.setText(dn)
465 466
466 def accept(self): 467 def accept(self):

eric ide

mercurial