--- a/eric7/Project/PropertiesDialog.py Mon Jun 06 16:34:37 2022 +0200 +++ b/eric7/Project/PropertiesDialog.py Fri Jul 01 11:02:32 2022 +0200 @@ -10,6 +10,8 @@ import contextlib import os +import trove_classifiers + from PyQt6.QtCore import QDir, pyqtSlot from PyQt6.QtWidgets import QDialog, QDialogButtonBox @@ -89,6 +91,9 @@ Utilities.fromNativeSeparators(ipath) + "/", ] + self.licenseComboBox.lineEdit().setClearButtonEnabled(True) + self.__populateLicenseComboBox() + if not new: name = os.path.splitext(self.project.pfile)[0] self.nameEdit.setText(os.path.basename(name)) @@ -140,9 +145,11 @@ cindex = self.testingFrameworkComboBox.findData( self.project.pdata["TESTING_FRAMEWORK"]) self.testingFrameworkComboBox.setCurrentIndex(cindex) + with contextlib.suppress(KeyError): + self.licenseComboBox.setCurrentText( + self.project.pdata["LICENSE"]) else: - self.languageComboBox.setCurrentIndex( - self.languageComboBox.findText("Python3")) + self.languageComboBox.setCurrentText("Python3") self.projectTypeComboBox.setCurrentIndex( self.projectTypeComboBox.findData("PyQt6")) self.dirPicker.setText(self.__initPaths[0]) @@ -156,6 +163,18 @@ bool(self.dirPicker.text()) and self.dirPicker.text() not in self.__initPaths) + def __populateLicenseComboBox(self): + """ + Private method to populate the license selector with the list of trove + license types. + """ + self.licenseComboBox.addItem("") + self.licenseComboBox.addItems(sorted( + classifier.split("::")[-1].strip() + for classifier in trove_classifiers.classifiers + if classifier.startswith("License ::") + )) + @pyqtSlot(str) def on_languageComboBox_currentTextChanged(self, language): """ @@ -353,3 +372,9 @@ self.project.pdata["TESTING_FRAMEWORK"] = ( self.testingFrameworkComboBox.currentData() ) + + self.project.pdata["TESTING_FRAMEWORK"] = ( + self.testingFrameworkComboBox.currentData() + ) + + self.project.pdata["LICENSE"] = self.licenseComboBox.currentText()