From c45551035d4f2ef65f8de0472bfda4018636f309 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Sat, 10 May 2025 18:21:27 -0500 Subject: handle ctrl+c --- pix.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pix.py b/pix.py index 1e00fcf..6e53b8d 100644 --- a/pix.py +++ b/pix.py @@ -1,12 +1,26 @@ import sys +import signal from threading import Thread +from OpenGL.GLUT import glutLeaveMainLoop from window import PixDisplay from immich import ImmichConnector + +def handle_sigint(sig, frame): + try: + glutLeaveMainLoop() + sys.exit(0) + except: + pass + finally: + print("Exiting on Ctrl+C") + + if __name__ == "__main__": immichConnector = ImmichConnector("http://192.168.1.13", "m5nqOoBc4uhAba21gZdCP3z8D3JT4GPxDXL2psd52EA") pd = PixDisplay() t1 = Thread(target=immichConnector.idle, daemon=True, args=(pd,)) t1.start() - pd.main() + signal.signal(signal.SIGINT, handle_sigint) + pd.main(sys.argv) -- cgit v1.2.3