Wed, 02 Apr 2025 16:46:15 +0200
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
11090
f5f5f5803935
Updated copyright for 2025.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10621
diff
changeset
|
3 | # Copyright (c) 2013 - 2025 Detlev Offenbach <detlev@die-offenbachs.de> |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing the setup.py wizard dialog. |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
9201 | 10 | import configparser |
11 | import datetime | |
12 | import io | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | import os |
9201 | 14 | import pathlib |
15 | ||
11203
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
16 | import spdx_license_list |
9201 | 17 | import tomlkit |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
18 | import trove_classifiers |
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
19 | |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9433
diff
changeset
|
20 | from PyQt6.QtCore import Qt, pyqtSlot |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9433
diff
changeset
|
21 | from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QListWidgetItem, QTreeWidgetItem |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9514
diff
changeset
|
23 | from eric7 import Preferences |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9433
diff
changeset
|
24 | from eric7.EricWidgets import EricFileDialog |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
25 | from eric7.EricWidgets.EricApplication import ericApp |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
26 | from eric7.EricWidgets.EricPathPicker import EricPathPickerModes |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9514
diff
changeset
|
27 | from eric7.SystemUtilities import FileSystemUtilities, OSUtilities |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
28 | |
9201 | 29 | from .AddEntryPointDialog import AddEntryPointDialog |
30 | from .AddProjectUrlDialog import AddProjectUrlDialog | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
31 | from .Ui_SetupWizardDialog import Ui_SetupWizardDialog |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
32 | |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | class SetupWizardDialog(QDialog, Ui_SetupWizardDialog): |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | Class implementing the setup.py wizard dialog. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
37 | |
8757
23b2fe1cd863
Corrected the Setup wizard dialog and changed it to use the EricPathPicker widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8501
diff
changeset
|
38 | It displays a dialog for entering the parameters for the setup.py code |
23b2fe1cd863
Corrected the Setup wizard dialog and changed it to use the EricPathPicker widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8501
diff
changeset
|
39 | generator. |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
40 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
41 | |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
42 | def __init__(self, category, editor, parent=None): |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
43 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
44 | Constructor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
45 | |
9201 | 46 | @param category category of setup file to create |
47 | @type str | |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
48 | @param editor reference to the editor object to receive the code |
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
49 | @type Editor |
9201 | 50 | @param parent reference to the parent widget (defaults to None) |
51 | @type QWidget (optional) | |
52 | @exception ValueError raised for an illegal setup file category | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
53 | """ |
9201 | 54 | if category not in ("setup.py", "setup.cfg", "pyproject.toml"): |
55 | raise ValueError("illegal setup file category given") | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
56 | |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
57 | super().__init__(parent) |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
58 | self.setupUi(self) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
59 | |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
60 | self.setWindowTitle(self.tr("{0} Wizard").format(category)) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
61 | |
7005
342819f05839
setup.py Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
62 | self.__replies = [] |
9201 | 63 | self.__category = category |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
64 | self.__editor = editor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
65 | |
9201 | 66 | if category != "setup.py": |
67 | self.introCheckBox.setVisible(False) | |
68 | self.importCheckBox.setVisible(False) | |
69 | self.metaDataCheckBox.setVisible(False) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
70 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
71 | self.dataTabWidget.setCurrentIndex(0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
72 | |
8757
23b2fe1cd863
Corrected the Setup wizard dialog and changed it to use the EricPathPicker widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8501
diff
changeset
|
73 | self.packageRootPicker.setMode(EricPathPickerModes.DIRECTORY_MODE) |
23b2fe1cd863
Corrected the Setup wizard dialog and changed it to use the EricPathPicker widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8501
diff
changeset
|
74 | self.sourceDirectoryPicker.setMode(EricPathPickerModes.DIRECTORY_MODE) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
75 | |
8862
99459beb81b1
Adapted some style sheet usages to observe the palette lightness (dark/light).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8838
diff
changeset
|
76 | self.__mandatoryStyleSheet = ( |
99459beb81b1
Adapted some style sheet usages to observe the palette lightness (dark/light).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8838
diff
changeset
|
77 | "QLineEdit {border: 2px solid; border-color: #dd8888}" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
78 | if ericApp().usesDarkPalette() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
79 | else "QLineEdit {border: 2px solid; border-color: #800000}" |
8862
99459beb81b1
Adapted some style sheet usages to observe the palette lightness (dark/light).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8838
diff
changeset
|
80 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
81 | for lineEdit in [ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
82 | self.nameEdit, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
83 | self.versionEdit, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
84 | self.homePageUrlEdit, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
85 | self.authorEdit, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
86 | self.authorEmailEdit, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
87 | self.maintainerEdit, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
88 | self.maintainerEmailEdit, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
89 | ]: |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
90 | lineEdit.setStyleSheet(self.__mandatoryStyleSheet) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
91 | |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
92 | self.__populateClassifiers() |
11203
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
93 | if category == "pyproject.toml": |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
94 | self.licenseClassifierCheckBox.setText( |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
95 | self.tr("Select From SPDX License List") |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
96 | ) |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
97 | self.__populateSpdxLicenses() |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
98 | else: |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
99 | self.licenseClassifierCheckBox.setText( |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
100 | self.tr("Select From Trove License Classifiers") |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
101 | ) |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
102 | self.__populateTroveLicenses() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
103 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
104 | self.__okButton = self.buttonBox.button(QDialogButtonBox.StandardButton.Ok) |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
105 | self.__okButton.setEnabled(False) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
106 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
107 | projectOpen = ericApp().getObject("Project").isOpen() |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
108 | self.projectButton.setEnabled(projectOpen) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
109 | |
9201 | 110 | self.projectUrlsList.header().setSortIndicator(0, Qt.SortOrder.AscendingOrder) |
111 | self.entryPointsList.header().setSortIndicator(0, Qt.SortOrder.AscendingOrder) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
112 | |
9201 | 113 | self.descriptionContentTypeComboBox.addItem("", "") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
114 | for contentType, mimetype in sorted( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
115 | [ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
116 | (self.tr("Plain Text"), "text/plain"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
117 | (self.tr("Markdown"), "text/markdown"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
118 | (self.tr("reStructuredText"), "text/x-rst"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
119 | ] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
120 | ): |
9201 | 121 | self.descriptionContentTypeComboBox.addItem(contentType, mimetype) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
122 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
123 | self.homePageUrlEdit.textChanged.connect(self.__enableOkButton) |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
124 | self.nameEdit.textChanged.connect(self.__enableOkButton) |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
125 | self.versionEdit.textChanged.connect(self.__enableOkButton) |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
126 | self.authorEdit.textChanged.connect(self.__enableOkButton) |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
127 | self.authorEmailEdit.textChanged.connect(self.__enableOkButton) |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
128 | self.maintainerEdit.textChanged.connect(self.__enableOkButton) |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
129 | self.maintainerEmailEdit.textChanged.connect(self.__enableOkButton) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
130 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
131 | def __enableOkButton(self): |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
132 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
133 | Private slot to set the state of the OK button. |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
134 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
135 | enable = ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
136 | bool(self.nameEdit.text()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
137 | and bool(self.versionEdit.text()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
138 | and bool(self.homePageUrlEdit.text()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
139 | and ( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
140 | (bool(self.authorEdit.text()) and bool(self.authorEmailEdit.text())) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
141 | or ( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
142 | bool(self.maintainerEdit.text()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
143 | and bool(self.maintainerEmailEdit.text()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
144 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
145 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
146 | and self.homePageUrlEdit.text().startswith(("http://", "https://")) |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
147 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
148 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
149 | self.__okButton.setEnabled(enable) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
150 | |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
151 | def __populateClassifiers(self): |
7005
342819f05839
setup.py Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
152 | """ |
342819f05839
setup.py Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
153 | Private method to populate the classifiers. |
342819f05839
setup.py Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
154 | """ |
342819f05839
setup.py Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
155 | self.classifiersList.clear() |
342819f05839
setup.py Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
156 | self.developmentStatusComboBox.clear() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
157 | |
7005
342819f05839
setup.py Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
158 | self.developmentStatusComboBox.addItem("", "") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
159 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
160 | self.__classifiersDict = {} |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
161 | for classifier in trove_classifiers.sorted_classifiers: |
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
162 | if classifier.startswith("License ::"): |
11203
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
163 | # These are handled separately for setup.py and setup.cfg. |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
164 | continue |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
165 | elif classifier.startswith("Development Status ::"): |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
166 | self.developmentStatusComboBox.addItem( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
167 | classifier.split(" :: ")[1], classifier |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
168 | ) |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
169 | else: |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
170 | self.__addClassifierEntry(classifier) |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
171 | self.__classifiersDict = {} |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
172 | |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
173 | def __addClassifierEntry(self, classifier): |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
174 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
175 | Private method to add a new entry to the list of trove classifiers. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
176 | |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
177 | @param classifier classifier containing the data for the entry |
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
178 | @type str |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
179 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
180 | itm = None |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
181 | pitm = None |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
182 | dataList = classifier.split(" :: ") |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
183 | for index in range(len(dataList)): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
184 | key = " :: ".join(dataList[: index + 1]) |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
185 | if key not in self.__classifiersDict: |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
186 | if pitm is None: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
187 | itm = QTreeWidgetItem(self.classifiersList, [dataList[index]]) |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
188 | pitm = itm |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
189 | else: |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
190 | itm = QTreeWidgetItem(pitm, [dataList[index]]) |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
191 | itm.setExpanded(True) |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
192 | self.__classifiersDict[key] = itm |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
193 | else: |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
194 | pitm = self.__classifiersDict[key] |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
195 | itm.setCheckState(0, Qt.CheckState.Unchecked) |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
196 | itm.setData(0, Qt.ItemDataRole.UserRole, classifier) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
197 | |
11203
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
198 | def __populateTroveLicenses(self): |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
199 | """ |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
200 | Private method to populate the license selector for the creation of a |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
201 | setup.py or setup.cfg file. |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
202 | |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
203 | Note: These files are deprecated in favor of pyproject.toml. |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
204 | """ |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
205 | self.licenseClassifierComboBox.clear() |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
206 | |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
207 | for classifier in trove_classifiers.sorted_classifiers: |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
208 | if classifier.startswith("License ::"): |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
209 | self.licenseClassifierComboBox.addItem( |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
210 | "/".join(classifier.split(" :: ")[1:]), classifier |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
211 | ) |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
212 | |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
213 | self.licenseClassifierComboBox.setCurrentIndex( |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
214 | self.licenseClassifierComboBox.findText( |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
215 | "(GPLv3)", |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
216 | Qt.MatchFlag.MatchContains | Qt.MatchFlag.MatchCaseSensitive, |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
217 | ) |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
218 | ) |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
219 | |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
220 | def __populateSpdxLicenses(self): |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
221 | """ |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
222 | Private method to populate the license selector for the creation of a |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
223 | pyproject.toml file. |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
224 | """ |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
225 | self.licenseClassifierComboBox.clear() |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
226 | |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
227 | for spdxLicense in spdx_license_list.LICENSES.values(): |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
228 | if not spdxLicense.deprecated_id: |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
229 | self.licenseClassifierComboBox.addItem(spdxLicense.name, spdxLicense.id) |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
230 | |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
231 | self.licenseClassifierComboBox.setCurrentIndex( |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
232 | self.licenseClassifierComboBox.findData( |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
233 | "GPL-3.0", |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
234 | flags=Qt.MatchFlag.MatchStartsWith | Qt.MatchFlag.MatchCaseSensitive, |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
235 | ) |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
236 | ) |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
237 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
238 | def __getLicenseText(self): |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
239 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
240 | Private method to get the license text. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
241 | |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
242 | @return license text |
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
243 | @rtype str |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
244 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
245 | if not self.licenseClassifierCheckBox.isChecked(): |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
246 | return self.licenseEdit.text() |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
247 | else: |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
248 | lic = self.licenseClassifierComboBox.currentText() |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
249 | if "(" in lic: |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
250 | lic = lic.rsplit("(", 1)[1].split(")", 1)[0] |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
251 | return lic |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
252 | |
9201 | 253 | def __getSetupPyCode(self, indLevel, indString): |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
254 | """ |
9201 | 255 | Private method to get the source code for a 'setup.py' file. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
256 | |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
257 | @param indLevel indentation level |
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
258 | @type int |
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
259 | @param indString string used for indentation (space or tab) |
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
260 | @type str |
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
261 | @return generated code |
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
262 | @rtype str |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
263 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
264 | # Note: all paths are created with '/'; setup will do the right thing |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
265 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
266 | # calculate our indentation level and the indentation string |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
267 | il = indLevel + 1 |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
268 | istring = il * indString |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
269 | i1string = (il + 1) * indString |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
270 | i2string = (il + 2) * indString |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
271 | estring = os.linesep + indLevel * indString |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
272 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
273 | # now generate the code |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
274 | if self.introCheckBox.isChecked(): |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
275 | sourceCode = "#!/usr/bin/env python3{0}".format(os.linesep) |
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
276 | sourceCode += "# -*- coding: utf-8 -*-{0}{0}".format(os.linesep) |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
277 | else: |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
278 | sourceCode = "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
279 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
280 | if self.metaDataCheckBox.isChecked(): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
281 | sourceCode += "# metadata{0}".format(os.linesep) |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
282 | sourceCode += '"{0}"{1}'.format( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
283 | self.summaryEdit.text() or "Setup routine", os.linesep |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
284 | ) |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
285 | sourceCode += '__version__ = "{0}"{1}'.format( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
286 | self.versionEdit.text(), os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
287 | ) |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
288 | sourceCode += '__license__ = "{0}"{1}'.format( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
289 | self.__getLicenseText(), os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
290 | ) |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
291 | sourceCode += '__author__ = "{0}"{1}'.format( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
292 | self.authorEdit.text() or self.maintainerEdit.text(), os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
293 | ) |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
294 | sourceCode += '__email__ = "{0}"{1}'.format( |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
295 | self.authorEmailEdit.text() or self.maintainerEmailEdit.text(), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
296 | os.linesep, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
297 | ) |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
298 | sourceCode += '__url__ = "{0}"{1}'.format( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
299 | self.homePageUrlEdit.text(), os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
300 | ) |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
301 | sourceCode += '__date__ = "{0}"{1}'.format( |
10192
f457742dd3d6
Modified the datetime.datetime methods to include the 'tz' argument.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9673
diff
changeset
|
302 | datetime.datetime.now(tz=datetime.timezone.utc) |
f457742dd3d6
Modified the datetime.datetime methods to include the 'tz' argument.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9673
diff
changeset
|
303 | .isoformat() |
f457742dd3d6
Modified the datetime.datetime methods to include the 'tz' argument.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9673
diff
changeset
|
304 | .split(".")[0], |
f457742dd3d6
Modified the datetime.datetime methods to include the 'tz' argument.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9673
diff
changeset
|
305 | os.linesep, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
306 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
307 | sourceCode += '__prj__ = "{0}"{1}'.format(self.nameEdit.text(), os.linesep) |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
308 | sourceCode += os.linesep |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
309 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
310 | if self.importCheckBox.isChecked(): |
8501
7b5f10581c35
Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8366
diff
changeset
|
311 | additionalImport = ", find_packages" |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
312 | sourceCode += "from setuptools import setup{0}{1}".format( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
313 | additionalImport, os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
314 | ) |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
315 | if sourceCode: |
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
316 | sourceCode += "{0}{0}".format(os.linesep) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
317 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
318 | if self.descriptionFromFilesCheckBox.isChecked(): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
319 | sourceCode += "def get_long_description():{0}".format(os.linesep) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
320 | sourceCode += "{0}descr = []{1}".format(istring, os.linesep) |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
321 | sourceCode += '{0}for fname in ("{1}"):{2}'.format( |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
322 | istring, |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
323 | '", "'.join(self.descriptionEdit.toPlainText().splitlines()), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
324 | os.linesep, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
325 | ) |
9201 | 326 | sourceCode += ( |
327 | '{0}with open(fname, "r", encoding="utf-8") as f:{1}' | |
328 | ).format(i1string, os.linesep) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
329 | sourceCode += "{0}descr.append(f.read()){1}".format(i2string, os.linesep) |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
330 | sourceCode += '{0}return "\\n\\n".join(descr){1}'.format( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
331 | istring, os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
332 | ) |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
333 | sourceCode += "{0}{0}".format(os.linesep) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
334 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
335 | sourceCode += "setup({0}".format(os.linesep) |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
336 | sourceCode += '{0}name="{1}",{2}'.format( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
337 | istring, self.nameEdit.text(), os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
338 | ) |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
339 | sourceCode += '{0}version="{1}",{2}'.format( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
340 | istring, self.versionEdit.text(), os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
341 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
342 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
343 | if self.summaryEdit.text(): |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
344 | sourceCode += '{0}description="{1}",{2}'.format( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
345 | istring, self.summaryEdit.text(), os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
346 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
347 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
348 | if self.descriptionFromFilesCheckBox.isChecked(): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
349 | sourceCode += "{0}long_description=get_long_description(),{1}".format( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
350 | istring, os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
351 | ) |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
352 | elif self.descriptionEdit.toPlainText(): |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
353 | sourceCode += '{0}long_description="""{1}""",{2}'.format( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
354 | istring, self.descriptionEdit.toPlainText(), os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
355 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
356 | |
9201 | 357 | if self.descriptionContentTypeComboBox.currentData(): |
358 | sourceCode += '{0}long_description_content_type="{1}",{2}'.format( | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
359 | istring, self.descriptionContentTypeComboBox.currentData(), os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
360 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
361 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
362 | if self.authorEdit.text(): |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
363 | sourceCode += '{0}author="{1}",{2}'.format( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
364 | istring, self.authorEdit.text(), os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
365 | ) |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
366 | sourceCode += '{0}author_email="{1}",{2}'.format( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
367 | istring, self.authorEmailEdit.text(), os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
368 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
369 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
370 | if self.maintainerEdit.text(): |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
371 | sourceCode += '{0}maintainer="{1}",{2}'.format( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
372 | istring, self.maintainerEdit.text(), os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
373 | ) |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
374 | sourceCode += '{0}maintainer_email="{1}",{2}'.format( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
375 | istring, self.maintainerEmailEdit.text(), os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
376 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
377 | |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
378 | sourceCode += '{0}url="{1}",{2}'.format( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
379 | istring, self.homePageUrlEdit.text(), os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
380 | ) |
9201 | 381 | if self.downloadUrlEdit.text(): |
382 | sourceCode += '{0}download_url="{1}",{2}'.format( | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
383 | istring, self.downloadUrlEdit.text(), os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
384 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
385 | |
9201 | 386 | if self.projectUrlsList.topLevelItemCount(): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
387 | sourceCode += "{0}project_urls={{{1}".format(istring, os.linesep) |
9201 | 388 | for row in range(self.projectUrlsList.topLevelItemCount()): |
389 | urlItem = self.projectUrlsList.topLevelItem(row) | |
390 | sourceCode += '{0}"{1}": "{2}",{3}'.format( | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
391 | i1string, urlItem.text(0), urlItem.text(1), os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
392 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
393 | sourceCode += "{0}}},{1}".format(istring, os.linesep) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
394 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
395 | classifiers = [] |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
396 | if not self.licenseClassifierCheckBox.isChecked(): |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
397 | sourceCode += '{0}license="{1}",{2}'.format( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
398 | istring, self.licenseEdit.text(), os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
399 | ) |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
400 | else: |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
401 | classifiers.append( |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
402 | self.licenseClassifierComboBox.itemData( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
403 | self.licenseClassifierComboBox.currentIndex() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
404 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
405 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
406 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
407 | platforms = self.platformsEdit.toPlainText().splitlines() |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
408 | if platforms: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
409 | sourceCode += "{0}platforms=[{1}".format(istring, os.linesep) |
9433
6df1aeaa4529
Adjusted some wizard code generators to output Black compatible code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
410 | sourceCode += '{0}"{1}",{2}'.format( |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
411 | i1string, |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
412 | '",{0}{1}"'.format(os.linesep, i1string).join(platforms), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
413 | os.linesep, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
414 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
415 | sourceCode += "{0}],{1}".format(istring, os.linesep) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
416 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
417 | if self.developmentStatusComboBox.currentIndex() != 0: |
9201 | 418 | classifiers.append(self.developmentStatusComboBox.currentData()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
419 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
420 | itm = self.classifiersList.topLevelItem(0) |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
421 | while itm: |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
422 | itm.setExpanded(True) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
423 | if itm.checkState(0) == Qt.CheckState.Checked: |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
424 | classifiers.append(itm.data(0, Qt.ItemDataRole.UserRole)) |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
425 | itm = self.classifiersList.itemBelow(itm) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
426 | |
6940
12ed1a714527
SetupWizardDialog: change setup default method to 'setuptools' and fixed an issue causing an exception, if no classifiers were selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6645
diff
changeset
|
427 | # cleanup classifiers list - remove all invalid entries |
12ed1a714527
SetupWizardDialog: change setup default method to 'setuptools' and fixed an issue causing an exception, if no classifiers were selected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6645
diff
changeset
|
428 | classifiers = [c for c in classifiers if bool(c)] |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
429 | if classifiers: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
430 | sourceCode += "{0}classifiers=[{1}".format(istring, os.linesep) |
9433
6df1aeaa4529
Adjusted some wizard code generators to output Black compatible code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
431 | sourceCode += '{0}"{1}",{2}'.format( |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
432 | i1string, |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
433 | '",{0}{1}"'.format(os.linesep, i1string).join(classifiers), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
434 | os.linesep, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
435 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
436 | sourceCode += "{0}],{1}".format(istring, os.linesep) |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
437 | del classifiers |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
438 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
439 | if self.keywordsEdit.text(): |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
440 | sourceCode += '{0}keywords="{1}",{2}'.format( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
441 | istring, self.keywordsEdit.text(), os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
442 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
443 | |
9201 | 444 | if self.pyVersionEdit.text(): |
445 | sourceCode += '{0}python_requires="{1}",{2}'.format( | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
446 | istring, self.pyVersionEdit.text(), os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
447 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
448 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
449 | sourceCode += "{0}packages=find_packages(".format(istring) |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9514
diff
changeset
|
450 | src = FileSystemUtilities.fromNativeSeparators( |
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9514
diff
changeset
|
451 | self.sourceDirectoryPicker.text() |
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9514
diff
changeset
|
452 | ) |
8501
7b5f10581c35
Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8366
diff
changeset
|
453 | excludePatterns = [] |
7b5f10581c35
Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8366
diff
changeset
|
454 | for row in range(self.excludePatternList.count()): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
455 | excludePatterns.append(self.excludePatternList.item(row).text()) |
8501
7b5f10581c35
Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8366
diff
changeset
|
456 | if src: |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
457 | sourceCode += '{0}{1}"{2}"'.format(os.linesep, i1string, src) |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
458 | if excludePatterns: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
459 | sourceCode += "," |
8501
7b5f10581c35
Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8366
diff
changeset
|
460 | else: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
461 | sourceCode += "{0}{1}".format(os.linesep, istring) |
8501
7b5f10581c35
Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8366
diff
changeset
|
462 | if excludePatterns: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
463 | sourceCode += "{0}{1}exclude=[{0}".format(os.linesep, i1string) |
9433
6df1aeaa4529
Adjusted some wizard code generators to output Black compatible code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
464 | sourceCode += '{0}"{1}",{2}'.format( |
8501
7b5f10581c35
Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8366
diff
changeset
|
465 | i2string, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
466 | '",{0}{1}"'.format(os.linesep, i2string).join(excludePatterns), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
467 | os.linesep, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
468 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
469 | sourceCode += "{0}]{1}{2}".format(i1string, os.linesep, istring) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
470 | sourceCode += "),{0}".format(os.linesep) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
471 | |
8501
7b5f10581c35
Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8366
diff
changeset
|
472 | if self.includePackageDataCheckBox.isChecked(): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
473 | sourceCode += "{0}include_package_data = True,{1}".format( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
474 | istring, os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
475 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
476 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
477 | modules = [] |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
478 | for row in range(self.modulesList.count()): |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
479 | modules.append(self.modulesList.item(row).text()) |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
480 | if modules: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
481 | sourceCode += "{0}py_modules=[{1}".format(istring, os.linesep) |
9433
6df1aeaa4529
Adjusted some wizard code generators to output Black compatible code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
482 | sourceCode += '{0}"{1}",{2}'.format( |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
483 | i1string, |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
484 | '",{0}{1}"'.format(os.linesep, i1string).join(modules), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
485 | os.linesep, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
486 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
487 | sourceCode += "{0}],{1}".format(istring, os.linesep) |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
488 | del modules |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
489 | |
9201 | 490 | if self.entryPointsList.topLevelItemCount(): |
491 | entryPoints = { | |
492 | "console_scripts": [], | |
493 | "gui_scripts": [], | |
494 | } | |
495 | for row in range(self.entryPointsList.topLevelItemCount()): | |
496 | itm = self.entryPointsList.topLevelItem(row) | |
497 | entryPoints[itm.data(0, Qt.ItemDataRole.UserRole)].append( | |
498 | "{0} = {1}".format(itm.text(1), itm.text(2)) | |
499 | ) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
500 | sourceCode += "{0}entry_points={{{1}".format(istring, os.linesep) |
9201 | 501 | for epCategory in entryPoints: |
502 | if entryPoints[epCategory]: | |
503 | sourceCode += '{0}"{1}": [{2}'.format( | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
504 | i1string, epCategory, os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
505 | ) |
9201 | 506 | for entryPoint in entryPoints[epCategory]: |
507 | sourceCode += '{0}"{1}",{2}'.format( | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
508 | i2string, entryPoint, os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
509 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
510 | sourceCode += "{0}],{1}".format(i1string, os.linesep) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
511 | sourceCode += "{0}}},{1}".format(istring, os.linesep) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
512 | |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
513 | sourceCode += "){0}".format(estring) |
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
514 | return sourceCode |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
515 | |
9201 | 516 | def __getSetupCfgCode(self): |
517 | """ | |
518 | Private method to get the source code for a 'setup.cfg' file. | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
519 | |
9201 | 520 | @return generated code |
521 | @rtype str | |
522 | """ | |
523 | from . import SetupCfgUtilities | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
524 | |
9201 | 525 | metadata = { |
526 | "name": self.nameEdit.text(), | |
527 | "version": self.versionEdit.text(), | |
528 | } | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
529 | |
9201 | 530 | if self.summaryEdit.text(): |
531 | metadata["description"] = self.summaryEdit.text() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
532 | |
9201 | 533 | if self.descriptionEdit.toPlainText(): |
534 | metadata["long_description"] = ( | |
535 | "file: {0}".format( | |
536 | ", ".join(self.descriptionEdit.toPlainText().splitlines()) | |
537 | ) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
538 | if self.descriptionFromFilesCheckBox.isChecked() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
539 | else self.descriptionEdit.toPlainText() |
9201 | 540 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
541 | |
9201 | 542 | if self.descriptionContentTypeComboBox.currentData(): |
10621
f5631f40c4d9
Corrected some code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
543 | metadata["long_description_content_type"] = ( |
f5631f40c4d9
Corrected some code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
544 | self.descriptionContentTypeComboBox.currentData() |
f5631f40c4d9
Corrected some code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
545 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
546 | |
9201 | 547 | if self.authorEdit.text(): |
548 | metadata["author"] = self.authorEdit.text() | |
549 | metadata["author_email"] = self.authorEmailEdit.text() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
550 | |
9201 | 551 | if self.maintainerEdit.text(): |
552 | metadata["maintainer"] = self.maintainerEdit.text() | |
553 | metadata["maintainer_email"] = self.maintainerEmailEdit.text() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
554 | |
9201 | 555 | metadata["url"] = self.homePageUrlEdit.text() |
556 | if self.downloadUrlEdit.text(): | |
557 | metadata["download_url"] = self.downloadUrlEdit.text() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
558 | |
9201 | 559 | if self.projectUrlsList.topLevelItemCount(): |
560 | projectURLs = {} | |
561 | for row in range(self.projectUrlsList.topLevelItemCount()): | |
562 | urlItem = self.projectUrlsList.topLevelItem(row) | |
563 | projectURLs[urlItem.text(0)] = urlItem.text(1) | |
564 | metadata["project_urls"] = SetupCfgUtilities.toString(projectURLs) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
565 | |
9201 | 566 | classifiers = [] |
567 | if not self.licenseClassifierCheckBox.isChecked(): | |
568 | metadata["license"] = self.licenseEdit.text() | |
569 | else: | |
570 | classifiers.append( | |
571 | self.licenseClassifierComboBox.itemData( | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
572 | self.licenseClassifierComboBox.currentIndex() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
573 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
574 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
575 | |
9201 | 576 | platforms = self.platformsEdit.toPlainText().splitlines() |
577 | if platforms: | |
578 | metadata["platforms"] = SetupCfgUtilities.toString(platforms) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
579 | |
9201 | 580 | if self.developmentStatusComboBox.currentIndex() != 0: |
581 | classifiers.append(self.developmentStatusComboBox.currentData()) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
582 | |
9201 | 583 | itm = self.classifiersList.topLevelItem(0) |
584 | while itm: | |
585 | itm.setExpanded(True) | |
586 | if itm.checkState(0) == Qt.CheckState.Checked: | |
587 | classifiers.append(itm.data(0, Qt.ItemDataRole.UserRole)) | |
588 | itm = self.classifiersList.itemBelow(itm) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
589 | |
9201 | 590 | # cleanup classifiers list - remove all invalid entries |
591 | classifiers = [c for c in classifiers if bool(c)] | |
592 | if classifiers: | |
593 | metadata["classifiers"] = SetupCfgUtilities.toString(classifiers) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
594 | |
9201 | 595 | if self.keywordsEdit.text(): |
596 | metadata["keywords"] = SetupCfgUtilities.toString( | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
597 | self.keywordsEdit.text().split() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
598 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
599 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
600 | options = {"packages": "find:"} |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
601 | |
9201 | 602 | if self.pyVersionEdit.text(): |
603 | options["python_requires"] = self.pyVersionEdit.text() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
604 | |
9201 | 605 | findOptions = {} |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9514
diff
changeset
|
606 | src = FileSystemUtilities.fromNativeSeparators( |
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9514
diff
changeset
|
607 | self.sourceDirectoryPicker.text() |
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9514
diff
changeset
|
608 | ) |
9201 | 609 | excludePatterns = [] |
610 | for row in range(self.excludePatternList.count()): | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
611 | excludePatterns.append(self.excludePatternList.item(row).text()) |
9201 | 612 | if src: |
613 | options["package_dir"] = SetupCfgUtilities.toString({"": src}) | |
614 | findOptions["where"] = src | |
615 | if excludePatterns: | |
616 | findOptions["exclude"] = SetupCfgUtilities.toString(excludePatterns) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
617 | |
9201 | 618 | if self.includePackageDataCheckBox.isChecked(): |
619 | options["include_package_data"] = SetupCfgUtilities.toString(True) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
620 | packageData = {} # placeholder section |
9201 | 621 | else: |
622 | packageData = None | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
623 | |
9201 | 624 | modules = [] |
625 | for row in range(self.modulesList.count()): | |
626 | modules.append(self.modulesList.item(row).text()) | |
627 | if modules: | |
628 | options["py_modules"] = SetupCfgUtilities.toString(modules) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
629 | |
9201 | 630 | if self.entryPointsList.topLevelItemCount(): |
631 | entryPoints = { | |
632 | "console_scripts": {}, | |
633 | "gui_scripts": {}, | |
634 | } | |
635 | for row in range(self.entryPointsList.topLevelItemCount()): | |
636 | itm = self.entryPointsList.topLevelItem(row) | |
10621
f5631f40c4d9
Corrected some code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
637 | entryPoints[itm.data(0, Qt.ItemDataRole.UserRole)][itm.text(1)] = ( |
f5631f40c4d9
Corrected some code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
638 | itm.text(2) |
f5631f40c4d9
Corrected some code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
639 | ) |
10373
093dcebe5ecb
Corrected some uses of dict.keys(), dict.values() and dict.items().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10192
diff
changeset
|
640 | for epType in list(entryPoints): |
9201 | 641 | if entryPoints[epType]: |
642 | entryPoints[epType] = SetupCfgUtilities.toString( | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
643 | entryPoints[epType] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
644 | ) |
9201 | 645 | else: |
646 | del entryPoints[epType] | |
647 | else: | |
648 | entryPoints = {} | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
649 | |
9201 | 650 | configDict = { |
651 | "metadata": metadata, | |
652 | "options": options, | |
653 | "options.packages.find": findOptions, | |
654 | } | |
655 | if packageData is not None: | |
656 | configDict["options.package_data"] = packageData | |
657 | if entryPoints: | |
658 | configDict["options.entry_points"] = entryPoints | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
659 | |
9201 | 660 | cparser = configparser.ConfigParser() |
661 | cparser.read_dict(configDict) | |
662 | sio = io.StringIO() | |
663 | cparser.write(sio) | |
664 | sourceCode = sio.getvalue() | |
665 | return sourceCode | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
666 | |
9201 | 667 | def __getPyprojectCode(self): |
668 | """ | |
669 | Private method to get the source code for a 'pyproject.toml' file. | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
670 | |
9201 | 671 | @return generated code |
672 | @rtype str | |
673 | """ | |
674 | doc = tomlkit.document() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
675 | |
9201 | 676 | buildSystem = tomlkit.table() |
677 | buildSystem["requires"] = ["setuptools>=61.0.0", "wheel"] | |
678 | buildSystem["build-backend"] = "setuptools.build_meta" | |
679 | doc["build-system"] = buildSystem | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
680 | |
9201 | 681 | project = tomlkit.table() |
682 | project["name"] = self.nameEdit.text() | |
683 | project["version"] = self.versionEdit.text() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
684 | |
9201 | 685 | if self.summaryEdit.text(): |
686 | project["description"] = self.summaryEdit.text() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
687 | |
9201 | 688 | if self.descriptionEdit.toPlainText(): |
689 | if self.descriptionFromFilesCheckBox.isChecked(): | |
690 | project["readme"] = self.descriptionEdit.toPlainText().splitlines()[0] | |
691 | else: | |
692 | readme = tomlkit.table() | |
693 | readme["text"] = self.descriptionEdit.toPlainText() | |
10621
f5631f40c4d9
Corrected some code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
694 | readme["content-type"] = ( |
f5631f40c4d9
Corrected some code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
695 | self.descriptionContentTypeComboBox.currentData() |
f5631f40c4d9
Corrected some code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
696 | ) |
9201 | 697 | project["readme"] = readme |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
698 | |
9201 | 699 | if self.authorEdit.text(): |
700 | authors = tomlkit.array() | |
701 | author = tomlkit.inline_table() | |
702 | author["name"] = self.authorEdit.text() | |
9673
f4b3d2485baa
Modified the pyproject.toml setup wizard to generate entries for author/maintainer AND their email entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
703 | authors.add_line(author) |
f4b3d2485baa
Modified the pyproject.toml setup wizard to generate entries for author/maintainer AND their email entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
704 | author = tomlkit.inline_table() |
f4b3d2485baa
Modified the pyproject.toml setup wizard to generate entries for author/maintainer AND their email entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
705 | author["name"] = self.authorEdit.text() |
9201 | 706 | author["email"] = self.authorEmailEdit.text() |
9673
f4b3d2485baa
Modified the pyproject.toml setup wizard to generate entries for author/maintainer AND their email entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
707 | authors.add_line(author) |
f4b3d2485baa
Modified the pyproject.toml setup wizard to generate entries for author/maintainer AND their email entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
708 | authors.append(tomlkit.nl()) |
9201 | 709 | project["authors"] = authors |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
710 | |
9201 | 711 | if self.maintainerEdit.text(): |
712 | maintainers = tomlkit.array() | |
713 | maintainer = tomlkit.inline_table() | |
714 | maintainer["name"] = self.maintainerEdit.text() | |
9673
f4b3d2485baa
Modified the pyproject.toml setup wizard to generate entries for author/maintainer AND their email entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
715 | maintainers.add_line(maintainer) |
f4b3d2485baa
Modified the pyproject.toml setup wizard to generate entries for author/maintainer AND their email entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
716 | maintainer = tomlkit.inline_table() |
f4b3d2485baa
Modified the pyproject.toml setup wizard to generate entries for author/maintainer AND their email entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
717 | maintainer["name"] = self.maintainerEdit.text() |
9201 | 718 | maintainer["email"] = self.maintainerEmailEdit.text() |
9673
f4b3d2485baa
Modified the pyproject.toml setup wizard to generate entries for author/maintainer AND their email entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
719 | maintainers.add_line(maintainer) |
f4b3d2485baa
Modified the pyproject.toml setup wizard to generate entries for author/maintainer AND their email entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
720 | maintainers.append(tomlkit.nl()) |
9201 | 721 | project["maintainers"] = maintainers |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
722 | |
9201 | 723 | urls = tomlkit.table() |
724 | urls["Homepage"] = self.homePageUrlEdit.text() | |
725 | if self.downloadUrlEdit.text(): | |
726 | urls["Download"] = self.downloadUrlEdit.text() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
727 | |
9201 | 728 | if self.projectUrlsList.topLevelItemCount(): |
729 | for row in range(self.projectUrlsList.topLevelItemCount()): | |
730 | urlItem = self.projectUrlsList.topLevelItem(row) | |
731 | urls[urlItem.text(0)] = urlItem.text(1) | |
732 | project["urls"] = urls | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
733 | |
11203
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
734 | if self.licenseClassifierCheckBox.isChecked(): |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
735 | project["license"] = self.licenseClassifierComboBox.itemData( |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
736 | self.licenseClassifierComboBox.currentIndex() |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
737 | ) |
9201 | 738 | else: |
11203
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
739 | project["license"] = self.licenseEdit.text() |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
740 | |
2ea34362b6b6
Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
741 | classifiers = [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
742 | |
9201 | 743 | if self.developmentStatusComboBox.currentIndex() != 0: |
744 | classifiers.append(self.developmentStatusComboBox.currentData()) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
745 | |
9201 | 746 | itm = self.classifiersList.topLevelItem(0) |
747 | while itm: | |
748 | itm.setExpanded(True) | |
749 | if itm.checkState(0) == Qt.CheckState.Checked: | |
750 | classifiers.append(itm.data(0, Qt.ItemDataRole.UserRole)) | |
751 | itm = self.classifiersList.itemBelow(itm) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
752 | |
9201 | 753 | # cleanup classifiers list - remove all invalid entries |
754 | classifiers = [c for c in classifiers if bool(c)] | |
755 | if classifiers: | |
756 | classifiersArray = tomlkit.array() | |
757 | for classifier in classifiers: | |
758 | classifiersArray.add_line(classifier) | |
759 | classifiersArray.append(tomlkit.nl()) | |
760 | project["classifiers"] = classifiersArray | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
761 | |
9201 | 762 | if self.keywordsEdit.text(): |
763 | keywords = tomlkit.array() | |
764 | for kw in self.keywordsEdit.text().split(): | |
765 | keywords.add_line(kw) | |
766 | keywords.append(tomlkit.nl()) | |
767 | project["keywords"] = keywords | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
768 | |
9201 | 769 | if self.pyVersionEdit.text(): |
770 | project["requires-python"] = self.pyVersionEdit.text() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
771 | |
9201 | 772 | if self.entryPointsList.topLevelItemCount(): |
773 | entryPoints = { | |
774 | "console_scripts": {}, | |
775 | "gui_scripts": {}, | |
776 | } | |
777 | for row in range(self.entryPointsList.topLevelItemCount()): | |
778 | itm = self.entryPointsList.topLevelItem(row) | |
10621
f5631f40c4d9
Corrected some code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
779 | entryPoints[itm.data(0, Qt.ItemDataRole.UserRole)][itm.text(1)] = ( |
f5631f40c4d9
Corrected some code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
780 | itm.text(2) |
f5631f40c4d9
Corrected some code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
781 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
782 | |
9201 | 783 | if entryPoints["console_scripts"]: |
784 | scripts = tomlkit.table() | |
785 | for name, function in entryPoints["console_scripts"].items(): | |
786 | scripts[name] = function | |
787 | project["scripts"] = scripts | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
788 | |
9201 | 789 | if entryPoints["gui_scripts"]: |
790 | guiScripts = tomlkit.table() | |
791 | for name, function in entryPoints["gui_scripts"].items(): | |
792 | guiScripts[name] = function | |
793 | project["gui-scripts"] = guiScripts | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
794 | |
9201 | 795 | # placeholder |
796 | dependencies = tomlkit.array() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
797 | dependencies.append( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
798 | tomlkit.comment("TODO: enter project dependencies ") # __NO-TASK__ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
799 | ) |
9201 | 800 | project["dependencies"] = dependencies |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
801 | |
9201 | 802 | doc["project"] = project |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
803 | |
9201 | 804 | setuptools = tomlkit.table() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
805 | |
9201 | 806 | platforms = self.platformsEdit.toPlainText().splitlines() |
807 | if platforms: | |
808 | platformsArray = tomlkit.array() | |
809 | for plt in platforms: | |
810 | platformsArray.add_line(plt) | |
811 | platformsArray.append(tomlkit.nl()) | |
812 | setuptools["platforms"] = platformsArray | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
813 | |
9201 | 814 | setuptools["include-package-data"] = self.includePackageDataCheckBox.isChecked() |
815 | if self.includePackageDataCheckBox.isChecked(): | |
816 | # placeholder | |
817 | setuptools["package-data"] = tomlkit.table() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
818 | setuptools["package-data"].add( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
819 | tomlkit.comment("TODO: enter package data patterns") # __NO-TASK__ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
820 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
821 | |
9201 | 822 | if self.modulesList.count(): |
823 | modulesArray = tomlkit.array() | |
824 | for row in range(self.modulesList.count()): | |
825 | modulesArray.add_line(self.modulesList.item(row).text()) | |
826 | modulesArray.append(tomlkit.nl()) | |
827 | setuptools["py-modules"] = modulesArray | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
828 | |
9201 | 829 | findspec = tomlkit.table() |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9514
diff
changeset
|
830 | src = FileSystemUtilities.fromNativeSeparators( |
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9514
diff
changeset
|
831 | self.sourceDirectoryPicker.text() |
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9514
diff
changeset
|
832 | ) |
9201 | 833 | excludePatterns = [] |
834 | for row in range(self.excludePatternList.count()): | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
835 | excludePatterns.append(self.excludePatternList.item(row).text()) |
9201 | 836 | if src: |
837 | findspec["where"] = [ericApp().getObject("Project").getRelativePath(src)] | |
838 | if excludePatterns: | |
839 | excludePatternsArray = tomlkit.array() | |
840 | for pattern in excludePatterns: | |
841 | excludePatternsArray.add_line(pattern) | |
842 | excludePatternsArray.append(tomlkit.nl()) | |
843 | findspec["exclude"] = excludePatternsArray | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
844 | |
9201 | 845 | if bool(findspec): |
846 | setuptools["packages"] = tomlkit.table(is_super_table=True) | |
847 | setuptools["packages"]["find"] = findspec | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
848 | |
9201 | 849 | doc["tool"] = tomlkit.table(is_super_table=True) |
850 | doc["tool"]["setuptools"] = setuptools | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
851 | |
9201 | 852 | sourceCode = tomlkit.dumps(doc) |
853 | return sourceCode | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
854 | |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
855 | @pyqtSlot() |
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
856 | def accept(self): |
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
857 | """ |
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
858 | Public slot to handle pressing the OK button. |
9201 | 859 | """ |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
860 | line, index = self.__editor.getCursorPosition() |
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
861 | indLevel = self.__editor.indentation(line) // self.__editor.indentationWidth() |
9205
b75da2ba2a1a
Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9202
diff
changeset
|
862 | indString = ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
863 | "\t" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
864 | if self.__editor.indentationsUseTabs() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
865 | else self.__editor.indentationWidth() * " " |
9205
b75da2ba2a1a
Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9202
diff
changeset
|
866 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
867 | |
9201 | 868 | if self.__category == "setup.py": |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
869 | sourceCode = self.__getSetupPyCode(indLevel, indString) |
9201 | 870 | elif self.__category == "setup.cfg": |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
871 | sourceCode = self.__getSetupCfgCode() |
9201 | 872 | elif self.__category == "pyproject.toml": |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
873 | sourceCode = self.__getPyprojectCode() |
9201 | 874 | else: |
875 | # should not happen, but play it safe | |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
876 | sourceCode = "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
877 | |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
878 | if sourceCode: |
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
879 | line, index = self.__editor.getCursorPosition() |
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
880 | # It should be done this way to allow undo |
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
881 | self.__editor.beginUndoAction() |
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
882 | self.__editor.insertAt(sourceCode, line, index) |
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
883 | self.__editor.endUndoAction() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
884 | |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
885 | super().accept() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
886 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
887 | @pyqtSlot() |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
888 | def on_projectButton_clicked(self): |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
889 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
890 | Private slot to populate some fields with data retrieved from the |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
891 | current project. |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
892 | """ |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
893 | project = ericApp().getObject("Project") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
894 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
895 | self.nameEdit.setText(project.getProjectName()) |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
896 | try: |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
897 | self.versionEdit.setText(project.getProjectVersion()) |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
898 | self.authorEdit.setText(project.getProjectAuthor()) |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
899 | self.authorEmailEdit.setText(project.getProjectAuthorEmail()) |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
900 | description = project.getProjectDescription() |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
901 | except AttributeError: |
9514
2b104ad132a4
Made the project pdata structure private and added getter and setter methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
902 | self.versionEdit.setText(project.getProjectData(dataKey="VERSION")[0]) |
2b104ad132a4
Made the project pdata structure private and added getter and setter methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
903 | self.authorEdit.setText(project.getProjectData(dataKey="AUTHOR")[0]) |
2b104ad132a4
Made the project pdata structure private and added getter and setter methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
904 | self.authorEmailEdit.setText(project.getProjectData(dataKey="EMAIL")[0]) |
2b104ad132a4
Made the project pdata structure private and added getter and setter methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
905 | description = project.getProjectData(dataKey="DESCRIPTION")[0] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
906 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
907 | summary = description.split(".", 1)[0].replace("\r", "").replace("\n", "") + "." |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
908 | self.summaryEdit.setText(summary) |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
909 | self.descriptionEdit.setPlainText(description) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
910 | |
8757
23b2fe1cd863
Corrected the Setup wizard dialog and changed it to use the EricPathPicker widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8501
diff
changeset
|
911 | self.packageRootPicker.setText(project.getProjectPath()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
912 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
913 | # prevent overwriting of entries by disabling the button |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
914 | self.projectButton.setEnabled(False) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
915 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
916 | def __getStartDir(self): |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
917 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
918 | Private method to get the start directory for selection dialogs. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
919 | |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
920 | @return start directory |
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
921 | @rtype str |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
922 | """ |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9514
diff
changeset
|
923 | return Preferences.getMultiProject("Workspace") or OSUtilities.getHomeDir() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
924 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
925 | @pyqtSlot() |
9201 | 926 | def on_entryPointsList_itemSelectionChanged(self): |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
927 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
928 | Private slot to handle a change of selected items of the |
9201 | 929 | entry points list. |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
930 | """ |
9201 | 931 | self.deleteEntryPointButton.setEnabled( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
932 | bool(self.entryPointsList.selectedItems()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
933 | ) |
9201 | 934 | self.editEntryPointButton.setEnabled( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
935 | len(self.entryPointsList.selectedItems()) == 1 |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
936 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
937 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
938 | @pyqtSlot() |
9201 | 939 | def on_deleteEntryPointButton_clicked(self): |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
940 | """ |
9201 | 941 | Private slot to delete the selected entry point items. |
942 | """ | |
943 | for itm in self.entryPointsList.selectedItems(): | |
944 | self.entryPointsList.takeTopLevelItem(self.entryPointsList.row(itm)) | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
945 | del itm |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
946 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
947 | @pyqtSlot() |
9201 | 948 | def on_addEntryPointButton_clicked(self): |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
949 | """ |
9201 | 950 | Private slot to add an entry point to the list. |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
951 | """ |
9201 | 952 | project = ericApp().getObject("Project") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
953 | rootDir = project.getProjectPath() if project.isOpen() else "" |
9201 | 954 | dlg = AddEntryPointDialog(rootDir, parent=self) |
955 | if dlg.exec() == QDialog.DialogCode.Accepted: | |
956 | epType, epCategory, name, script = dlg.getEntryPoint() | |
957 | itm = QTreeWidgetItem(self.entryPointsList, [epType, name, script]) | |
958 | itm.setData(0, Qt.ItemDataRole.UserRole, epCategory) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
959 | |
9201 | 960 | @pyqtSlot() |
961 | def on_editEntryPointButton_clicked(self): | |
962 | """ | |
963 | Private slot to edit the selected entry point. | |
964 | """ | |
965 | project = ericApp().getObject("Project") | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
966 | rootDir = project.getProjectPath() if project.isOpen() else "" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
967 | itm = self.entryPointsList.selectedItems()[0] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
968 | dlg = AddEntryPointDialog( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
969 | rootDir, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
970 | epType=itm.text(0), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
971 | name=itm.text(1), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
972 | script=itm.text(2), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
973 | parent=self, |
9201 | 974 | ) |
975 | if dlg.exec() == QDialog.DialogCode.Accepted: | |
976 | epType, epCategory, name, script = dlg.getEntryPoint() | |
977 | itm.setText(0, epType) | |
978 | itm.setText(1, name) | |
979 | itm.setText(2, script) | |
980 | itm.setData(0, Qt.ItemDataRole.UserRole, epCategory) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
981 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
982 | @pyqtSlot() |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
983 | def on_modulesList_itemSelectionChanged(self): |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
984 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
985 | Private slot to handle a change of selected items of the |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
986 | modules list. |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
987 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
988 | self.deleteModuleButton.setEnabled(bool(self.modulesList.selectedItems())) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
989 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
990 | @pyqtSlot() |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
991 | def on_deleteModuleButton_clicked(self): |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
992 | """ |
9201 | 993 | Private slot to delete the selected module items. |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
994 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
995 | for itm in self.modulesList.selectedItems(): |
9201 | 996 | self.modulesList.takeItem(self.modulesList.row(itm)) |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
997 | del itm |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
998 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
999 | @pyqtSlot() |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1000 | def on_addModuleButton_clicked(self): |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1001 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1002 | Private slot to add Python modules to the list. |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1003 | """ |
8757
23b2fe1cd863
Corrected the Setup wizard dialog and changed it to use the EricPathPicker widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8501
diff
changeset
|
1004 | startDir = self.packageRootPicker.text() or self.__getStartDir() |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8322
diff
changeset
|
1005 | modulesList = EricFileDialog.getOpenFileNames( |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1006 | self, |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1007 | self.tr("Add Python Modules"), |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1008 | startDir, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1009 | self.tr("Python Files (*.py)"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1010 | ) |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1011 | for module in modulesList: |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9514
diff
changeset
|
1012 | module = module.replace( |
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9514
diff
changeset
|
1013 | FileSystemUtilities.toNativeSeparators(startDir), "" |
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9514
diff
changeset
|
1014 | ) |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1015 | if module.startswith(("\\", "/")): |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1016 | module = module[1:] |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1017 | if module: |
9201 | 1018 | QListWidgetItem( |
1019 | str(pathlib.Path(module).with_suffix("")) | |
1020 | .replace("\\", ".") | |
1021 | .replace("/", "."), | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1022 | self.modulesList, |
9201 | 1023 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1024 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1025 | @pyqtSlot() |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1026 | def on_excludePatternList_itemSelectionChanged(self): |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1027 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1028 | Private slot to handle a change of selected items of the |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1029 | exclude pattern list. |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1030 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1031 | self.deleteExcludePatternButton.setEnabled( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1032 | bool(self.excludePatternList.selectedItems()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1033 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1034 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1035 | @pyqtSlot() |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1036 | def on_deleteExcludePatternButton_clicked(self): |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1037 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1038 | Private slot to delete the selected exclude pattern items. |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1039 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1040 | for itm in self.excludePatternList.selectedItems(): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1041 | self.excludePatternList.takeItem(self.excludePatternList.row(itm)) |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1042 | del itm |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1043 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1044 | @pyqtSlot() |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1045 | def on_addExludePatternButton_clicked(self): |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1046 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1047 | Private slot to add an exclude pattern to the list. |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1048 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1049 | pattern = self.excludePatternEdit.text().replace("\\", ".").replace("/", ".") |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1050 | if not self.excludePatternList.findItems( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1051 | pattern, Qt.MatchFlag.MatchExactly | Qt.MatchFlag.MatchCaseSensitive |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
1052 | ): |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1053 | QListWidgetItem(pattern, self.excludePatternList) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1054 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1055 | @pyqtSlot(str) |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1056 | def on_excludePatternEdit_textChanged(self, txt): |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1057 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1058 | Private slot to handle a change of the exclude pattern text. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1059 | |
9175
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
1060 | @param txt text of the line edit |
21e2be5f0b41
Changed code to use the 'trove-classifiers' package instead of a local text file copy or a download from PyPI.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8881
diff
changeset
|
1061 | @type str |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1062 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1063 | self.addExludePatternButton.setEnabled(bool(txt)) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1064 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1065 | @pyqtSlot() |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1066 | def on_excludePatternEdit_returnPressed(self): |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1067 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1068 | Private slot handling a press of the return button of the |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1069 | exclude pattern edit. |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1070 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1071 | self.on_addExludePatternButton_clicked() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1072 | |
9201 | 1073 | @pyqtSlot() |
1074 | def on_urlDeleteButton_clicked(self): | |
1075 | """ | |
1076 | Private slot to delete the selected URL items. | |
1077 | """ | |
1078 | for itm in self.projectUrlsList.selectedItems(): | |
1079 | self.projectUrlsList.takeTopLevelItem(self.projectUrlsList.row(itm)) | |
1080 | del itm | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1081 | |
9201 | 1082 | @pyqtSlot() |
1083 | def on_urlAddButton_clicked(self): | |
1084 | """ | |
1085 | Private slot to add a project URL to the list. | |
1086 | """ | |
1087 | dlg = AddProjectUrlDialog(parent=self) | |
1088 | if dlg.exec() == QDialog.DialogCode.Accepted: | |
1089 | name, url = dlg.getUrl() | |
1090 | QTreeWidgetItem(self.projectUrlsList, [name, url]) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1091 | |
9201 | 1092 | @pyqtSlot() |
1093 | def on_urlEditButton_clicked(self): | |
1094 | """ | |
1095 | Private slot to edit the selected project URL. | |
1096 | """ | |
1097 | itm = self.projectUrlsList.selectedItems()[0] | |
1098 | dlg = AddProjectUrlDialog(name=itm.text(0), url=itm.text(1), parent=self) | |
1099 | if dlg.exec() == QDialog.DialogCode.Accepted: | |
1100 | name, url = dlg.getUrl() | |
1101 | itm.setText(0, name) | |
1102 | itm.setText(1, url) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1103 | |
9201 | 1104 | @pyqtSlot() |
1105 | def on_projectUrlsList_itemSelectionChanged(self): | |
1106 | """ | |
1107 | Private slot to handle a change of selected items of the | |
1108 | project URLs list. | |
1109 | """ | |
1110 | self.urlDeleteButton.setEnabled(bool(self.projectUrlsList.selectedItems())) | |
1111 | self.urlEditButton.setEnabled(len(self.projectUrlsList.selectedItems()) == 1) |