Skip to content

Commit

Permalink
Cleanly stop app on SIGINT
Browse files Browse the repository at this point in the history
  • Loading branch information
guyonvarch committed Sep 24, 2024
1 parent 891c1d5 commit a8a3553
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions kiosk/kiosk_browser/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sys
import logging
import signal
from PyQt5.QtCore import Qt, QUrl, QSize
from PyQt5.QtGui import QKeySequence
from PyQt5.QtWidgets import QApplication
Expand Down Expand Up @@ -31,6 +32,14 @@ def start(kiosk_url, settings_url, toggle_settings_key, fullscreen = True):
mainWidget.resize(QSize(round(screen_size.width() / 2), round(screen_size.height() / 2)))
mainWidget.show()

# Quit application when receiving SIGINT
def on_SIGINT(signum, frame):
print('Exiting…')
app.quit()
sys.exit(130)
signal.signal(signal.SIGINT, on_SIGINT)

# Start application
app.exec_()

def parseUrl(url):
Expand Down

0 comments on commit a8a3553

Please sign in to comment.