Added code to kill running async processes when shutting down the eric IDE.

Sun, 15 Sep 2024 17:10:27 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 15 Sep 2024 17:10:27 +0200
changeset 81
b6280afecc83
parent 80
f59f1bcc4c6f
child 82
417d6480e11e

Added code to kill running async processes when shutting down the eric IDE.

PipxInterface/Pipx.py file | annotate | diff | comparison | revisions
PipxInterface/PipxProcess.py file | annotate | diff | comparison | revisions
PipxInterface/PipxWidget.py file | annotate | diff | comparison | revisions
PluginPipxInterface.py file | annotate | diff | comparison | revisions
changelog.md file | annotate | diff | comparison | revisions
--- a/PipxInterface/Pipx.py	Sun Sep 15 15:48:45 2024 +0200
+++ b/PipxInterface/Pipx.py	Sun Sep 15 17:10:27 2024 +0200
@@ -52,6 +52,16 @@
 
         self.__pipxProcesses = []
 
+    def shutdown(self):
+        """
+        Public method to perform shutdown actions.
+        """
+        for proc in self.__pipxProcesses:
+            proc.kill()
+
+        self.__pipxProcesses.clear()
+
+
     ############################################################################
     ## Utility methods
     ############################################################################
--- a/PipxInterface/PipxProcess.py	Sun Sep 15 15:48:45 2024 +0200
+++ b/PipxInterface/PipxProcess.py	Sun Sep 15 17:10:27 2024 +0200
@@ -4,7 +4,7 @@
 #
 
 """
-Module implementing a QProcess derive class with a timeout and convenience signals.
+Module implementing a QProcess derived class with a timeout and convenience signals.
 """
 
 from PyQt6.QtCore import QProcess, QTimer, pyqtSignal, pyqtSlot
@@ -12,7 +12,7 @@
 
 class PipxProcess(QProcess):
     """
-    Class implementing a QProcess derive class with a timeout and convenience signals
+    Class implementing a QProcess derived class with a timeout and convenience signals
     succeeded and failed.
 
     @signal failed() emitted to indicate a process failure
--- a/PipxInterface/PipxWidget.py	Sun Sep 15 15:48:45 2024 +0200
+++ b/PipxInterface/PipxWidget.py	Sun Sep 15 17:10:27 2024 +0200
@@ -97,6 +97,13 @@
 
         QTimer.singleShot(0, self.__populatePackages)
 
+    @pyqtSlot()
+    def shutdown(self):
+        """
+        Public slot to perform shutdown actions.
+        """
+        self.__pipx.shutdown()
+
     #######################################################################
     ## Menu related methods below
     #######################################################################
--- a/PluginPipxInterface.py	Sun Sep 15 15:48:45 2024 +0200
+++ b/PluginPipxInterface.py	Sun Sep 15 17:10:27 2024 +0200
@@ -36,7 +36,7 @@
     "author": "Detlev Offenbach <detlev@die-offenbachs.de>",
     "autoactivate": True,
     "deactivateable": True,
-    "version": "10.4.0",
+    "version": "10.4.1",
     "className": "PluginPipxInterface",
     "packageName": "PipxInterface",
     "shortDescription": "Graphical interface to the 'pipx' command.",
@@ -209,12 +209,16 @@
         menu = self.__ui.getMenu("subwindow")
         menu.addAction(self.__activateAct)
 
+        ericApp().getObject("PluginManager").shutdown.connect(self.__widget.shutdown)
+
         return None, True
 
     def deactivate(self):
         """
         Public method to deactivate this plug-in.
         """
+        ericApp().getObject("PluginManager").shutdown.disconnect(self.__widget.shutdown)
+
         menu = self.__ui.getMenu("subwindow")
         menu.removeAction(self.__activateAct)
         self.__ui.removeEricActions([self.__activateAct], "ui")
--- a/changelog.md	Sun Sep 15 15:48:45 2024 +0200
+++ b/changelog.md	Sun Sep 15 17:10:27 2024 +0200
@@ -1,6 +1,10 @@
 ChangeLog
 ---------
 
+__Version 10.4.1__
+
+- bug fixes
+
 __Version 10.4.0__
 
 - bug fixes

eric ide

mercurial