From 38a7c34f2ee605287971a3444b5c707792b708c5 Mon Sep 17 00:00:00 2001 From: nyanpasu64 Date: Tue, 2 Apr 2019 02:41:03 -0700 Subject: [PATCH] Quit GUI when pressing Ctrl-C in terminal (#252) --- corrscope/gui/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/corrscope/gui/__init__.py b/corrscope/gui/__init__.py index 98d0668..a30fb6c 100644 --- a/corrscope/gui/__init__.py +++ b/corrscope/gui/__init__.py @@ -1,4 +1,5 @@ import functools +import signal import sys import traceback from pathlib import Path @@ -58,6 +59,9 @@ def res(file: str) -> str: def gui_main(cfg_or_path: Union[Config, Path]): + # Allow Ctrl-C to exit + signal.signal(signal.SIGINT, signal.SIG_DFL) + # qw.QApplication.setStyle('fusion') QApp = qw.QApplication QApp.setAttribute(qc.Qt.AA_EnableHighDpiScaling)