eric7/Project/PropertiesDialog.py

branch
unittest
changeset 9074
1afb90182258
parent 9066
a219ade50f7c
child 9108
19a57544f32c
--- a/eric7/Project/PropertiesDialog.py	Wed May 18 09:19:09 2022 +0200
+++ b/eric7/Project/PropertiesDialog.py	Wed May 18 10:54:32 2022 +0200
@@ -55,10 +55,10 @@
             getSupportedDocstringTypes()
         ):
             self.docstringStyleComboBox.addItem(docstringStyle, docstringType)
-        
-        self.testingFrameworkComboBox.addItem(self.tr("None"), "")
-        for framework in sorted(FrameworkNames):
-            self.testingFrameworkComboBox.addItem(framework, framework)
+##        
+##        self.testingFrameworkComboBox.addItem(self.tr("None"), "")
+##        for framework in sorted(FrameworkNames):
+##            self.testingFrameworkComboBox.addItem(framework, framework)
         
         self.project = project
         self.newProject = new
@@ -160,29 +160,36 @@
             bool(self.dirPicker.text()) and
             self.dirPicker.text() not in self.__initPaths)
     
-    @pyqtSlot(int)
-    def on_languageComboBox_currentIndexChanged(self, index):
+    @pyqtSlot(str)
+    def on_languageComboBox_currentTextChanged(self, language):
         """
         Private slot handling the selection of a programming language.
         
-        @param index index of the current item
-        @type int
+        @param language text of the current item
+        @type str
         """
-        language = self.languageComboBox.itemText(index)
         curProjectType = self.getProjectType()
         
-        projectTypes = []
-        for projectTypeItem in self.project.getProjectTypes(language).items():
-            projectTypes.append((projectTypeItem[1], projectTypeItem[0]))
         self.projectTypeComboBox.clear()
-        for projectType in sorted(projectTypes):
+        for projectType in sorted(
+            self.project.getProjectTypes(language).items(),
+            key=lambda k: k[1]
+        ):
             self.projectTypeComboBox.addItem(
-                projectType[0], projectType[1])
+                projectType[1], projectType[0])
         
         index = self.projectTypeComboBox.findData(curProjectType)
         if index == -1:
             index = 0
         self.projectTypeComboBox.setCurrentIndex(index)
+        
+        curTestingFramework = self.testingFrameworkComboBox.currentText()
+        self.testingFrameworkComboBox.clear()
+        self.testingFrameworkComboBox.addItem(self.tr("None"), "")
+        with contextlib.suppress(KeyError):
+            for framework in sorted(FrameworkNames[language]):
+                self.testingFrameworkComboBox.addItem(framework, framework)
+        self.testingFrameworkComboBox.setCurrentText(curTestingFramework)
     
     @pyqtSlot(str)
     def on_dirPicker_textChanged(self, txt):

eric ide

mercurial