Fix support for Ctrl-C on the macosx backend. · matplotlib/matplotlib@059c8ee · GitHub
Skip to content

Commit 059c8ee

Browse files
committed
Fix support for Ctrl-C on the macosx backend.
Support is largely copy-pasted from, and tests are shared with, the qt implementation (qt_compat._maybe_allow_interrupt), the main difference being that what we need from QSocketNotifier, as well as the equivalent for QApplication.quit(), are reimplemented in ObjC. qt_compat._maybe_allow_interrupt is also slightly cleaned up by moving out the "do-nothing" case (`old_sigint_handler in (None, SIG_IGN, SIG_DFL)`) and dedenting the rest, instead of keeping track of whether signals were actually manipulated via a `skip` variable. Factoring out the common parts of _maybe_allow_interrupt is left as a follow-up. (Test e.g. with `MPLBACKEND=macosx python -c "from pylab import *; plot(); show()"` followed by Ctrl-C.)
1 parent 5140177 commit 059c8ee

5 files changed

Lines changed: 312 additions & 237 deletions

File tree

‎lib/matplotlib/backends/backend_macosx.py‎

Lines changed: 33 additions & 1 deletion

‎lib/matplotlib/backends/qt_compat.py‎

Lines changed: 36 additions & 39 deletions

0 commit comments

Comments
 (0)