eric7/Project/PropertiesDialog.py

branch
eric7
changeset 9175
21e2be5f0b41
parent 9141
7085ece52151
child 9192
a763d57e23bc
equal deleted inserted replaced
9174:ce3ee8851fa1 9175:21e2be5f0b41
8 """ 8 """
9 9
10 import contextlib 10 import contextlib
11 import os 11 import os
12 12
13 import trove_classifiers
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 import EricMessageBox
17 from EricWidgets.EricApplication import ericApp 18 from EricWidgets.EricApplication import ericApp
18 from EricWidgets.EricPathPicker import EricPathPickerModes 19 from EricWidgets.EricPathPicker import EricPathPickerModes
19 20
20 from .Ui_PropertiesDialog import Ui_PropertiesDialog 21 from .Ui_PropertiesDialog import Ui_PropertiesDialog
21 22
164 165
165 def __populateLicenseComboBox(self): 166 def __populateLicenseComboBox(self):
166 """ 167 """
167 Private method to populate the license selector with the list of trove 168 Private method to populate the license selector with the list of trove
168 license types. 169 license types.
169 170 """
170 Note: The trove licanese list file was created from querying
171 "https://pypi.org/pypi?%3Aaction=list_classifiers".
172 """
173 filename = os.path.join(
174 os.path.dirname(__file__), "..", "data",
175 "trove_license_classifiers.txt")
176 try:
177 with open(filename, "r") as f:
178 lines = f.readlines()
179 except OSError as err:
180 EricMessageBox.warning(
181 self,
182 self.tr("Reading Trove License Classifiers"),
183 self.tr("""<p>The Trove License Classifiers file <b>{0}</b>"""
184 """ could not be read.</p><p>Reason: {1}</p>""")
185 .format(filename, str(err)))
186 return
187
188 self.licenseComboBox.addItem("") 171 self.licenseComboBox.addItem("")
189 self.licenseComboBox.addItems(sorted( 172 self.licenseComboBox.addItems(sorted(
190 line.split("::")[-1].strip() 173 classifier.split("::")[-1].strip()
191 for line in lines 174 for classifier in trove_classifiers.classifiers
192 if line.startswith("License ") # play it safe 175 if classifier.startswith("License ::")
193 )) 176 ))
194 177
195 @pyqtSlot(str) 178 @pyqtSlot(str)
196 def on_languageComboBox_currentTextChanged(self, language): 179 def on_languageComboBox_currentTextChanged(self, language):
197 """ 180 """

eric ide

mercurial