summaryrefslogtreecommitdiff
path: root/src/frontend
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 /src/frontend
parent0696a49613d65833a4d3ff278ca81a4588b5178b (diff)
GUI frontend:v6.2409.0
* listen for SIGTERM signal backend : * send SIGTERM to GUI application to terminate it gracefully when required
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/gui/sisyphus-qt5.py5
-rw-r--r--src/frontend/gui/sisyphus-qt6.py5
2 files changed, 10 insertions, 0 deletions
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