summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-09-02 23:41:53 +0100
committerV3n3RiX <venerix@koprulu.sector>2024-09-02 23:49:22 +0100
commit17e31142c0021821319cd3effc5e9ba4cccf5d82 (patch)
treeb16a57e97872c64fc25ecd2aa9ddaf7e459ff0d8
parent0696a49613d65833a4d3ff278ca81a4588b5178b (diff)
GUI frontend:v6.2409.0
* listen for SIGTERM signal backend : * send SIGTERM to GUI application to terminate it gracefully when required
-rw-r--r--src/backend/pkgadd.py6
-rw-r--r--src/backend/syncall.py5
-rw-r--r--src/backend/sysupgrade.py6
-rw-r--r--src/frontend/gui/sisyphus-qt5.py5
-rw-r--r--src/frontend/gui/sisyphus-qt6.py5
5 files changed, 19 insertions, 8 deletions
diff --git a/src/backend/pkgadd.py b/src/backend/pkgadd.py
index 091502b..60ecce8 100644
--- a/src/backend/pkgadd.py
+++ b/src/backend/pkgadd.py
@@ -104,7 +104,7 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False, nodeps=False):
print(f"Killing application in : {i} seconds!")
time.sleep(1)
- sys.exit(app.exec_()) # kill GUI window
+ os.kill(os.getpid(), signal.SIGTERM) # kill GUI window
else:
print(f"{sisyphus.getclr.bright_red}\nCannot proceed!\n{sisyphus.getclr.reset}{sisyphus.getclr.bright_yellow}Please apply the above changes to your portage configuration files and try again!{sisyphus.getclr.reset}")
sys.exit()
@@ -272,7 +272,7 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False, nodeps=False):
print(f"Killing application in : {i} seconds!")
time.sleep(1)
- sys.exit(app.exec_()) # kill GUI window
+ os.kill(os.getpid(), signal.SIGTERM) # kill GUI window
else:
print(
f"{sisyphus.getclr.bright_red}\nSource package(s) found in the mix!\n{sisyphus.getclr.reset}")
@@ -288,7 +288,7 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False, nodeps=False):
print(f"Killing application in : {i} seconds!")
time.sleep(1)
- sys.exit(app.exec_()) # kill GUI window
+ os.kill(os.getpid(), signal.SIGTERM) # kill GUI window
else:
print(
f"{sisyphus.getclr.bright_red}\nSource package(s) found in the mix!\n{sisyphus.getclr.reset}")
diff --git a/src/backend/syncall.py b/src/backend/syncall.py
index 42b0b9c..c024a37 100644
--- a/src/backend/syncall.py
+++ b/src/backend/syncall.py
@@ -1,6 +1,7 @@
#!/usr/bin/python3
import animation
+import os
import signal
import sys
import time
@@ -40,7 +41,7 @@ def start(gfx_ui=False):
print(f"Killing application in : {i} seconds!")
time.sleep(1)
- sys.exit(app.exec_()) # kill GUI window
+ os.kill(os.getpid(), signal.SIGTERM) # kill GUI window
else:
print(
f"{sisyphus.getclr.bright_red}\nNo internet connection detected; Aborting!\n{sisyphus.getclr.reset}")
@@ -65,7 +66,7 @@ def start(gfx_ui=False):
print(f"Killing application in : {i} seconds!")
time.sleep(1)
- sys.exit(app.exec_()) # kill GUI window
+ os.kill(os.getpid(), signal.SIGTERM) # kill GUI window
else:
if "packages-next" in bhst_addr:
print(
diff --git a/src/backend/sysupgrade.py b/src/backend/sysupgrade.py
index f8b01d2..c773366 100644
--- a/src/backend/sysupgrade.py
+++ b/src/backend/sysupgrade.py
@@ -82,7 +82,7 @@ def start(ebuild=False, gfx_ui=False):
print(f"Killing application in : {i} seconds!")
time.sleep(1)
- sys.exit(app.exec_()) # kill GUI window
+ os.kill(os.getpid(), signal.SIGTERM) # kill GUI window
else:
print(f"{sisyphus.getclr.bright_red}\nCannot proceed!\n{sisyphus.getclr.reset}{sisyphus.getclr.bright_yellow}Please apply the above changes to your portage configuration files and try again!{sisyphus.getclr.reset}")
sys.exit()
@@ -256,7 +256,7 @@ def start(ebuild=False, gfx_ui=False):
print(f"Killing application in : {i} seconds!")
time.sleep(1)
- sys.exit(app.exec_()) # kill GUI window
+ os.kill(os.getpid(), signal.SIGTERM) # kill GUI window
else:
print(
f"{sisyphus.getclr.bright_red}\nSource package(s) found in the mix!{sisyphus.getclr.reset}")
@@ -273,7 +273,7 @@ def start(ebuild=False, gfx_ui=False):
print(f"Killing application in : {i} seconds!")
time.sleep(1)
- sys.exit(app.exec_()) # kill GUI window
+ os.kill(os.getpid(), signal.SIGTERM) # kill GUI window
else:
print(
f"{sisyphus.getclr.bright_red}\nSource package(s) found in the mix!{sisyphus.getclr.reset}")
diff --git a/src/frontend/gui/sisyphus-qt5.py b/src/frontend/gui/sisyphus-qt5.py
index 16c473c..939feae 100644
--- a/src/frontend/gui/sisyphus-qt5.py
+++ b/src/frontend/gui/sisyphus-qt5.py
@@ -2,6 +2,7 @@
import sys
import sqlite3
+import signal
import sisyphus
from collections import OrderedDict
from PyQt5 import QtCore, QtGui, QtWidgets, uic
@@ -11,6 +12,7 @@ class Sisyphus(QtWidgets.QMainWindow):
def __init__(self):
super(Sisyphus, self).__init__()
uic.loadUi('/usr/share/sisyphus/ui/sisyphus.ui', self)
+ signal.signal(signal.SIGTERM, self.handleSigterm)
self.centerOnScreen()
self.show()
@@ -285,6 +287,9 @@ class Sisyphus(QtWidgets.QMainWindow):
def sisyphusExit(self):
self.close()
+ def handleSigterm(self, signum, frame):
+ self.close()
+
def __del__(self):
sys.stdout = sys.__stdout__ # restore stdout
diff --git a/src/frontend/gui/sisyphus-qt6.py b/src/frontend/gui/sisyphus-qt6.py
index 181fa64..ace6c8b 100644
--- a/src/frontend/gui/sisyphus-qt6.py
+++ b/src/frontend/gui/sisyphus-qt6.py
@@ -2,6 +2,7 @@
import sys
import sqlite3
+import signal
import sisyphus
from collections import OrderedDict
from PyQt6 import QtCore, QtGui, QtWidgets, uic
@@ -11,6 +12,7 @@ class Sisyphus(QtWidgets.QMainWindow):
def __init__(self):
super(Sisyphus, self).__init__()
uic.loadUi('/usr/share/sisyphus/ui/sisyphus.ui', self)
+ signal.signal(signal.SIGTERM, self.handleSigterm)
self.centerOnScreen()
self.show()
@@ -285,6 +287,9 @@ class Sisyphus(QtWidgets.QMainWindow):
def sisyphusExit(self):
self.close()
+ def handleSigterm(self, signum, frame):
+ self.close()
+
def __del__(self):
sys.stdout = sys.__stdout__ # restore stdout