PluginPyInstaller.py

branch
eric7
changeset 55
3794f1ca53af
parent 54
359e2d772474
child 56
02709629940d
diff -r 359e2d772474 -r 3794f1ca53af PluginPyInstaller.py
--- a/PluginPyInstaller.py	Sat Dec 23 15:48:50 2023 +0100
+++ b/PluginPyInstaller.py	Sat Dec 23 16:30:39 2023 +0100
@@ -103,7 +103,7 @@
         # Windows
         #
         try:
-            import winreg
+            import winreg  # noqa: I101, I103
         except ImportError:
             import _winreg as winreg  # __IGNORE_WARNING__
 
@@ -390,7 +390,7 @@
 
         self.__initialize()
 
-    def __projectShowMenu(self, menuName, menu):
+    def __projectShowMenu(self, menuName, menu):  # noqa: U100
         """
         Private slot called, when the the project menu or a submenu is
         about to be shown.
@@ -434,6 +434,9 @@
         Private slot to execute the pyinstaller command for the current
         project.
         """
+        from PyInstallerInterface.PyInstallerConfigDialog import PyInstallerConfigDialog
+        from PyInstallerInterface.PyInstallerExecDialog import PyInstallerExecDialog
+
         project = ericApp().getObject("Project")
         majorVersionStr = project.getProjectLanguage()
         if majorVersionStr == "Python3":
@@ -444,9 +447,7 @@
                 EricMessageBox.critical(
                     self.__ui,
                     self.tr("pyinstaller"),
-                    self.tr(
-                        """The pyinstaller executable could not be""" """ found."""
-                    ),
+                    self.tr("""The pyinstaller executable could not be found."""),
                 )
                 return
 
@@ -454,10 +455,6 @@
             if not project.checkAllScriptsDirty(reportSyntaxErrors=True):
                 return
 
-            from PyInstallerInterface.PyInstallerConfigDialog import (
-                PyInstallerConfigDialog,
-            )
-
             params = project.getData("PACKAGERSPARMS", "PYINSTALLER")
             dlg = PyInstallerConfigDialog(
                 project, executables, params, mode="installer"
@@ -467,13 +464,9 @@
                 project.setData("PACKAGERSPARMS", "PYINSTALLER", params)
 
                 # now do the call
-                from PyInstallerInterface.PyInstallerExecDialog import (
-                    PyInstallerExecDialog,
-                )
-
                 dia = PyInstallerExecDialog("pyinstaller")
                 dia.show()
-                res = dia.start(args, params, project, script)
+                res = dia.start(args, project, script)
                 if res:
                     dia.exec()
 
@@ -483,6 +476,9 @@
         Private slot to execute the pyi-makespec command for the current
         project to generate a spec file to be used by pyinstaller.
         """
+        from PyInstallerInterface.PyInstallerConfigDialog import PyInstallerConfigDialog
+        from PyInstallerInterface.PyInstallerExecDialog import PyInstallerExecDialog
+
         project = ericApp().getObject("Project")
         majorVersionStr = project.getProjectLanguage()
         if majorVersionStr == "Python3":
@@ -493,9 +489,7 @@
                 EricMessageBox.critical(
                     self.__ui,
                     self.tr("pyi-makespec"),
-                    self.tr(
-                        """The pyi-makespec executable could not be""" """ found."""
-                    ),
+                    self.tr("""The pyi-makespec executable could not be found."""),
                 )
                 return
 
@@ -503,10 +497,6 @@
             if not project.checkAllScriptsDirty(reportSyntaxErrors=True):
                 return
 
-            from PyInstallerInterface.PyInstallerConfigDialog import (
-                PyInstallerConfigDialog,
-            )
-
             params = project.getData("PACKAGERSPARMS", "PYINSTALLER")
             dlg = PyInstallerConfigDialog(project, executables, params, mode="spec")
             if dlg.exec() == QDialog.DialogCode.Accepted:
@@ -514,13 +504,9 @@
                 project.setData("PACKAGERSPARMS", "PYINSTALLER", params)
 
                 # now do the call
-                from PyInstallerInterface.PyInstallerExecDialog import (
-                    PyInstallerExecDialog,
-                )
-
                 dia = PyInstallerExecDialog("pyinstaller")
                 dia.show()
-                res = dia.start(args, params, project, script)
+                res = dia.start(args, project, script)
                 if res:
                     dia.exec()
 
@@ -529,12 +515,12 @@
         """
         Private slot to remove the directories created by pyinstaller.
         """
-        project = ericApp().getObject("Project")
-
         from PyInstallerInterface.PyInstallerCleanupDialog import (
             PyInstallerCleanupDialog,
         )
 
+        project = ericApp().getObject("Project")
+
         dlg = PyInstallerCleanupDialog()
         if dlg.exec() == QDialog.DialogCode.Accepted:
             removeDirs = dlg.getDirectories()
@@ -557,4 +543,4 @@
 
 
 #
-# eflag: noqa = M801
+# eflag: noqa = M801, U200, I102

eric ide

mercurial