diff options
| author | Tim Keller <tjkeller.xyz> | 2025-05-10 18:21:27 -0500 |
|---|---|---|
| committer | Tim Keller <tjkeller.xyz> | 2025-05-10 18:21:27 -0500 |
| commit | c45551035d4f2ef65f8de0472bfda4018636f309 (patch) | |
| tree | f74c801a72ae1b123842adf9bd1e15b008f36ff0 | |
| parent | 3aed05a6cb265e4f60a17f87eb368fb33c93a562 (diff) | |
| download | immich-frame-c45551035d4f2ef65f8de0472bfda4018636f309.tar.xz immich-frame-c45551035d4f2ef65f8de0472bfda4018636f309.zip | |
handle ctrl+c
| -rw-r--r-- | pix.py | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -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) |
