diff -r e9e7eca7efee -r bf71ee032bb4 src/eric7/Plugins/PluginWizardSetup.py --- a/src/eric7/Plugins/PluginWizardSetup.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/Plugins/PluginWizardSetup.py Wed Jul 13 14:55:47 2022 +0200 @@ -41,29 +41,30 @@ """ Class implementing the setup.py wizard plug-in. """ + def __init__(self, ui): """ Constructor - + @param ui reference to the user interface object @type UI.UserInterface """ super().__init__(ui) self.__ui = ui self.__actions = [] - + def activate(self): """ Public method to activate this plug-in. - + @return tuple of None and activation status @rtype tuple of (None, boolean) """ self.__initActions() self.__initMenu() - + return None, True - + def deactivate(self): """ Public method to deactivate this plug-in. @@ -72,64 +73,79 @@ if menu: for act in self.__actions: menu.removeAction(act) - self.__ui.removeEricActions(self.__actions, 'wizards') - + self.__ui.removeEricActions(self.__actions, "wizards") + def __initActions(self): """ Private method to initialize the actions. """ # 1. action for 'setup.py' creation act = EricAction( - self.tr('setup.py Wizard'), - self.tr('setup.py Wizard...'), - 0, 0, self, - 'wizards_setup_py') - act.setStatusTip(self.tr('setup.py Wizard')) - act.setWhatsThis(self.tr( - """<b>setup.py Wizard</b>""" - """<p>This wizard opens a dialog for entering all the parameters""" - """ needed to create the basic contents of a setup.py file. The""" - """ generated code is inserted at the current cursor position.""" - """</p>""" - )) + self.tr("setup.py Wizard"), + self.tr("setup.py Wizard..."), + 0, + 0, + self, + "wizards_setup_py", + ) + act.setStatusTip(self.tr("setup.py Wizard")) + act.setWhatsThis( + self.tr( + """<b>setup.py Wizard</b>""" + """<p>This wizard opens a dialog for entering all the parameters""" + """ needed to create the basic contents of a setup.py file. The""" + """ generated code is inserted at the current cursor position.""" + """</p>""" + ) + ) act.triggered.connect(functools.partial(self.__handle, "setup.py")) self.__actions.append(act) - + # 2. action for 'setup.cfg' creation act = EricAction( - self.tr('setup.cfg Wizard'), - self.tr('setup.cfg Wizard...'), - 0, 0, self, - 'wizards_setup_cfg') - act.setStatusTip(self.tr('setup.cfg Wizard')) - act.setWhatsThis(self.tr( - """<b>setup.cfg Wizard</b>""" - """<p>This wizard opens a dialog for entering all the parameters""" - """ needed to create the basic contents of a setup.cfg file. The""" - """ generated code is inserted at the current cursor position.""" - """</p>""" - )) + self.tr("setup.cfg Wizard"), + self.tr("setup.cfg Wizard..."), + 0, + 0, + self, + "wizards_setup_cfg", + ) + act.setStatusTip(self.tr("setup.cfg Wizard")) + act.setWhatsThis( + self.tr( + """<b>setup.cfg Wizard</b>""" + """<p>This wizard opens a dialog for entering all the parameters""" + """ needed to create the basic contents of a setup.cfg file. The""" + """ generated code is inserted at the current cursor position.""" + """</p>""" + ) + ) act.triggered.connect(functools.partial(self.__handle, "setup.cfg")) self.__actions.append(act) - + # 3. action for 'pyproject.toml' creation act = EricAction( - self.tr('pyproject.toml Wizard'), - self.tr('pyproject.toml Wizard...'), - 0, 0, self, - 'wizards_pyproject_toml') - act.setStatusTip(self.tr('pyproject.toml Wizard')) - act.setWhatsThis(self.tr( - """<b>pyproject.toml Wizard</b>""" - """<p>This wizard opens a dialog for entering all the parameters""" - """ needed to create the basic contents of a pyproject.toml file. The""" - """ generated code is inserted at the current cursor position.""" - """</p>""" - )) + self.tr("pyproject.toml Wizard"), + self.tr("pyproject.toml Wizard..."), + 0, + 0, + self, + "wizards_pyproject_toml", + ) + act.setStatusTip(self.tr("pyproject.toml Wizard")) + act.setWhatsThis( + self.tr( + """<b>pyproject.toml Wizard</b>""" + """<p>This wizard opens a dialog for entering all the parameters""" + """ needed to create the basic contents of a pyproject.toml file. The""" + """ generated code is inserted at the current cursor position.""" + """</p>""" + ) + ) act.triggered.connect(functools.partial(self.__handle, "pyproject.toml")) self.__actions.append(act) - - self.__ui.addEricActions(self.__actions, 'wizards') + + self.__ui.addEricActions(self.__actions, "wizards") def __initMenu(self): """ @@ -138,28 +154,28 @@ menu = self.__ui.getMenu("wizards") if menu: menu.addActions(self.__actions) - + def __handle(self, category): """ Private method to handle the wizards action. - + @param category category of setup file to create @type str """ - from WizardPlugins.SetupWizard.SetupWizardDialog import ( - SetupWizardDialog - ) - + from WizardPlugins.SetupWizard.SetupWizardDialog import SetupWizardDialog + editor = ericApp().getObject("ViewManager").activeWindow() - + if editor is None: EricMessageBox.critical( self.__ui, - self.tr('No current editor'), - self.tr('Please open or create a file first.')) + self.tr("No current editor"), + self.tr("Please open or create a file first."), + ) else: dlg = SetupWizardDialog(category, editor, self.__ui) dlg.show() + # # eflag: noqa = M801