40 self.sourceDirPicker.setMode(EricPathPickerModes.DIRECTORY_MODE) |
40 self.sourceDirPicker.setMode(EricPathPickerModes.DIRECTORY_MODE) |
41 self.sourceDirPicker.setDefaultDirectory(startdir) |
41 self.sourceDirPicker.setDefaultDirectory(startdir) |
42 self.targetDirPicker.setMode(EricPathPickerModes.DIRECTORY_MODE) |
42 self.targetDirPicker.setMode(EricPathPickerModes.DIRECTORY_MODE) |
43 self.targetDirPicker.setDefaultDirectory(startdir) |
43 self.targetDirPicker.setDefaultDirectory(startdir) |
44 |
44 |
45 self.ppath = pro.ppath |
45 self.__project = pro |
46 self.targetDirPicker.setText(self.ppath) |
46 self.targetDirPicker.setText(self.__project.getProjectPath()) |
47 self.on_filterComboBox_highlighted(0) |
47 |
48 # enable all dialog elements |
48 if fileTypeFilter and fileTypeFilter != "TRANSLATIONS": |
49 if fileTypeFilter == "source": # it is a source file |
49 self.filterComboBox.addItem( |
50 self.filterComboBox.addItem(self.tr("Source Files"), "SOURCES") |
50 self.__project.getFileCategoryString(fileTypeFilter), |
51 elif fileTypeFilter == "form": |
51 fileTypeFilter, |
52 self.filterComboBox.addItem(self.tr("Forms Files"), "FORMS") |
52 ) |
53 elif fileTypeFilter == "resource": |
|
54 self.filterComboBox.addItem(self.tr("Resource Files"), "RESOURCES") |
|
55 elif fileTypeFilter == "interface": |
|
56 self.filterComboBox.addItem(self.tr("Interface Files"), "INTERFACES") |
|
57 elif fileTypeFilter == "protocol": |
|
58 self.filterComboBox.addItem(self.tr("Protocol Files"), "PROTOCOLS") |
|
59 elif fileTypeFilter == "others": |
|
60 self.filterComboBox.addItem(self.tr("Other Files (*)"), "OTHERS") |
|
61 self.on_filterComboBox_highlighted(self.filterComboBox.count() - 1) |
|
62 else: |
53 else: |
63 self.filterComboBox.addItem(self.tr("Source Files"), "SOURCES") |
54 for fileCategory in sorted( |
64 self.filterComboBox.addItem(self.tr("Forms Files"), "FORMS") |
55 c for c in self.__project.getFileCategories() |
65 self.filterComboBox.addItem(self.tr("Resource Files"), "RESOURCES") |
56 if c != "TRANSLATIONS" |
66 self.filterComboBox.addItem(self.tr("Interface Files"), "INTERFACES") |
57 ): |
67 self.filterComboBox.addItem(self.tr("Protocol Files"), "PROTOCOLS") |
58 self.filterComboBox.addItem( |
68 self.filterComboBox.addItem(self.tr("Other Files (*)"), "OTHERS") |
59 self.__project.getFileCategoryString(fileCategory), |
|
60 fileCategory, |
|
61 ) |
69 self.filterComboBox.setCurrentIndex(0) |
62 self.filterComboBox.setCurrentIndex(0) |
70 |
63 |
71 msh = self.minimumSizeHint() |
64 msh = self.minimumSizeHint() |
72 self.resize(max(self.width(), msh.width()), msh.height()) |
65 self.resize(max(self.width(), msh.width()), msh.height()) |
73 |
66 |
74 @pyqtSlot(int) |
67 @pyqtSlot(int) |
75 def on_filterComboBox_highlighted(self, index): |
68 def on_filterComboBox_currentIndexChanged(self, index): |
76 """ |
69 """ |
77 Private slot to handle the selection of a file type. |
70 Private slot to handle the selection of a file type. |
78 |
71 |
79 @param index index of the selected entry |
72 @param index index of the selected entry |
80 @type int |
73 @type int |