src/eric7/Plugins/WizardPlugins/EricPluginWizard/PluginWizardDialog.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
--- a/src/eric7/Plugins/WizardPlugins/EricPluginWizard/PluginWizardDialog.py	Wed Jul 13 11:16:20 2022 +0200
+++ b/src/eric7/Plugins/WizardPlugins/EricPluginWizard/PluginWizardDialog.py	Wed Jul 13 14:55:47 2022 +0200
@@ -15,10 +15,18 @@
 from .Ui_PluginWizardDialog import Ui_PluginWizardDialog
 
 from .Templates import (
-    mainTemplate, configTemplate0, configTemplate1, configTemplate2,
-    configTemplate3, onDemandTemplate, previewPixmapTemplate,
-    moduleSetupTemplate, exeDisplayDataTemplate, exeDisplayDataInfoTemplate,
-    exeDisplayDataListTemplate, apiFilesTemplate
+    mainTemplate,
+    configTemplate0,
+    configTemplate1,
+    configTemplate2,
+    configTemplate3,
+    onDemandTemplate,
+    previewPixmapTemplate,
+    moduleSetupTemplate,
+    exeDisplayDataTemplate,
+    exeDisplayDataInfoTemplate,
+    exeDisplayDataListTemplate,
+    apiFilesTemplate,
 )
 
 
@@ -26,24 +34,24 @@
     """
     Class implementing the eric plug-in wizard dialog.
     """
+
     def __init__(self, parent=None):
         """
         Constructor
-        
+
         @param parent reference to the parent widget (QWidget)
         """
         super().__init__(parent)
         self.setupUi(self)
-        
+
         self.dataTabWidget.setCurrentIndex(0)
-        
-        self.__okButton = self.buttonBox.button(
-            QDialogButtonBox.StandardButton.Ok)
+
+        self.__okButton = self.buttonBox.button(QDialogButtonBox.StandardButton.Ok)
         self.__okButton.setEnabled(False)
-        
+
         projectOpen = ericApp().getObject("Project").isOpen()
         self.projectButton.setEnabled(projectOpen)
-        
+
         self.nameEdit.textChanged.connect(self.__enableOkButton)
         self.versionEdit.textChanged.connect(self.__enableOkButton)
         self.authorEdit.textChanged.connect(self.__enableOkButton)
@@ -57,33 +65,34 @@
         self.autoActivateCheckBox.toggled.connect(self.__enableOkButton)
         self.pluginTypeCombo.currentIndexChanged.connect(self.__enableOkButton)
         self.pluginTypeNameEdit.textChanged.connect(self.__enableOkButton)
-        
+
         self.pluginTypeCombo.addItems(["", "viewmanager", "version_control"])
-    
+
     def __enableOkButton(self):
         """
         Private slot to set the state of the OK button.
         """
         enable = (
-            bool(self.nameEdit.text()) and
-            bool(self.versionEdit.text()) and
-            bool(self.authorEdit.text()) and
-            bool(self.authorEmailEdit.text()) and
-            bool(self.classNameEdit.text()) and
-            bool(self.packageNameEdit.text()) and
-            bool(self.shortDescriptionEdit.text()) and
-            bool(self.longDescriptionEdit.toPlainText())
+            bool(self.nameEdit.text())
+            and bool(self.versionEdit.text())
+            and bool(self.authorEdit.text())
+            and bool(self.authorEmailEdit.text())
+            and bool(self.classNameEdit.text())
+            and bool(self.packageNameEdit.text())
+            and bool(self.shortDescriptionEdit.text())
+            and bool(self.longDescriptionEdit.toPlainText())
         )
         if self.configurationGroup.isChecked():
             enable = enable and bool(self.preferencesKeyEdit.text())
         if not self.autoActivateCheckBox.isChecked():
-            enable = (enable and
-                      bool(self.pluginTypeCombo.currentText()) and
-                      bool(self.pluginTypeNameEdit.text())
-                      )
-        
+            enable = (
+                enable
+                and bool(self.pluginTypeCombo.currentText())
+                and bool(self.pluginTypeNameEdit.text())
+            )
+
         self.__okButton.setEnabled(enable)
