Show More
@@ -14,10 +14,14 b' Inputhook management for GUI event loop integration.' | |||||
14 | # Imports |
|
14 | # Imports | |
15 | #----------------------------------------------------------------------------- |
|
15 | #----------------------------------------------------------------------------- | |
16 |
|
16 | |||
17 | import ctypes |
|
17 | try: | |
|
18 | import ctypes | |||
|
19 | except ImportError: | |||
|
20 | ctypes = None | |||
18 | import os |
|
21 | import os | |
19 | import sys |
|
22 | import sys | |
20 | import warnings |
|
23 | ||
|
24 | from IPython.utils.warn import warn | |||
21 |
|
25 | |||
22 | #----------------------------------------------------------------------------- |
|
26 | #----------------------------------------------------------------------------- | |
23 | # Constants |
|
27 | # Constants | |
@@ -98,6 +102,9 b' class InputHookManager(object):' | |||||
98 | """ |
|
102 | """ | |
99 |
|
103 | |||
100 | def __init__(self): |
|
104 | def __init__(self): | |
|
105 | if ctypes is None: | |||
|
106 | warn("IPython GUI event loop requires ctypes, %gui will not be available\n") | |||
|
107 | return | |||
101 | self.PYFUNC = ctypes.PYFUNCTYPE(ctypes.c_int) |
|
108 | self.PYFUNC = ctypes.PYFUNCTYPE(ctypes.c_int) | |
102 | self._apps = {} |
|
109 | self._apps = {} | |
103 | self._reset() |
|
110 | self._reset() |
@@ -1,5 +1,8 b'' | |||||
1 | # Standard library imports. |
|
1 | # Standard library imports. | |
2 | import ctypes |
|
2 | try: | |
|
3 | import ctypes | |||
|
4 | except: | |||
|
5 | ctypes = None | |||
3 | import os |
|
6 | import os | |
4 | import platform |
|
7 | import platform | |
5 | import time |
|
8 | import time | |
@@ -54,6 +57,8 b' class ParentPollerWindows(Thread):' | |||||
54 | """ |
|
57 | """ | |
55 | assert(interrupt_handle or parent_handle) |
|
58 | assert(interrupt_handle or parent_handle) | |
56 | super(ParentPollerWindows, self).__init__() |
|
59 | super(ParentPollerWindows, self).__init__() | |
|
60 | if ctypes is None: | |||
|
61 | raise ImportError("ParentPollerWindows requires ctypes") | |||
57 | self.daemon = True |
|
62 | self.daemon = True | |
58 | self.interrupt_handle = interrupt_handle |
|
63 | self.interrupt_handle = interrupt_handle | |
59 | self.parent_handle = parent_handle |
|
64 | self.parent_handle = parent_handle |
General Comments 0
You need to be logged in to leave comments.
Login now