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