eric7/Project/PropertiesDialog.py

branch
eric7-maintenance
changeset 9192
a763d57e23bc
parent 9111
4ac66b6c33a4
parent 9175
21e2be5f0b41
child 9197
301be1e80ad6
equal deleted inserted replaced
9137:bd90cbe0b7d2 9192:a763d57e23bc
7 Module implementing the project properties dialog. 7 Module implementing the project properties dialog.
8 """ 8 """
9 9
10 import contextlib 10 import contextlib
11 import os 11 import os
12
13 import trove_classifiers
12 14
13 from PyQt6.QtCore import QDir, pyqtSlot 15 from PyQt6.QtCore import QDir, pyqtSlot
14 from PyQt6.QtWidgets import QDialog, QDialogButtonBox 16 from PyQt6.QtWidgets import QDialog, QDialogButtonBox
15 17
16 from EricWidgets.EricApplication import ericApp 18 from EricWidgets.EricApplication import ericApp
86 ) 88 )
87 self.__initPaths = [ 89 self.__initPaths = [
88 Utilities.fromNativeSeparators(ipath), 90 Utilities.fromNativeSeparators(ipath),
89 Utilities.fromNativeSeparators(ipath) + "/", 91 Utilities.fromNativeSeparators(ipath) + "/",
90 ] 92 ]
93
94 self.licenseComboBox.lineEdit().setClearButtonEnabled(True)
95 self.__populateLicenseComboBox()
91 96
92 if not new: 97 if not new:
93 name = os.path.splitext(self.project.pfile)[0] 98 name = os.path.splitext(self.project.pfile)[0]
94 self.nameEdit.setText(os.path.basename(name)) 99 self.nameEdit.setText(os.path.basename(name))
95 self.languageComboBox.setCurrentIndex( 100 self.languageComboBox.setCurrentIndex(
138 self.docstringStyleComboBox.setCurrentIndex(cindex) 143 self.docstringStyleComboBox.setCurrentIndex(cindex)
139 with contextlib.suppress(KeyError): 144 with contextlib.suppress(KeyError):
140 cindex = self.testingFrameworkComboBox.findData( 145 cindex = self.testingFrameworkComboBox.findData(
141 self.project.pdata["TESTING_FRAMEWORK"]) 146 self.project.pdata["TESTING_FRAMEWORK"])
142 self.testingFrameworkComboBox.setCurrentIndex(cindex) 147 self.testingFrameworkComboBox.setCurrentIndex(cindex)
148 with contextlib.suppress(KeyError):
149 self.licenseComboBox.setCurrentText(
150 self.project.pdata["LICENSE"])
143 else: 151 else:
144 self.languageComboBox.setCurrentIndex( 152 self.languageComboBox.setCurrentText("Python3")
145 self.languageComboBox.findText("Python3"))
146 self.projectTypeComboBox.setCurrentIndex( 153 self.projectTypeComboBox.setCurrentIndex(
147 self.projectTypeComboBox.findData("PyQt6")) 154 self.projectTypeComboBox.findData("PyQt6"))
148 self.dirPicker.setText(self.__initPaths[0]) 155 self.dirPicker.setText(self.__initPaths[0])
149 self.versionEdit.setText('0.1') 156 self.versionEdit.setText('0.1')
150 self.vcsLabel.hide() 157 self.vcsLabel.hide()
153 self.vcsCheckBox.hide() 160 self.vcsCheckBox.hide()
154 161
155 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( 162 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(
156 bool(self.dirPicker.text()) and 163 bool(self.dirPicker.text()) and
157 self.dirPicker.text() not in self.__initPaths) 164 self.dirPicker.text() not in self.__initPaths)
165
166 def __populateLicenseComboBox(self):
167 """
168 Private method to populate the license selector with the list of trove
169 license types.
170 """
171 self.licenseComboBox.addItem("")
172 self.licenseComboBox.addItems(sorted(
173 classifier.split("::")[-1].strip()
174 for classifier in trove_classifiers.classifiers
175 if classifier.startswith("License ::")
176 ))
158 177
159 @pyqtSlot(str) 178 @pyqtSlot(str)
160 def on_languageComboBox_currentTextChanged(self, language): 179 def on_languageComboBox_currentTextChanged(self, language):
161 """ 180 """
162 Private slot handling the selection of a programming language. 181 Private slot handling the selection of a programming language.
351 ) 370 )
352 371
353 self.project.pdata["TESTING_FRAMEWORK"] = ( 372 self.project.pdata["TESTING_FRAMEWORK"] = (
354 self.testingFrameworkComboBox.currentData() 373 self.testingFrameworkComboBox.currentData()
355 ) 374 )
375
376 self.project.pdata["TESTING_FRAMEWORK"] = (
377 self.testingFrameworkComboBox.currentData()
378 )
379
380 self.project.pdata["LICENSE"] = self.licenseComboBox.currentText()

eric ide

mercurial