From 2f09cba4e36dc21150e3c5a77d02cf0a6ff2fe94 Mon Sep 17 00:00:00 2001 From: Sean Robinson Date: Mon, 23 Mar 2015 04:19:26 -0700 Subject: [PATCH] Apply SIGINT restoration to new module layout This brings Markus Schmidt's v2.0.x fix into the master branch. git did not know how to apply this commit across branches. Frankly, I don't blame it, either. The development branch uses multiple processes where the stable branch has only one. So, the one change needed to be applied in two places to reach every executing process. This is a combination of two commits on the stable branch: "Ctrl+C on main window (restore signal handler)" and "Expand comment for signal handler reset" Signed-off-by: Sean Robinson --- wifiradar/__init__.py | 5 +++++ wifiradar/gui/g2/__init__.py | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/wifiradar/__init__.py b/wifiradar/__init__.py index 442ed4e..b0fd402 100644 --- a/wifiradar/__init__.py +++ b/wifiradar/__init__.py @@ -36,6 +36,7 @@ from configparser import NoOptionError, NoSectionError import logging import logging.handlers from multiprocessing import Pipe, Process +import signal from threading import Thread from wifiradar.config import (make_section_name, ConfigManager, @@ -96,6 +97,10 @@ class Main(object): ui_proc = Process(name='ui', target=ui.start, args=(ui_pipe,)) ui_proc.start() + # Reset SIGINT handler so that Ctrl+C in launching terminal + # will kill the application. + signal.signal(signal.SIGINT, signal.SIG_DFL) + # This is the first run (or, at least, no config file was present), # so pop up the preferences window try: diff --git a/wifiradar/gui/g2/__init__.py b/wifiradar/gui/g2/__init__.py index 83e8bd9..1263082 100644 --- a/wifiradar/gui/g2/__init__.py +++ b/wifiradar/gui/g2/__init__.py @@ -36,6 +36,7 @@ from __future__ import unicode_literals import errno import logging +import signal import sys import glib @@ -97,6 +98,9 @@ def start(ui_pipe): :class:`multiprocessing.Pipe` which will be given to the main UI element for intra-app communication. """ + # Reset SIGINT handler so that Ctrl+C in launching terminal + # will kill the application. + signal.signal(signal.SIGINT, signal.SIG_DFL) gtk.gdk.threads_init() ui = RadarWindow(ui_pipe) ui.run() -- 2.11.4.GIT