15 |
15 |
16 from .Ui_AddDirectoryDialog import Ui_AddDirectoryDialog |
16 from .Ui_AddDirectoryDialog import Ui_AddDirectoryDialog |
17 |
17 |
18 import Utilities |
18 import Utilities |
19 |
19 |
|
20 |
20 class AddDirectoryDialog(QDialog, Ui_AddDirectoryDialog): |
21 class AddDirectoryDialog(QDialog, Ui_AddDirectoryDialog): |
21 """ |
22 """ |
22 Class implementing a dialog to add files of a directory to the project. |
23 Class implementing a dialog to add files of a directory to the project. |
23 """ |
24 """ |
24 def __init__(self, pro, filter = 'source', parent = None, name = None, |
25 def __init__(self, pro, filter='source', parent=None, name=None, |
25 startdir = None): |
26 startdir=None): |
26 """ |
27 """ |
27 Constructor |
28 Constructor |
28 |
29 |
29 @param pro reference to the project object |
30 @param pro reference to the project object |
30 @param filter file type filter (string) |
31 @param filter file type filter (string) |
31 @param parent parent widget of this dialog (QWidget) |
32 @param parent parent widget of this dialog (QWidget) |
32 @param name name of this dialog (string) |
33 @param name name of this dialog (string) |
33 @param startdir start directory for the selection dialog |
34 @param startdir start directory for the selection dialog |
34 """ |
35 """ |
35 QDialog.__init__(self,parent) |
36 QDialog.__init__(self, parent) |
36 if name: |
37 if name: |
37 self.setObjectName(name) |
38 self.setObjectName(name) |
38 self.setupUi(self) |
39 self.setupUi(self) |
39 |
40 |
40 self.sourceDirCompleter = E5DirCompleter(self.sourceDirEdit) |
41 self.sourceDirCompleter = E5DirCompleter(self.sourceDirEdit) |
41 self.targetDirCompleter = E5DirCompleter(self.targetDirEdit) |
42 self.targetDirCompleter = E5DirCompleter(self.targetDirEdit) |
42 |
43 |
43 self.ppath = pro.ppath |
44 self.ppath = pro.ppath |
44 self.targetDirEdit.setText(self.ppath) |
45 self.targetDirEdit.setText(self.ppath) |
45 self.startdir = startdir |
46 self.startdir = startdir |
46 self.on_filterComboBox_highlighted('(*.py)') # enable all dialog elements |
47 self.on_filterComboBox_highlighted('(*.py)') # enable all dialog elements |
47 if filter == 'source': # it is a source file |
48 if filter == 'source': # it is a source file |
48 self.filterComboBox.addItem(self.trUtf8("Source Files"), "SOURCES") |
49 self.filterComboBox.addItem(self.trUtf8("Source Files"), "SOURCES") |
49 elif filter == 'form': |
50 elif filter == 'form': |
50 self.filterComboBox.addItem(self.trUtf8("Forms Files"), "FORMS") |
51 self.filterComboBox.addItem(self.trUtf8("Forms Files"), "FORMS") |
51 elif filter == 'resource': |
52 elif filter == 'resource': |
137 the selected file type, the source and target directory and |
138 the selected file type, the source and target directory and |
138 a flag indicating a recursive add |
139 a flag indicating a recursive add |
139 """ |
140 """ |
140 filetype = \ |
141 filetype = \ |
141 self.filterComboBox.itemData(self.filterComboBox.currentIndex()) |
142 self.filterComboBox.itemData(self.filterComboBox.currentIndex()) |
142 return (filetype, self.sourceDirEdit.text(), |
143 return (filetype, self.sourceDirEdit.text(), |
143 self.targetDirEdit.text(), |
144 self.targetDirEdit.text(), |
144 self.recursiveCheckBox.isChecked()) |
145 self.recursiveCheckBox.isChecked()) |