23 |
23 |
24 class AddProjectDialog(QDialog, Ui_AddProjectDialog): |
24 class AddProjectDialog(QDialog, Ui_AddProjectDialog): |
25 """ |
25 """ |
26 Class implementing the add project dialog. |
26 Class implementing the add project dialog. |
27 """ |
27 """ |
28 def __init__(self, parent=None, startdir=None, project=None, |
28 def __init__(self, parent=None, startdir="", project=None, |
29 categories=None): |
29 categories=None, category=""): |
30 """ |
30 """ |
31 Constructor |
31 Constructor |
32 |
32 |
33 @param parent parent widget of this dialog (QWidget) |
33 @param parent parent widget of this dialog |
34 @param startdir start directory for the selection dialog (string) |
34 @type QWidget |
|
35 @param startdir start directory for the selection dialog |
|
36 @type str |
35 @param project dictionary containing project data |
37 @param project dictionary containing project data |
36 @param categories list of already used categories (list of string) |
38 @type dict |
|
39 @param categories list of already used categories |
|
40 @type list of str |
|
41 @param category category to be preset |
|
42 @type str |
37 """ |
43 """ |
38 super(AddProjectDialog, self).__init__(parent) |
44 super(AddProjectDialog, self).__init__(parent) |
39 self.setupUi(self) |
45 self.setupUi(self) |
40 |
46 |
41 self.filenamePicker.setMode(E5PathPickerModes.OpenFileMode) |
47 self.filenamePicker.setMode(E5PathPickerModes.OpenFileMode) |
42 self.filenamePicker.setFilters(self.tr("Project Files (*.e4p)")) |
48 self.filenamePicker.setFilters(self.tr("Project Files (*.e4p)")) |
43 |
49 |
44 if categories: |
50 if categories: |
45 self.categoryComboBox.addItem("") |
51 self.categoryComboBox.addItem("") |
46 self.categoryComboBox.addItems(sorted(categories)) |
52 self.categoryComboBox.addItems(sorted(categories)) |
|
53 self.categoryComboBox.setEditText(category) |
47 |
54 |
48 self.startdir = startdir |
55 self.startdir = startdir |
49 self.uid = "" |
56 self.uid = "" |
50 |
57 |
51 self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) |
58 self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) |