From 17e31142c0021821319cd3effc5e9ba4cccf5d82 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 2 Sep 2024 23:41:53 +0100 Subject: GUI frontend: * listen for SIGTERM signal backend : * send SIGTERM to GUI application to terminate it gracefully when required --- src/frontend/gui/sisyphus-qt6.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/frontend/gui/sisyphus-qt6.py') 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 -- cgit v1.2.3