Show More
@@ -11,19 +11,14 b' import zmq' | |||||
11 |
|
11 | |||
12 | from IPython.config.application import Application |
|
12 | from IPython.config.application import Application | |
13 | from IPython.utils import io |
|
13 | from IPython.utils import io | |
14 |
|
14 | from IPython.lib.inputhook import _use_appnope | ||
15 |
|
||||
16 | def _on_os_x_10_9(): |
|
|||
17 | import platform |
|
|||
18 | from distutils.version import LooseVersion as V |
|
|||
19 | return sys.platform == 'darwin' and V(platform.mac_ver()[0]) >= V('10.9') |
|
|||
20 |
|
15 | |||
21 | def _notify_stream_qt(kernel, stream): |
|
16 | def _notify_stream_qt(kernel, stream): | |
22 |
|
17 | |||
23 | from IPython.external.qt_for_kernel import QtCore |
|
18 | from IPython.external.qt_for_kernel import QtCore | |
24 |
|
19 | |||
25 |
if _ |
|
20 | if _use_appnope() and kernel._darwin_app_nap: | |
26 |
from |
|
21 | from appnope import nope_scope as context | |
27 | else: |
|
22 | else: | |
28 | from IPython.core.interactiveshell import NoOpContext as context |
|
23 | from IPython.core.interactiveshell import NoOpContext as context | |
29 |
|
24 | |||
@@ -93,10 +88,10 b' def loop_wx(kernel):' | |||||
93 | import wx |
|
88 | import wx | |
94 | from IPython.lib.guisupport import start_event_loop_wx |
|
89 | from IPython.lib.guisupport import start_event_loop_wx | |
95 |
|
90 | |||
96 |
if _ |
|
91 | if _use_appnope() and kernel._darwin_app_nap: | |
97 | # we don't hook up App Nap contexts for Wx, |
|
92 | # we don't hook up App Nap contexts for Wx, | |
98 | # just disable it outright. |
|
93 | # just disable it outright. | |
99 |
from |
|
94 | from appnope import nope | |
100 | nope() |
|
95 | nope() | |
101 |
|
96 | |||
102 | doi = kernel.do_one_iteration |
|
97 | doi = kernel.do_one_iteration |
@@ -3,16 +3,8 b'' | |||||
3 | Inputhook management for GUI event loop integration. |
|
3 | Inputhook management for GUI event loop integration. | |
4 | """ |
|
4 | """ | |
5 |
|
5 | |||
6 | #----------------------------------------------------------------------------- |
|
6 | # Copyright (c) IPython Development Team. | |
7 | # Copyright (C) 2008-2011 The IPython Development Team |
|
7 | # Distributed under the terms of the Modified BSD License. | |
8 | # |
|
|||
9 | # Distributed under the terms of the BSD License. The full license is in |
|
|||
10 | # the file COPYING, distributed as part of this software. |
|
|||
11 | #----------------------------------------------------------------------------- |
|
|||
12 |
|
||||
13 | #----------------------------------------------------------------------------- |
|
|||
14 | # Imports |
|
|||
15 | #----------------------------------------------------------------------------- |
|
|||
16 |
|
8 | |||
17 | try: |
|
9 | try: | |
18 | import ctypes |
|
10 | import ctypes | |
@@ -21,6 +13,7 b' except ImportError:' | |||||
21 | except SystemError: # IronPython issue, 2/8/2014 |
|
13 | except SystemError: # IronPython issue, 2/8/2014 | |
22 | ctypes = None |
|
14 | ctypes = None | |
23 | import os |
|
15 | import os | |
|
16 | import platform | |||
24 | import sys |
|
17 | import sys | |
25 | from distutils.version import LooseVersion as V |
|
18 | from distutils.version import LooseVersion as V | |
26 |
|
19 | |||
@@ -57,8 +50,14 b' def _stdin_ready_nt():' | |||||
57 |
|
50 | |||
58 | def _stdin_ready_other(): |
|
51 | def _stdin_ready_other(): | |
59 | """Return True, assuming there's something to read on stdin.""" |
|
52 | """Return True, assuming there's something to read on stdin.""" | |
60 |
return True |
|
53 | return True | |
|
54 | ||||
|
55 | def _use_appnope(): | |||
|
56 | """Should we use appnope for dealing with OS X app nap? | |||
61 |
|
|
57 | ||
|
58 | Checks if we are on OS X 10.9 or greater. | |||
|
59 | """ | |||
|
60 | return sys.platform == 'darwin' and V(platform.mac_ver()[0]) >= V('10.9') | |||
62 |
|
61 | |||
63 | def _ignore_CTRL_C_posix(): |
|
62 | def _ignore_CTRL_C_posix(): | |
64 | """Ignore CTRL+C (SIGINT).""" |
|
63 | """Ignore CTRL+C (SIGINT).""" | |
@@ -317,9 +316,10 b' class WxInputHook(InputHookBase):' | |||||
317 | raise ValueError("requires wxPython >= 2.8, but you have %s" % wx.__version__) |
|
316 | raise ValueError("requires wxPython >= 2.8, but you have %s" % wx.__version__) | |
318 |
|
317 | |||
319 | from IPython.lib.inputhookwx import inputhook_wx |
|
318 | from IPython.lib.inputhookwx import inputhook_wx | |
320 | from IPython.external.appnope import nope |
|
|||
321 | self.manager.set_inputhook(inputhook_wx) |
|
319 | self.manager.set_inputhook(inputhook_wx) | |
322 | nope() |
|
320 | if _use_appnope(): | |
|
321 | from appnope import nope | |||
|
322 | nope() | |||
323 |
|
323 | |||
324 | import wx |
|
324 | import wx | |
325 | if app is None: |
|
325 | if app is None: | |
@@ -334,8 +334,9 b' class WxInputHook(InputHookBase):' | |||||
334 |
|
334 | |||
335 | This restores appnapp on OS X |
|
335 | This restores appnapp on OS X | |
336 | """ |
|
336 | """ | |
337 | from IPython.external.appnope import nap |
|
337 | if _use_appnope(): | |
338 | nap() |
|
338 | from appnope import nap | |
|
339 | nap() | |||
339 |
|
340 | |||
340 | @inputhook_manager.register('qt', 'qt4') |
|
341 | @inputhook_manager.register('qt', 'qt4') | |
341 | class Qt4InputHook(InputHookBase): |
|
342 | class Qt4InputHook(InputHookBase): | |
@@ -362,10 +363,11 b' class Qt4InputHook(InputHookBase):' | |||||
362 | app = QtGui.QApplication(sys.argv) |
|
363 | app = QtGui.QApplication(sys.argv) | |
363 | """ |
|
364 | """ | |
364 | from IPython.lib.inputhookqt4 import create_inputhook_qt4 |
|
365 | from IPython.lib.inputhookqt4 import create_inputhook_qt4 | |
365 | from IPython.external.appnope import nope |
|
366 | app, inputhook_qt4 = create_inputhook_qt4(self, app) | |
366 | app, inputhook_qt4 = create_inputhook_qt4(self.manager, app) |
|
|||
367 | self.manager.set_inputhook(inputhook_qt4) |
|
367 | self.manager.set_inputhook(inputhook_qt4) | |
368 | nope() |
|
368 | if _use_appnope(): | |
|
369 | from appnope import nope | |||
|
370 | nope() | |||
369 |
|
371 | |||
370 | return app |
|
372 | return app | |
371 |
|
373 | |||
@@ -374,8 +376,9 b' class Qt4InputHook(InputHookBase):' | |||||
374 |
|
376 | |||
375 | This restores appnapp on OS X |
|
377 | This restores appnapp on OS X | |
376 | """ |
|
378 | """ | |
377 | from IPython.external.appnope import nap |
|
379 | if _use_appnope(): | |
378 | nap() |
|
380 | from appnope import nap | |
|
381 | nap() | |||
379 |
|
382 | |||
380 |
|
383 | |||
381 | @inputhook_manager.register('qt5') |
|
384 | @inputhook_manager.register('qt5') |
@@ -275,6 +275,7 b' install_requires = [' | |||||
275 |
|
275 | |||
276 | # add readline |
|
276 | # add readline | |
277 | if sys.platform == 'darwin': |
|
277 | if sys.platform == 'darwin': | |
|
278 | install_requires.append('appnope') | |||
278 | if 'bdist_wheel' in sys.argv[1:] or not setupext.check_for_readline(): |
|
279 | if 'bdist_wheel' in sys.argv[1:] or not setupext.check_for_readline(): | |
279 | install_requires.append('gnureadline') |
|
280 | install_requires.append('gnureadline') | |
280 | elif sys.platform.startswith('win'): |
|
281 | elif sys.platform.startswith('win'): |
@@ -670,7 +670,7 b' def get_bdist_wheel():' | |||||
670 | if found: |
|
670 | if found: | |
671 | lis.pop(idx) |
|
671 | lis.pop(idx) | |
672 |
|
672 | |||
673 | for pkg in ("gnureadline", "pyreadline", "mock", "terminado"): |
|
673 | for pkg in ("gnureadline", "pyreadline", "mock", "appnope", "terminado"): | |
674 | _remove_startswith(requires, pkg) |
|
674 | _remove_startswith(requires, pkg) | |
675 | requires.append("gnureadline; sys.platform == 'darwin' and platform.python_implementation == 'CPython'") |
|
675 | requires.append("gnureadline; sys.platform == 'darwin' and platform.python_implementation == 'CPython'") | |
676 | requires.append("terminado (>=0.3.3); extra == 'notebook' and sys.platform != 'win32'") |
|
676 | requires.append("terminado (>=0.3.3); extra == 'notebook' and sys.platform != 'win32'") | |
@@ -678,6 +678,7 b' def get_bdist_wheel():' | |||||
678 | requires.append("pyreadline (>=2.0); extra == 'terminal' and sys.platform == 'win32' and platform.python_implementation == 'CPython'") |
|
678 | requires.append("pyreadline (>=2.0); extra == 'terminal' and sys.platform == 'win32' and platform.python_implementation == 'CPython'") | |
679 | requires.append("pyreadline (>=2.0); extra == 'all' and sys.platform == 'win32' and platform.python_implementation == 'CPython'") |
|
679 | requires.append("pyreadline (>=2.0); extra == 'all' and sys.platform == 'win32' and platform.python_implementation == 'CPython'") | |
680 | requires.append("mock; extra == 'test' and python_version < '3.3'") |
|
680 | requires.append("mock; extra == 'test' and python_version < '3.3'") | |
|
681 | requires.append("appnope; sys.platform == 'darwin'") | |||
681 | for r in requires: |
|
682 | for r in requires: | |
682 | pkg_info['Requires-Dist'] = r |
|
683 | pkg_info['Requires-Dist'] = r | |
683 | write_pkg_info(metadata_path, pkg_info) |
|
684 | write_pkg_info(metadata_path, pkg_info) |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now