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