eric6/Project/AddDirectoryDialog.py

changeset 8151
8c1445825e7b
parent 7923
91e843545d9a
child 8218
7c09585bd960
equal deleted inserted replaced
8150:fc1ae39af8c9 8151:8c1445825e7b
40 self.targetDirPicker.setMode(E5PathPickerModes.DirectoryMode) 40 self.targetDirPicker.setMode(E5PathPickerModes.DirectoryMode)
41 self.targetDirPicker.setDefaultDirectory(startdir) 41 self.targetDirPicker.setDefaultDirectory(startdir)
42 42
43 self.ppath = pro.ppath 43 self.ppath = pro.ppath
44 self.targetDirPicker.setText(self.ppath) 44 self.targetDirPicker.setText(self.ppath)
45 self.on_filterComboBox_highlighted('(*.py)') 45 self.on_filterComboBox_highlighted(0)
46 # enable all dialog elements 46 # enable all dialog elements
47 if fileTypeFilter == 'source': # it is a source file 47 if fileTypeFilter == 'source': # it is a source file
48 self.filterComboBox.addItem( 48 self.filterComboBox.addItem(
49 self.tr("Source Files"), "SOURCES") 49 self.tr("Source Files"), "SOURCES")
50 elif fileTypeFilter == 'form': 50 elif fileTypeFilter == 'form':
60 self.filterComboBox.addItem( 60 self.filterComboBox.addItem(
61 self.tr("Protocol Files"), "PROTOCOLS") 61 self.tr("Protocol Files"), "PROTOCOLS")
62 elif fileTypeFilter == 'others': 62 elif fileTypeFilter == 'others':
63 self.filterComboBox.addItem( 63 self.filterComboBox.addItem(
64 self.tr("Other Files (*)"), "OTHERS") 64 self.tr("Other Files (*)"), "OTHERS")
65 self.on_filterComboBox_highlighted('(*)') 65 self.on_filterComboBox_highlighted(
66 self.filterComboBox.count() - 1)
66 else: 67 else:
67 self.filterComboBox.addItem( 68 self.filterComboBox.addItem(
68 self.tr("Source Files"), "SOURCES") 69 self.tr("Source Files"), "SOURCES")
69 self.filterComboBox.addItem( 70 self.filterComboBox.addItem(
70 self.tr("Forms Files"), "FORMS") 71 self.tr("Forms Files"), "FORMS")
79 self.filterComboBox.setCurrentIndex(0) 80 self.filterComboBox.setCurrentIndex(0)
80 81
81 msh = self.minimumSizeHint() 82 msh = self.minimumSizeHint()
82 self.resize(max(self.width(), msh.width()), msh.height()) 83 self.resize(max(self.width(), msh.width()), msh.height())
83 84
84 @pyqtSlot(str) 85 @pyqtSlot(int)
85 def on_filterComboBox_highlighted(self, fileType): 86 def on_filterComboBox_highlighted(self, index):
86 """ 87 """
87 Private slot to handle the selection of a file type. 88 Private slot to handle the selection of a file type.
88 89
89 @param fileType the selected file type (string) 90 @param index index of the selected entry
91 @type int
90 """ 92 """
91 if fileType.endswith('(*)'): 93 fileType = self.filterComboBox.itemData(index)
94
95 if fileType == "OTHERS":
92 self.targetDirLabel.setEnabled(False) 96 self.targetDirLabel.setEnabled(False)
93 self.targetDirPicker.setEnabled(False) 97 self.targetDirPicker.setEnabled(False)
94 self.recursiveCheckBox.setEnabled(False) 98 self.recursiveCheckBox.setEnabled(False)
95 else: 99 else:
96 self.targetDirLabel.setEnabled(True) 100 self.targetDirLabel.setEnabled(True)

eric ide

mercurial