-    
+
     @pyqtSlot()
     def on_projectButton_clicked(self):
         """
@@ -91,7 +100,7 @@
         current project.
         """
         project = ericApp().getObject("Project")
-        
+
         try:
             self.versionEdit.setText(project.getProjectVersion())
             self.authorEdit.setText(project.getProjectAuthor())
@@ -102,20 +111,21 @@
             self.authorEdit.setText(project.pdata["AUTHOR"][0])
             self.authorEmailEdit.setText(project.pdata["EMAIL"][0])
             description = project.pdata["DESCRIPTION"][0]
-        
+
         # summary is max. 55 characters long
-        summary = (description.split(".", 1)[0]
-                   .replace("\r", "").replace("\n", "") + ".")[:55]
+        summary = (
+            description.split(".", 1)[0].replace("\r", "").replace("\n", "") + "."
+        )[:55]
         self.shortDescriptionEdit.setText(summary)
         self.longDescriptionEdit.setPlainText(description)
-        
+
         # prevent overwriting of entries by disabling the button
         self.projectButton.setEnabled(False)
-    
+
     def getCode(self):
         """
         Public method to get the source code.
-        
+
         @return generated code (string)
         """
         templateData = {
@@ -132,38 +142,40 @@
             "longDescription": self.longDescriptionEdit.toPlainText(),
             "needsRestart": self.restartCheckBox.isChecked(),
         }
-        
+
         if self.configurationGroup.isChecked():
             templateData["config0"] = configTemplate0
             templateData["config1"] = configTemplate1.format(
-                className=self.classNameEdit.text())
+                className=self.classNameEdit.text()
+            )
             templateData["config2"] = configTemplate2.format(
-                preferencesKey=self.preferencesKeyEdit.text())
+                preferencesKey=self.preferencesKeyEdit.text()
+            )
             templateData["config3"] = configTemplate3
         else:
             templateData["config0"] = ""
             templateData["config1"] = ""
             templateData["config2"] = ""
             templateData["config3"] = ""
-        
+
         if self.autoActivateCheckBox.isChecked():
             templateData["onDemand"] = ""
         else:
             templateData["onDemand"] = onDemandTemplate.format(
                 pluginType=self.pluginTypeCombo.currentText(),
-                pluginTypename=self.pluginTypeNameEdit.text()
+                pluginTypename=self.pluginTypeNameEdit.text(),
             )
-        
+
         if self.pixmapCheckBox.isChecked():
             templateData["preview"] = previewPixmapTemplate
         else:
             templateData["preview"] = ""
-        
+
         if self.moduleSetupCheckBox.isChecked():
             templateData["modulesetup"] = moduleSetupTemplate
         else:
             templateData["modulesetup"] = ""
-        
+
         templateData["exeData"] = ""
         if self.exeGroup.isChecked():
             if self.exeRadioButton.isChecked():
@@ -172,30 +184,30 @@
                 templateData["exeData"] = exeDisplayDataInfoTemplate
             elif self.exeListRadioButton.isChecked():
                 templateData["exeData"] = exeDisplayDataListTemplate
-        
+
         if self.apiFilesCheckBox.isChecked():
             templateData["apiFiles"] = apiFilesTemplate
         else:
             templateData["apiFiles"] = ""
-        
+
         return mainTemplate.format(**templateData)
-    
+
     def packageName(self):
         """
         Public method to retrieve the plug-in package name.
-        
+
         @return plug-in package name (string)
         """
         if self.createPackageCheckBox.isChecked():
             return self.packageNameEdit.text()
         else:
             return ""
-    
+
     @pyqtSlot(str)
     def on_pluginTypeCombo_currentTextChanged(self, txt):
         """
         Private slot to react upon the selection of a plug-in type.
-        
+
         @param txt selected plug-in type (string)
         """
         self.pixmapCheckBox.setChecked(txt == "viewmanager")

eric ide

mercurial