Wed, 16 Nov 2022 10:53:40 +0100
Made the project pdata structure private and added getter and setter methods.
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 | |
8881
54e42bc2437a
Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8862
diff
changeset
|
3 | # Copyright (c) 2013 - 2022 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 | ||
16 | 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
|
17 | 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
|
18 | |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9433
diff
changeset
|
19 | from PyQt6.QtCore import Qt, pyqtSlot |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9433
diff
changeset
|
20 | 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
|
21 | |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9433
diff
changeset
|
22 | from eric7 import Preferences, Utilities |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9433
diff
changeset
|
23 | 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
|
24 | 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
|
25 | from eric7.EricWidgets.EricPathPicker import EricPathPickerModes |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | |
9201 | 27 | from .AddEntryPointDialog import AddEntryPointDialog |
28 | 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
|
29 | 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
|
30 | |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
31 | |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
32 | 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
|
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 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
|
35 | |
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
|
36 | 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
|
37 | generator. |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
38 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
39 | |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
40 | 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
|
41 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
42 | Constructor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
43 | |
9201 | 44 | @param category category of setup file to create |
45 | @type str | |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
46 | @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
|
47 | @type Editor |
9201 | 48 | @param parent reference to the parent widget (defaults to None) |
49 | @type QWidget (optional) | |
50 | @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
|
51 | """ |
9201 | 52 | if category not in ("setup.py", "setup.cfg", "pyproject.toml"): |
53 | 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
|
54 | |
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
|
55 | 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
|
56 | self.setupUi(self) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
57 | |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
58 | 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
|
59 | |
7005
342819f05839
setup.py Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
60 | self.__replies = [] |
9201 | 61 | self.__category = category |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
62 | self.__editor = editor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
63 | |
9201 | 64 | if category != "setup.py": |
65 | self.introCheckBox.setVisible(False) | |
66 | self.importCheckBox.setVisible(False) | |
67 | self.metaDataCheckBox.setVisible(False) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
68 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
69 | self.dataTabWidget.setCurrentIndex(0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
70 | |
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
|
71 | 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
|
72 | 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
|
73 | |
8862
99459beb81b1
Adapted some style sheet usages to observe the palette lightness (dark/light).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8838
diff
changeset
|
74 | 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
|
75 | "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
|
76 | if ericApp().usesDarkPalette() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
77 | 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
|
78 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
79 | for lineEdit in [ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
80 | self.nameEdit, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
81 | self.versionEdit, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
82 | self.homePageUrlEdit, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
83 | self.authorEdit, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
84 | self.authorEmailEdit, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
85 | self.maintainerEdit, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
86 | self.maintainerEmailEdit, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
87 | ]: |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
88 | lineEdit.setStyleSheet(self.__mandatoryStyleSheet) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
89 | |
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
|
90 | self.__populateClassifiers() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
91 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
92 | 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
|
93 | self.__okButton.setEnabled(False) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
94 | |
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
|
95 | 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
|
96 | self.projectButton.setEnabled(projectOpen) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
97 | |
9201 | 98 | self.projectUrlsList.header().setSortIndicator(0, Qt.SortOrder.AscendingOrder) |
99 | 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
|
100 | |
9201 | 101 | self.descriptionContentTypeComboBox.addItem("", "") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
102 | for contentType, mimetype in sorted( |
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.tr("Plain Text"), "text/plain"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
105 | (self.tr("Markdown"), "text/markdown"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
106 | (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
|
107 | ] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
108 | ): |
9201 | 109 | 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
|
110 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
111 | 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
|
112 | 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
|
113 | 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
|
114 | 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
|
115 | 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
|
116 | 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
|
117 | 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
|
118 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
119 | 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
|
120 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
121 | 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
|
122 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
123 | enable = ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
124 | bool(self.nameEdit.text()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
125 | and bool(self.versionEdit.text()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
126 | and bool(self.homePageUrlEdit.text()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
127 | and ( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
128 | (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
|
129 | or ( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
130 | bool(self.maintainerEdit.text()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
131 | and bool(self.maintainerEmailEdit.text()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
132 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
133 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
134 | 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
|
135 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
136 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
137 | self.__okButton.setEnabled(enable) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
138 | |
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
|
139 | def __populateClassifiers(self): |
7005
342819f05839
setup.py Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
140 | """ |
342819f05839
setup.py Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
141 | Private method to populate the classifiers. |
342819f05839
setup.py Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
142 | """ |
342819f05839
setup.py Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
143 | self.licenseClassifierComboBox.clear() |
342819f05839
setup.py Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
144 | self.classifiersList.clear() |
342819f05839
setup.py Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
145 | self.developmentStatusComboBox.clear() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
146 | |
7005
342819f05839
setup.py Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
147 | self.developmentStatusComboBox.addItem("", "") |
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.__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
|
150 | 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
|
151 | if classifier.startswith("License ::"): |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
152 | self.licenseClassifierComboBox.addItem( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
153 | "/".join(classifier.split(" :: ")[1:]), classifier |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
154 | ) |
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
|
155 | 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
|
156 | self.developmentStatusComboBox.addItem( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
157 | classifier.split(" :: ")[1], classifier |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
158 | ) |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
159 | 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
|
160 | 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
|
161 | self.__classifiersDict = {} |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
162 | |
7005
342819f05839
setup.py Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
163 | self.licenseClassifierComboBox.setCurrentIndex( |
342819f05839
setup.py Wizard:
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
164 | self.licenseClassifierComboBox.findText( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
165 | "(GPLv3)", Qt.MatchFlag.MatchContains | 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
|
166 | ) |
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
|
167 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
168 | |
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
|
169 | 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
|
170 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
171 | 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
|
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 | @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
|
174 | @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
|
175 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
176 | itm = None |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
177 | 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
|
178 | 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
|
179 | 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
|
180 | 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
|
181 | 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
|
182 | if pitm is None: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
183 | 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
|
184 | pitm = itm |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
185 | else: |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
186 | 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
|
187 | 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
|
188 | 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
|
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 | 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
|
191 | 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
|
192 | 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
|
193 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
194 | 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
|
195 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
196 | 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
|
197 | |
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
|
198 | @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
|
199 | @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
|
200 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
201 | 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
|
202 | 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
|
203 | else: |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
204 | 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
|
205 | 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
|
206 | 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
|
207 | return lic |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
208 | |
9201 | 209 | 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
|
210 | """ |
9201 | 211 | 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
|
212 | |
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
|
213 | @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
|
214 | @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
|
215 | @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
|
216 | @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
|
217 | @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
|
218 | @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
|
219 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
220 | # 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
|
221 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
222 | # 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
|
223 | 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
|
224 | 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
|
225 | 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
|
226 | 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
|
227 | 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
|
228 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
229 | # 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
|
230 | 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
|
231 | 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
|
232 | 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
|
233 | 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
|
234 | sourceCode = "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
235 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
236 | if self.metaDataCheckBox.isChecked(): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
237 | 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
|
238 | sourceCode += '"{0}"{1}'.format( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
239 | 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
|
240 | ) |
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
|
241 | 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
|
242 | self.versionEdit.text(), os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
243 | ) |
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
|
244 | 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
|
245 | self.__getLicenseText(), os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
246 | ) |
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
|
247 | 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
|
248 | 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
|
249 | ) |
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
|
250 | 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
|
251 | 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
|
252 | os.linesep, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
253 | ) |
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
|
254 | 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
|
255 | self.homePageUrlEdit.text(), os.linesep |
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 | sourceCode += '__date__ = "{0}"{1}'.format( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
258 | datetime.datetime.now().isoformat().split(".")[0], os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
259 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
260 | 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
|
261 | sourceCode += os.linesep |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
262 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
263 | if self.importCheckBox.isChecked(): |
8501
7b5f10581c35
Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8366
diff
changeset
|
264 | 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
|
265 | 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
|
266 | additionalImport, os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
267 | ) |
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
|
268 | 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
|
269 | 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
|
270 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
271 | if self.descriptionFromFilesCheckBox.isChecked(): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
272 | 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
|
273 | 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
|
274 | 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
|
275 | istring, |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
276 | '", "'.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
|
277 | os.linesep, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
278 | ) |
9201 | 279 | sourceCode += ( |
280 | '{0}with open(fname, "r", encoding="utf-8") as f:{1}' | |
281 | ).format(i1string, os.linesep) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
282 | 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
|
283 | 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
|
284 | istring, os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
285 | ) |
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
|
286 | 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
|
287 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
288 | 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
|
289 | 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
|
290 | 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
|
291 | ) |
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
|
292 | 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
|
293 | 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
|
294 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
295 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
296 | 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
|
297 | 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
|
298 | 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
|
299 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
300 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
301 | if self.descriptionFromFilesCheckBox.isChecked(): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
302 | 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
|
303 | istring, os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
304 | ) |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
305 | 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
|
306 | 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
|
307 | 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
|
308 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
309 | |
9201 | 310 | if self.descriptionContentTypeComboBox.currentData(): |
311 | 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
|
312 | 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
|
313 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
314 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
315 | 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
|
316 | 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
|
317 | 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
|
318 | ) |
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
|
319 | 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
|
320 | 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
|
321 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
322 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
323 | 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
|
324 | 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
|
325 | 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
|
326 | ) |
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
|
327 | 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
|
328 | 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
|
329 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
330 | |
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
|
331 | 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
|
332 | 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
|
333 | ) |
9201 | 334 | if self.downloadUrlEdit.text(): |
335 | 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
|
336 | 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
|
337 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
338 | |
9201 | 339 | if self.projectUrlsList.topLevelItemCount(): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
340 | sourceCode += "{0}project_urls={{{1}".format(istring, os.linesep) |
9201 | 341 | for row in range(self.projectUrlsList.topLevelItemCount()): |
342 | urlItem = self.projectUrlsList.topLevelItem(row) | |
343 | 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
|
344 | 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
|
345 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
346 | 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
|
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 | classifiers = [] |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
349 | 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
|
350 | 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
|
351 | 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
|
352 | ) |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
353 | else: |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
354 | classifiers.append( |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
355 | self.licenseClassifierComboBox.itemData( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
356 | self.licenseClassifierComboBox.currentIndex() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
357 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
358 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
359 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
360 | 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
|
361 | if platforms: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
362 | 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
|
363 | 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
|
364 | i1string, |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
365 | '",{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
|
366 | os.linesep, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
367 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
368 | 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
|
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.developmentStatusComboBox.currentIndex() != 0: |
9201 | 371 | 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
|
372 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
373 | 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
|
374 | while itm: |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
375 | 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
|
376 | 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
|
377 | 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
|
378 | 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
|
379 | |
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
|
380 | # 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
|
381 | 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
|
382 | if classifiers: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
383 | 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
|
384 | 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
|
385 | i1string, |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
386 | '",{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
|
387 | os.linesep, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
388 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
389 | 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
|
390 | del classifiers |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
391 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
392 | 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
|
393 | 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
|
394 | 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
|
395 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
396 | |
9201 | 397 | if self.pyVersionEdit.text(): |
398 | 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
|
399 | 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
|
400 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
401 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
402 | sourceCode += "{0}packages=find_packages(".format(istring) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
403 | src = Utilities.fromNativeSeparators(self.sourceDirectoryPicker.text()) |
8501
7b5f10581c35
Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8366
diff
changeset
|
404 | excludePatterns = [] |
7b5f10581c35
Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8366
diff
changeset
|
405 | 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
|
406 | 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
|
407 | 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
|
408 | 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
|
409 | if excludePatterns: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
410 | sourceCode += "," |
8501
7b5f10581c35
Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8366
diff
changeset
|
411 | else: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
412 | 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
|
413 | if excludePatterns: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
414 | 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
|
415 | 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
|
416 | i2string, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
417 | '",{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
|
418 | os.linesep, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
419 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
420 | 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
|
421 | sourceCode += "),{0}".format(os.linesep) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
422 | |
8501
7b5f10581c35
Removed the support for the deprecated distutils package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8366
diff
changeset
|
423 | if self.includePackageDataCheckBox.isChecked(): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
424 | 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
|
425 | istring, os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
426 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
427 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
428 | modules = [] |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
429 | 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
|
430 | 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
|
431 | if modules: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
432 | 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
|
433 | 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
|
434 | i1string, |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
435 | '",{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
|
436 | os.linesep, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
437 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
438 | 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
|
439 | del modules |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
440 | |
9201 | 441 | if self.entryPointsList.topLevelItemCount(): |
442 | entryPoints = { | |
443 | "console_scripts": [], | |
444 | "gui_scripts": [], | |
445 | } | |
446 | for row in range(self.entryPointsList.topLevelItemCount()): | |
447 | itm = self.entryPointsList.topLevelItem(row) | |
448 | entryPoints[itm.data(0, Qt.ItemDataRole.UserRole)].append( | |
449 | "{0} = {1}".format(itm.text(1), itm.text(2)) | |
450 | ) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
451 | sourceCode += "{0}entry_points={{{1}".format(istring, os.linesep) |
9201 | 452 | for epCategory in entryPoints: |
453 | if entryPoints[epCategory]: | |
454 | 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
|
455 | i1string, epCategory, os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
456 | ) |
9201 | 457 | for entryPoint in entryPoints[epCategory]: |
458 | 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
|
459 | i2string, entryPoint, os.linesep |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
460 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
461 | 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
|
462 | 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
|
463 | |
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
|
464 | 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
|
465 | return sourceCode |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
466 | |
9201 | 467 | def __getSetupCfgCode(self): |
468 | """ | |
469 | 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
|
470 | |
9201 | 471 | @return generated code |
472 | @rtype str | |
473 | """ | |
474 | from . import SetupCfgUtilities | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
475 | |
9201 | 476 | metadata = { |
477 | "name": self.nameEdit.text(), | |
478 | "version": self.versionEdit.text(), | |
479 | } | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
480 | |
9201 | 481 | if self.summaryEdit.text(): |
482 | 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
|
483 | |
9201 | 484 | if self.descriptionEdit.toPlainText(): |
485 | metadata["long_description"] = ( | |
486 | "file: {0}".format( | |
487 | ", ".join(self.descriptionEdit.toPlainText().splitlines()) | |
488 | ) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
489 | if self.descriptionFromFilesCheckBox.isChecked() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
490 | else self.descriptionEdit.toPlainText() |
9201 | 491 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
492 | |
9201 | 493 | if self.descriptionContentTypeComboBox.currentData(): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
494 | metadata[ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
495 | "long_description_content_type" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
496 | ] = self.descriptionContentTypeComboBox.currentData() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
497 | |
9201 | 498 | if self.authorEdit.text(): |
499 | metadata["author"] = self.authorEdit.text() | |
500 | 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
|
501 | |
9201 | 502 | if self.maintainerEdit.text(): |
503 | metadata["maintainer"] = self.maintainerEdit.text() | |
504 | 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
|
505 | |
9201 | 506 | metadata["url"] = self.homePageUrlEdit.text() |
507 | if self.downloadUrlEdit.text(): | |
508 | 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
|
509 | |
9201 | 510 | if self.projectUrlsList.topLevelItemCount(): |
511 | projectURLs = {} | |
512 | for row in range(self.projectUrlsList.topLevelItemCount()): | |
513 | urlItem = self.projectUrlsList.topLevelItem(row) | |
514 | projectURLs[urlItem.text(0)] = urlItem.text(1) | |
515 | 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
|
516 | |
9201 | 517 | classifiers = [] |
518 | if not self.licenseClassifierCheckBox.isChecked(): | |
519 | metadata["license"] = self.licenseEdit.text() | |
520 | else: | |
521 | classifiers.append( | |
522 | self.licenseClassifierComboBox.itemData( | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
523 | self.licenseClassifierComboBox.currentIndex() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
524 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
525 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
526 | |
9201 | 527 | platforms = self.platformsEdit.toPlainText().splitlines() |
528 | if platforms: | |
529 | 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
|
530 | |
9201 | 531 | if self.developmentStatusComboBox.currentIndex() != 0: |
532 | 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
|
533 | |
9201 | 534 | itm = self.classifiersList.topLevelItem(0) |
535 | while itm: | |
536 | itm.setExpanded(True) | |
537 | if itm.checkState(0) == Qt.CheckState.Checked: | |
538 | classifiers.append(itm.data(0, Qt.ItemDataRole.UserRole)) | |
539 | 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
|
540 | |
9201 | 541 | # cleanup classifiers list - remove all invalid entries |
542 | classifiers = [c for c in classifiers if bool(c)] | |
543 | if classifiers: | |
544 | 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
|
545 | |
9201 | 546 | if self.keywordsEdit.text(): |
547 | metadata["keywords"] = SetupCfgUtilities.toString( | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
548 | self.keywordsEdit.text().split() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
549 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
550 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
551 | options = {"packages": "find:"} |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
552 | |
9201 | 553 | if self.pyVersionEdit.text(): |
554 | 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
|
555 | |
9201 | 556 | findOptions = {} |
557 | src = Utilities.fromNativeSeparators(self.sourceDirectoryPicker.text()) | |
558 | excludePatterns = [] | |
559 | 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
|
560 | excludePatterns.append(self.excludePatternList.item(row).text()) |
9201 | 561 | if src: |
562 | options["package_dir"] = SetupCfgUtilities.toString({"": src}) | |
563 | findOptions["where"] = src | |
564 | if excludePatterns: | |
565 | 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
|
566 | |
9201 | 567 | if self.includePackageDataCheckBox.isChecked(): |
568 | 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
|
569 | packageData = {} # placeholder section |
9201 | 570 | else: |
571 | packageData = None | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
572 | |
9201 | 573 | modules = [] |
574 | for row in range(self.modulesList.count()): | |
575 | modules.append(self.modulesList.item(row).text()) | |
576 | if modules: | |
577 | 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
|
578 | |
9201 | 579 | if self.entryPointsList.topLevelItemCount(): |
580 | entryPoints = { | |
581 | "console_scripts": {}, | |
582 | "gui_scripts": {}, | |
583 | } | |
584 | for row in range(self.entryPointsList.topLevelItemCount()): | |
585 | itm = self.entryPointsList.topLevelItem(row) | |
586 | entryPoints[itm.data(0, Qt.ItemDataRole.UserRole)][ | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
587 | itm.text(1) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
588 | ] = itm.text(2) |
9201 | 589 | for epType in list(entryPoints.keys()): |
590 | if entryPoints[epType]: | |
591 | entryPoints[epType] = SetupCfgUtilities.toString( | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
592 | entryPoints[epType] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
593 | ) |
9201 | 594 | else: |
595 | del entryPoints[epType] | |
596 | else: | |
597 | entryPoints = {} | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
598 | |
9201 | 599 | configDict = { |
600 | "metadata": metadata, | |
601 | "options": options, | |
602 | "options.packages.find": findOptions, | |
603 | } | |
604 | if packageData is not None: | |
605 | configDict["options.package_data"] = packageData | |
606 | if entryPoints: | |
607 | 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
|
608 | |
9201 | 609 | cparser = configparser.ConfigParser() |
610 | cparser.read_dict(configDict) | |
611 | sio = io.StringIO() | |
612 | cparser.write(sio) | |
613 | sourceCode = sio.getvalue() | |
614 | return sourceCode | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
615 | |
9201 | 616 | def __getPyprojectCode(self): |
617 | """ | |
618 | 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
|
619 | |
9201 | 620 | @return generated code |
621 | @rtype str | |
622 | """ | |
623 | doc = tomlkit.document() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
624 | |
9201 | 625 | buildSystem = tomlkit.table() |
626 | buildSystem["requires"] = ["setuptools>=61.0.0", "wheel"] | |
627 | buildSystem["build-backend"] = "setuptools.build_meta" | |
628 | doc["build-system"] = buildSystem | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
629 | |
9201 | 630 | project = tomlkit.table() |
631 | project["name"] = self.nameEdit.text() | |
632 | 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
|
633 | |
9201 | 634 | if self.summaryEdit.text(): |
635 | 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
|
636 | |
9201 | 637 | if self.descriptionEdit.toPlainText(): |
638 | if self.descriptionFromFilesCheckBox.isChecked(): | |
639 | project["readme"] = self.descriptionEdit.toPlainText().splitlines()[0] | |
640 | else: | |
641 | readme = tomlkit.table() | |
642 | readme["text"] = self.descriptionEdit.toPlainText() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
643 | readme[ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
644 | "content-type" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
645 | ] = self.descriptionContentTypeComboBox.currentData() |
9201 | 646 | project["readme"] = readme |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
647 | |
9201 | 648 | if self.authorEdit.text(): |
649 | authors = tomlkit.array() | |
650 | author = tomlkit.inline_table() | |
651 | author["name"] = self.authorEdit.text() | |
652 | author["email"] = self.authorEmailEdit.text() | |
653 | authors.append(author) | |
654 | project["authors"] = authors | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
655 | |
9201 | 656 | if self.maintainerEdit.text(): |
657 | maintainers = tomlkit.array() | |
658 | maintainer = tomlkit.inline_table() | |
659 | maintainer["name"] = self.maintainerEdit.text() | |
660 | maintainer["email"] = self.maintainerEmailEdit.text() | |
661 | maintainers.append(maintainer) | |
662 | project["maintainers"] = maintainers | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
663 | |
9201 | 664 | urls = tomlkit.table() |
665 | urls["Homepage"] = self.homePageUrlEdit.text() | |
666 | if self.downloadUrlEdit.text(): | |
667 | 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
|
668 | |
9201 | 669 | if self.projectUrlsList.topLevelItemCount(): |
670 | for row in range(self.projectUrlsList.topLevelItemCount()): | |
671 | urlItem = self.projectUrlsList.topLevelItem(row) | |
672 | urls[urlItem.text(0)] = urlItem.text(1) | |
673 | project["urls"] = urls | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
674 | |
9201 | 675 | classifiers = [] |
676 | if not self.licenseClassifierCheckBox.isChecked(): | |
9205
b75da2ba2a1a
Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9202
diff
changeset
|
677 | licenseTbl = tomlkit.table() |
b75da2ba2a1a
Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9202
diff
changeset
|
678 | licenseTbl["text"] = self.licenseEdit.text() |
b75da2ba2a1a
Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9202
diff
changeset
|
679 | project["license"] = licenseTbl |
9201 | 680 | else: |
681 | classifiers.append( | |
682 | self.licenseClassifierComboBox.itemData( | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
683 | self.licenseClassifierComboBox.currentIndex() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
684 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
685 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
686 | |
9201 | 687 | if self.developmentStatusComboBox.currentIndex() != 0: |
688 | 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
|
689 | |
9201 | 690 | itm = self.classifiersList.topLevelItem(0) |
691 | while itm: | |
692 | itm.setExpanded(True) | |
693 | if itm.checkState(0) == Qt.CheckState.Checked: | |
694 | classifiers.append(itm.data(0, Qt.ItemDataRole.UserRole)) | |
695 | 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
|
696 | |
9201 | 697 | # cleanup classifiers list - remove all invalid entries |
698 | classifiers = [c for c in classifiers if bool(c)] | |
699 | if classifiers: | |
700 | classifiersArray = tomlkit.array() | |
701 | for classifier in classifiers: | |
702 | classifiersArray.add_line(classifier) | |
703 | classifiersArray.append(tomlkit.nl()) | |
704 | project["classifiers"] = classifiersArray | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
705 | |
9201 | 706 | if self.keywordsEdit.text(): |
707 | keywords = tomlkit.array() | |
708 | for kw in self.keywordsEdit.text().split(): | |
709 | keywords.add_line(kw) | |
710 | keywords.append(tomlkit.nl()) | |
711 | project["keywords"] = keywords | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
712 | |
9201 | 713 | if self.pyVersionEdit.text(): |
714 | 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
|
715 | |
9201 | 716 | if self.entryPointsList.topLevelItemCount(): |
717 | entryPoints = { | |
718 | "console_scripts": {}, | |
719 | "gui_scripts": {}, | |
720 | } | |
721 | for row in range(self.entryPointsList.topLevelItemCount()): | |
722 | itm = self.entryPointsList.topLevelItem(row) | |
723 | entryPoints[itm.data(0, Qt.ItemDataRole.UserRole)][ | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
724 | itm.text(1) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
725 | ] = itm.text(2) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
726 | |
9201 | 727 | if entryPoints["console_scripts"]: |
728 | scripts = tomlkit.table() | |
729 | for name, function in entryPoints["console_scripts"].items(): | |
730 | scripts[name] = function | |
731 | project["scripts"] = scripts | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
732 | |
9201 | 733 | if entryPoints["gui_scripts"]: |
734 | guiScripts = tomlkit.table() | |
735 | for name, function in entryPoints["gui_scripts"].items(): | |
736 | guiScripts[name] = function | |
737 | project["gui-scripts"] = guiScripts | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
738 | |
9201 | 739 | # placeholder |
740 | dependencies = tomlkit.array() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
741 | dependencies.append( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
742 | 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
|
743 | ) |
9201 | 744 | project["dependencies"] = dependencies |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
745 | |
9201 | 746 | doc["project"] = project |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
747 | |
9201 | 748 | setuptools = tomlkit.table() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
749 | |
9201 | 750 | platforms = self.platformsEdit.toPlainText().splitlines() |
751 | if platforms: | |
752 | platformsArray = tomlkit.array() | |
753 | for plt in platforms: | |
754 | platformsArray.add_line(plt) | |
755 | platformsArray.append(tomlkit.nl()) | |
756 | setuptools["platforms"] = platformsArray | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
757 | |
9201 | 758 | setuptools["include-package-data"] = self.includePackageDataCheckBox.isChecked() |
759 | if self.includePackageDataCheckBox.isChecked(): | |
760 | # placeholder | |
761 | 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
|
762 | setuptools["package-data"].add( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
763 | 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
|
764 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
765 | |
9201 | 766 | if self.modulesList.count(): |
767 | modulesArray = tomlkit.array() | |
768 | for row in range(self.modulesList.count()): | |
769 | modulesArray.add_line(self.modulesList.item(row).text()) | |
770 | modulesArray.append(tomlkit.nl()) | |
771 | setuptools["py-modules"] = modulesArray | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
772 | |
9201 | 773 | findspec = tomlkit.table() |
774 | src = Utilities.fromNativeSeparators(self.sourceDirectoryPicker.text()) | |
775 | excludePatterns = [] | |
776 | 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
|
777 | excludePatterns.append(self.excludePatternList.item(row).text()) |
9201 | 778 | if src: |
779 | findspec["where"] = [ericApp().getObject("Project").getRelativePath(src)] | |
780 | if excludePatterns: | |
781 | excludePatternsArray = tomlkit.array() | |
782 | for pattern in excludePatterns: | |
783 | excludePatternsArray.add_line(pattern) | |
784 | excludePatternsArray.append(tomlkit.nl()) | |
785 | findspec["exclude"] = excludePatternsArray | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
786 | |
9201 | 787 | if bool(findspec): |
788 | setuptools["packages"] = tomlkit.table(is_super_table=True) | |
789 | setuptools["packages"]["find"] = findspec | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
790 | |
9201 | 791 | doc["tool"] = tomlkit.table(is_super_table=True) |
792 | doc["tool"]["setuptools"] = setuptools | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
793 | |
9201 | 794 | sourceCode = tomlkit.dumps(doc) |
795 | return sourceCode | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
796 | |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
797 | @pyqtSlot() |
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
798 | def accept(self): |
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
799 | """ |
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
800 | Public slot to handle pressing the OK button. |
9201 | 801 | """ |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
802 | line, index = self.__editor.getCursorPosition() |
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
803 | 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
|
804 | indString = ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
805 | "\t" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
806 | if self.__editor.indentationsUseTabs() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
807 | else self.__editor.indentationWidth() * " " |
9205
b75da2ba2a1a
Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9202
diff
changeset
|
808 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
809 | |
9201 | 810 | if self.__category == "setup.py": |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
811 | sourceCode = self.__getSetupPyCode(indLevel, indString) |
9201 | 812 | elif self.__category == "setup.cfg": |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
813 | sourceCode = self.__getSetupCfgCode() |
9201 | 814 | elif self.__category == "pyproject.toml": |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
815 | sourceCode = self.__getPyprojectCode() |
9201 | 816 | else: |
817 | # 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
|
818 | sourceCode = "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
819 | |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
820 | if sourceCode: |
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
821 | line, index = self.__editor.getCursorPosition() |
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
822 | # 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
|
823 | self.__editor.beginUndoAction() |
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
824 | self.__editor.insertAt(sourceCode, line, index) |
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
825 | self.__editor.endUndoAction() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
826 | |
9202
81388c6065e8
Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9201
diff
changeset
|
827 | super().accept() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
828 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
829 | @pyqtSlot() |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
830 | 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
|
831 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
832 | 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
|
833 | current project. |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
834 | """ |
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
|
835 | project = ericApp().getObject("Project") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
836 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
837 | 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
|
838 | try: |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
839 | 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
|
840 | 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
|
841 | 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
|
842 | 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
|
843 | 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
|
844 | 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
|
845 | 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
|
846 | 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
|
847 | 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
|
848 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
849 | 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
|
850 | 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
|
851 | self.descriptionEdit.setPlainText(description) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
852 | |
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
|
853 | 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
|
854 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
855 | # 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
|
856 | self.projectButton.setEnabled(False) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
857 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
858 | 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
|
859 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
860 | 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
|
861 | |
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
|
862 | @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
|
863 | @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
|
864 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
865 | return Preferences.getMultiProject("Workspace") or Utilities.getHomeDir() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
866 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
867 | @pyqtSlot() |
9201 | 868 | 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
|
869 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
870 | Private slot to handle a change of selected items of the |
9201 | 871 | 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
|
872 | """ |
9201 | 873 | self.deleteEntryPointButton.setEnabled( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
874 | bool(self.entryPointsList.selectedItems()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
875 | ) |
9201 | 876 | self.editEntryPointButton.setEnabled( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
877 | len(self.entryPointsList.selectedItems()) == 1 |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
878 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
879 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
880 | @pyqtSlot() |
9201 | 881 | 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
|
882 | """ |
9201 | 883 | Private slot to delete the selected entry point items. |
884 | """ | |
885 | for itm in self.entryPointsList.selectedItems(): | |
886 | 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
|
887 | del itm |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
888 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
889 | @pyqtSlot() |
9201 | 890 | 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
|
891 | """ |
9201 | 892 | 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
|
893 | """ |
9201 | 894 | project = ericApp().getObject("Project") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
895 | rootDir = project.getProjectPath() if project.isOpen() else "" |
9201 | 896 | dlg = AddEntryPointDialog(rootDir, parent=self) |
897 | if dlg.exec() == QDialog.DialogCode.Accepted: | |
898 | epType, epCategory, name, script = dlg.getEntryPoint() | |
899 | itm = QTreeWidgetItem(self.entryPointsList, [epType, name, script]) | |
900 | 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
|
901 | |
9201 | 902 | @pyqtSlot() |
903 | def on_editEntryPointButton_clicked(self): | |
904 | """ | |
905 | Private slot to edit the selected entry point. | |
906 | """ | |
907 | project = ericApp().getObject("Project") | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
908 | 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
|
909 | itm = self.entryPointsList.selectedItems()[0] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
910 | dlg = AddEntryPointDialog( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
911 | rootDir, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
912 | epType=itm.text(0), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
913 | name=itm.text(1), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
914 | script=itm.text(2), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
915 | parent=self, |
9201 | 916 | ) |
917 | if dlg.exec() == QDialog.DialogCode.Accepted: | |
918 | epType, epCategory, name, script = dlg.getEntryPoint() | |
919 | itm.setText(0, epType) | |
920 | itm.setText(1, name) | |
921 | itm.setText(2, script) | |
922 | 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
|
923 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
924 | @pyqtSlot() |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
925 | 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
|
926 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
927 | 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
|
928 | modules list. |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
929 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
930 | 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
|
931 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
932 | @pyqtSlot() |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
933 | 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
|
934 | """ |
9201 | 935 | 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
|
936 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
937 | for itm in self.modulesList.selectedItems(): |
9201 | 938 | 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
|
939 | del itm |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
940 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
941 | @pyqtSlot() |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
942 | 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
|
943 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
944 | 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
|
945 | """ |
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
|
946 | 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
|
947 | 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
|
948 | self, |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
949 | 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
|
950 | startDir, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
951 | self.tr("Python Files (*.py)"), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
952 | ) |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
953 | for module in modulesList: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
954 | module = module.replace(Utilities.toNativeSeparators(startDir), "") |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
955 | 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
|
956 | 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
|
957 | if module: |
9201 | 958 | QListWidgetItem( |
959 | str(pathlib.Path(module).with_suffix("")) | |
960 | .replace("\\", ".") | |
961 | .replace("/", "."), | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
962 | self.modulesList, |
9201 | 963 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
964 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
965 | @pyqtSlot() |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
966 | 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
|
967 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
968 | 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
|
969 | 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
|
970 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
971 | self.deleteExcludePatternButton.setEnabled( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
972 | bool(self.excludePatternList.selectedItems()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
973 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
974 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
975 | @pyqtSlot() |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
976 | 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
|
977 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
978 | 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
|
979 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
980 | 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
|
981 | 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
|
982 | del itm |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
983 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
984 | @pyqtSlot() |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
985 | 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
|
986 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
987 | 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
|
988 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
989 | 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
|
990 | 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
|
991 | 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
|
992 | ): |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
993 | QListWidgetItem(pattern, self.excludePatternList) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
994 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
995 | @pyqtSlot(str) |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
996 | 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
|
997 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
998 | 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
|
999 | |
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
|
1000 | @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
|
1001 | @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
|
1002 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1003 | 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
|
1004 | |
6015
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1005 | @pyqtSlot() |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1006 | 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
|
1007 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1008 | 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
|
1009 | 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
|
1010 | """ |
26fc8e08f4ac
Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1011 | self.on_addExludePatternButton_clicked() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1012 | |
9201 | 1013 | @pyqtSlot() |
1014 | def on_urlDeleteButton_clicked(self): | |
1015 | """ | |
1016 | Private slot to delete the selected URL items. | |
1017 | """ | |
1018 | for itm in self.projectUrlsList.selectedItems(): | |
1019 | self.projectUrlsList.takeTopLevelItem(self.projectUrlsList.row(itm)) | |
1020 | del itm | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1021 | |
9201 | 1022 | @pyqtSlot() |
1023 | def on_urlAddButton_clicked(self): | |
1024 | """ | |
1025 | Private slot to add a project URL to the list. | |
1026 | """ | |
1027 | dlg = AddProjectUrlDialog(parent=self) | |
1028 | if dlg.exec() == QDialog.DialogCode.Accepted: | |
1029 | name, url = dlg.getUrl() | |
1030 | 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
|
1031 | |
9201 | 1032 | @pyqtSlot() |
1033 | def on_urlEditButton_clicked(self): | |
1034 | """ | |
1035 | Private slot to edit the selected project URL. | |
1036 | """ | |
1037 | itm = self.projectUrlsList.selectedItems()[0] | |
1038 | dlg = AddProjectUrlDialog(name=itm.text(0), url=itm.text(1), parent=self) | |
1039 | if dlg.exec() == QDialog.DialogCode.Accepted: | |
1040 | name, url = dlg.getUrl() | |
1041 | itm.setText(0, name) | |
1042 | itm.setText(1, url) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1043 | |
9201 | 1044 | @pyqtSlot() |
1045 | def on_projectUrlsList_itemSelectionChanged(self): | |
1046 | """ | |
1047 | Private slot to handle a change of selected items of the | |
1048 | project URLs list. | |
1049 | """ | |
1050 | self.urlDeleteButton.setEnabled(bool(self.projectUrlsList.selectedItems())) | |
1051 | self.urlEditButton.setEnabled(len(self.projectUrlsList.selectedItems()) == 1) |