src/eric7/Plugins/PluginWizardSetup.py

Wed, 13 Jul 2022 14:55:47 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 13 Jul 2022 14:55:47 +0200
branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
permissions
-rw-r--r--

Reformatted the source code using the 'Black' utility.

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: 8757
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 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
8358
144a6b854f70 Sorted the eric specific extensions into packages named like the corresponding PyQt packages (i.e. EricCore,EricGui and EricWidgets).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8356
diff changeset
14 from EricWidgets.EricApplication import ericApp
144a6b854f70 Sorted the eric specific extensions into packages named like the corresponding PyQt packages (i.e. EricCore,EricGui and EricWidgets).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8356
diff changeset
15 from EricGui.EricAction import EricAction
144a6b854f70 Sorted the eric specific extensions into packages named like the corresponding PyQt packages (i.e. EricCore,EricGui and EricWidgets).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8356
diff changeset
16 from EricWidgets import EricMessageBox
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 import UI.Info
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 # Start-of-Header
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 name = "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
22 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 autoactivate = True
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 deactivateable = True
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 version = UI.Info.VersionOnly
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 className = "SetupWizard"
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 packageName = "__core__"
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 shortDescription = "Wizard for the creation of a setup.py file."
7256
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
29 longDescription = (
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
30 """This plug-in implements a wizard to generate code for"""
8757
23b2fe1cd863 Corrected the Setup wizard dialog and changed it to use the EricPathPicker widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8367
diff changeset
31 """ a setup.py file. It supports the 'setuptools' variant."""
7256
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
32 )
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 needsRestart = False
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 pyqtApi = 2
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 # 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
36
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 error = ""
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38
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 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
41 """
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 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
43 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
44
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 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
46 """
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 Constructor
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
48
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
49 @param ui reference to the user interface object
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
50 @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
51 """
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
52 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
53 self.__ui = ui
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
54 self.__actions = []
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
55
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 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
57 """
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 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
59
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
60 @return tuple of None and activation status
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
61 @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
62 """
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
63 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
64 self.__initMenu()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
65
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 return None, True
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
67
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 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
69 """
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 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
71 """
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 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
73 if menu:
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
74 for act in self.__actions:
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
75 menu.removeAction(act)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
76 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
77
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
78 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
79 """
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
80 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
81 """
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
82 # 1. action for 'setup.py' creation
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
83 act = EricAction(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
84 self.tr("setup.py Wizard"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
85 self.tr("setup.py Wizard..."),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
86 0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
87 0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
88 self,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
89 "wizards_setup_py",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
90 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
91 act.setStatusTip(self.tr("setup.py Wizard"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
92 act.setWhatsThis(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
93 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
94 """<b>setup.py Wizard</b>"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
95 """<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
96 """ 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
97 """ 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
98 """</p>"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
99 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
100 )
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
101 act.triggered.connect(functools.partial(self.__handle, "setup.py"))
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
102 self.__actions.append(act)
9221
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 # 2. action for 'setup.cfg' creation
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
105 act = EricAction(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
106 self.tr("setup.cfg Wizard"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
107 self.tr("setup.cfg Wizard..."),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
108 0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
109 0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
110 self,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
111 "wizards_setup_cfg",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
112 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
113 act.setStatusTip(self.tr("setup.cfg Wizard"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
114 act.setWhatsThis(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
115 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
116 """<b>setup.cfg Wizard</b>"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
117 """<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
118 """ 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
119 """ 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
120 """</p>"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
121 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
122 )
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
123 act.triggered.connect(functools.partial(self.__handle, "setup.cfg"))
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
124 self.__actions.append(act)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
125
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
126 # 3. action for 'pyproject.toml' creation
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
127 act = EricAction(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
128 self.tr("pyproject.toml Wizard"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
129 self.tr("pyproject.toml Wizard..."),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
130 0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
131 0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
132 self,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
133 "wizards_pyproject_toml",
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 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
136 act.setWhatsThis(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
137 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
138 """<b>pyproject.toml Wizard</b>"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
139 """<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
140 """ 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
141 """ 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
142 """</p>"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
143 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
144 )
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
145 act.triggered.connect(functools.partial(self.__handle, "pyproject.toml"))
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
146 self.__actions.append(act)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
147
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
148 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
149
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 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
151 """
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152 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
153 """
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 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
155 if menu:
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
156 menu.addActions(self.__actions)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
157
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
158 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
159 """
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 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
161
9201
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
162 @param category category of setup file to create
2f1ccadee231 setup Wizard
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
163 @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
164 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
165 from WizardPlugins.SetupWizard.SetupWizardDialog import SetupWizardDialog
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
166
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
167 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
168
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 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
170 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
171 self.__ui,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
172 self.tr("No current editor"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
173 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
174 )
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 else:
9202
81388c6065e8 Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9201
diff changeset
176 dlg = SetupWizardDialog(category, editor, self.__ui)
81388c6065e8 Refined the setup wizard a little bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9201
diff changeset
177 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
178
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
179
6015
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 #
26fc8e08f4ac Added the setup.py wizard plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 # eflag: noqa = M801

eric ide

mercurial