eric6/Project/AddDirectoryDialog.py

changeset 8151
8c1445825e7b
parent 7923
91e843545d9a
child 8218
7c09585bd960
diff -r fc1ae39af8c9 -r 8c1445825e7b eric6/Project/AddDirectoryDialog.py
--- a/eric6/Project/AddDirectoryDialog.py	Thu Mar 04 17:44:41 2021 +0100
+++ b/eric6/Project/AddDirectoryDialog.py	Thu Mar 04 17:48:09 2021 +0100
@@ -42,7 +42,7 @@
         
         self.ppath = pro.ppath
         self.targetDirPicker.setText(self.ppath)
-        self.on_filterComboBox_highlighted('(*.py)')
+        self.on_filterComboBox_highlighted(0)
         # enable all dialog elements
         if fileTypeFilter == 'source':  # it is a source file
             self.filterComboBox.addItem(
@@ -62,7 +62,8 @@
         elif fileTypeFilter == 'others':
             self.filterComboBox.addItem(
                 self.tr("Other Files (*)"), "OTHERS")
-            self.on_filterComboBox_highlighted('(*)')
+            self.on_filterComboBox_highlighted(
+                self.filterComboBox.count() - 1)
         else:
             self.filterComboBox.addItem(
                 self.tr("Source Files"), "SOURCES")
@@ -81,14 +82,17 @@
         msh = self.minimumSizeHint()
         self.resize(max(self.width(), msh.width()), msh.height())
         
-    @pyqtSlot(str)
-    def on_filterComboBox_highlighted(self, fileType):
+    @pyqtSlot(int)
+    def on_filterComboBox_highlighted(self, index):
         """
         Private slot to handle the selection of a file type.
         
-        @param fileType the selected file type (string)
+        @param index index of the selected entry
+        @type int
         """
-        if fileType.endswith('(*)'):
+        fileType = self.filterComboBox.itemData(index)
+        
+        if fileType == "OTHERS":
             self.targetDirLabel.setEnabled(False)
             self.targetDirPicker.setEnabled(False)
             self.recursiveCheckBox.setEnabled(False)

eric ide

mercurial