src/eric7/Plugins/PluginWizardSetup.py

Sat, 26 Apr 2025 12:34:32 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 26 Apr 2025 12:34:32 +0200
branch
eric7
changeset 11240
c48c615c04a3
parent 11204
5cffd6e2b1d6
permissions
-rw-r--r--

MicroPython
- Added a configuration option to disable the support for the no longer produced Pimoroni Pico Wireless Pack.

6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
11090
f5f5f5803935 Updated copyright for 2025.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10730
diff changeset
3 # Copyright (c) 2013 - 2025 Detlev Offenbach <detlev@die-offenbachs.de>
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the setup.py wizard plug-in.
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
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
10 import functools
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
11
8318
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
12 from PyQt6.QtCore import QObject
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
10730
454f6ff4e1cd Corrected some imports ordering.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10716
diff changeset
14 from eric7.__version__ import VersionOnly
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
15 from eric7.EricGui.EricAction import EricAction
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
16 from eric7.EricWidgets import EricMessageBox
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
17 from eric7.EricWidgets.EricApplication import ericApp
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 # Start-of-Header
10061
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
20 __header__ = {
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
21 "name": "setup.py Wizard Plug-in",
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
22 "author": "Detlev Offenbach <detlev@die-offenbachs.de>",
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
23 "autoactivate": True,
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
24 "deactivateable": True,
10716
11cdcc824469 Relocated the Version information into a top level '__version__.py' module.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
25 "version": VersionOnly,
10061
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
26 "className": "SetupWizard",
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
27 "packageName": "__core__",
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
28 "shortDescription": "Wizard for the creation of a setup.py file.",
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
29 "longDescription": (
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
30 """This plug-in implements a wizard to generate code for"""
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
31 """ a setup.py file. It supports the 'setuptools' variant."""
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
32 ),
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
33 "needsRestart": False,
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
34 "pyqtApi": 2,
8bdad5699288 Introduced a new style for the plugin header.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
35 }
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 # End-of-Header
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37
11148
15e30f0c76a8 Adjusted the code to the modified issue codes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11090
diff changeset
38 error = "" # noqa: U-200
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 class SetupWizard(QObject):
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 """
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 Class implementing the setup.py wizard plug-in.
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
45
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 def __init__(self, ui):
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 """
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 Constructor
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
49
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
50 @param ui reference to the user interface object
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
51 @type UI.UserInterface
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 """
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
53 super().__init__(ui)
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 self.__ui = ui
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
55 self.__actions = []
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
56
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 def activate(self):
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 """
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 Public method to activate this plug-in.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
60
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
61 @return tuple of None and activation status
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
62 @rtype tuple of (None, boolean)
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 """
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
64 self.__initActions()
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 self.__initMenu()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
66
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 return None, True
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
68
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 def deactivate(self):
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 """
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 Public method to deactivate this plug-in.
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 """
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 menu = self.__ui.getMenu("wizards")
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 if menu:
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
75 for act in self.__actions:
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
76 menu.removeAction(act)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
77 self.__ui.removeEricActions(self.__actions, "wizards")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
78
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
79 def __initActions(self):
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 """
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
81 Private method to initialize the actions.
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 """
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
83 # 1. action for 'setup.py' creation
11203
2ea34362b6b6 Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11148
diff changeset
84 # Note: Use of setup.py is deprecated.
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
85 act = EricAction(
11203
2ea34362b6b6 Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11148
diff changeset
86 self.tr("setup.py Wizard (deprecated)"),
2ea34362b6b6 Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11148
diff changeset
87 self.tr("setup.py Wizard (deprecated)..."),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
88 0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
89 0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
90 self,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
91 "wizards_setup_py",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
92 )
11203
2ea34362b6b6 Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11148
diff changeset
93 act.setStatusTip(self.tr("setup.py Wizard (deprecated)"))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
94 act.setWhatsThis(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
95 self.tr(
11203
2ea34362b6b6 Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11148
diff changeset
96 """<b>setup.py Wizard (deprecated)</b>"""
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
97 """<p>This wizard opens a dialog for entering all the parameters"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
98 """ needed to create the basic contents of a setup.py file. The"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
99 """ generated code is inserted at the current cursor position."""
11203
2ea34362b6b6 Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11148
diff changeset
100 """</p><p><b>Note:</b> The use of setup.py is deprecated. Use"""
11204
5cffd6e2b1d6 Updated translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11203
diff changeset
101 """ <b>pyproject.toml</b> instead.</p>"""
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
102 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
103 )
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
104 act.triggered.connect(functools.partial(self.__handle, "setup.py"))
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
105 self.__actions.append(act)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
106
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
107 # 2. action for 'setup.cfg' creation
11203
2ea34362b6b6 Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11148
diff changeset
108 # Note: Use of setup.cfg is deprecated.
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
109 act = EricAction(
11203
2ea34362b6b6 Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11148
diff changeset
110 self.tr("setup.cfg Wizard (deprecated)"),
2ea34362b6b6 Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11148
diff changeset
111 self.tr("setup.cfg Wizard (deprecated)..."),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
112 0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
113 0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
114 self,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
115 "wizards_setup_cfg",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
116 )
11203
2ea34362b6b6 Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11148
diff changeset
117 act.setStatusTip(self.tr("setup.cfg Wizard (deprecated)"))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
118 act.setWhatsThis(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
119 self.tr(
11203
2ea34362b6b6 Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11148
diff changeset
120 """<b>setup.cfg Wizard (deprecated)</b>"""
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
121 """<p>This wizard opens a dialog for entering all the parameters"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
122 """ needed to create the basic contents of a setup.cfg file. The"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
123 """ generated code is inserted at the current cursor position."""
11203
2ea34362b6b6 Modified the SetupWizardDialog to adhere to the pyproject.toml guidelines wrt. the license entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11148
diff changeset
124 """</p><p><b>Note:</b> The use of setup.cfg is deprecated. Use"""
11204
5cffd6e2b1d6 Updated translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11203
diff changeset
125 """ <b>pyproject.toml</b> instead.</p>"""
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
126 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
127 )
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
128 act.triggered.connect(functools.partial(self.__handle, "setup.cfg"))
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
129 self.__actions.append(act)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
130
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
131 # 3. action for 'pyproject.toml' creation
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
132 act = EricAction(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
133 self.tr("pyproject.toml Wizard"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
134 self.tr("pyproject.toml Wizard..."),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
135 0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
136 0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
137 self,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
138 "wizards_pyproject_toml",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
139 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
140 act.setStatusTip(self.tr("pyproject.toml Wizard"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
141 act.setWhatsThis(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
142 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
143 """<b>pyproject.toml Wizard</b>"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
144 """<p>This wizard opens a dialog for entering all the parameters"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
145 """ needed to create the basic contents of a pyproject.toml file. The"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
146 """ generated code is inserted at the current cursor position."""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
147 """</p>"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
148 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
149 )
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
150 act.triggered.connect(functools.partial(self.__handle, "pyproject.toml"))
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
151 self.__actions.append(act)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
152
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
153 self.__ui.addEricActions(self.__actions, "wizards")
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 def __initMenu(self):
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 """
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 Private method to add the actions to the right menu.
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 """
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 menu = self.__ui.getMenu("wizards")
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 if menu:
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
161 menu.addActions(self.__actions)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
162
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
163 def __handle(self, category):
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 """
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 Private method to handle the wizards action.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
166
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
167 @param category category of setup file to create
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
168 @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
169 """
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
170 from eric7.Plugins.WizardPlugins.SetupWizard.SetupWizardDialog import (
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
171 SetupWizardDialog,
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
172 )
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
173
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: 8318
diff changeset
174 editor = ericApp().getObject("ViewManager").activeWindow()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
175
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 if editor is None:
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: 8318
diff changeset
177 EricMessageBox.critical(
6735
31e263d49c04 Fixed some code style issues detected by the updated style checker (over-indented lines).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
178 self.__ui,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
179 self.tr("No current editor"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
180 self.tr("Please open or create a file first."),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
181 )
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182 else:
9202
81388c6065e8 Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9201
diff changeset
183 dlg = SetupWizardDialog(category, editor, self.__ui)
81388c6065e8 Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9201
diff changeset
184 dlg.show()
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
186
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 #
11148
15e30f0c76a8 Adjusted the code to the modified issue codes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11090
diff changeset
188 # eflag: noqa = M-801

eric ide

mercurial