Show More
@@ -40,7 +40,7 b' from pprint import saferepr' | |||||
40 |
|
40 | |||
41 | import IPython |
|
41 | import IPython | |
42 | from IPython.kernel.engineservice import ThreadedEngineService |
|
42 | from IPython.kernel.engineservice import ThreadedEngineService | |
43 |
from IPython.frontend.frontendbase import Async |
|
43 | from IPython.frontend.frontendbase import AsyncFrontEndBase | |
44 |
|
44 | |||
45 | from twisted.internet.threads import blockingCallFromThread |
|
45 | from twisted.internet.threads import blockingCallFromThread | |
46 | from twisted.python.failure import Failure |
|
46 | from twisted.python.failure import Failure | |
@@ -96,14 +96,14 b' class AutoreleasePoolWrappedThreadedEngineService(ThreadedEngineService):' | |||||
96 | return d |
|
96 | return d | |
97 |
|
97 | |||
98 |
|
98 | |||
99 |
class IPythonCocoaController(NSObject, Async |
|
99 | class IPythonCocoaController(NSObject, AsyncFrontEndBase): | |
100 | userNS = objc.ivar() #mirror of engine.user_ns (key=>str(value)) |
|
100 | userNS = objc.ivar() #mirror of engine.user_ns (key=>str(value)) | |
101 | waitingForEngine = objc.ivar().bool() |
|
101 | waitingForEngine = objc.ivar().bool() | |
102 | textView = objc.IBOutlet() |
|
102 | textView = objc.IBOutlet() | |
103 |
|
103 | |||
104 | def init(self): |
|
104 | def init(self): | |
105 | self = super(IPythonCocoaController, self).init() |
|
105 | self = super(IPythonCocoaController, self).init() | |
106 |
Async |
|
106 | AsyncFrontEndBase.__init__(self, | |
107 | engine=AutoreleasePoolWrappedThreadedEngineService()) |
|
107 | engine=AutoreleasePoolWrappedThreadedEngineService()) | |
108 | if(self != None): |
|
108 | if(self != None): | |
109 | self._common_init() |
|
109 | self._common_init() | |
@@ -200,13 +200,14 b' class IPythonCocoaController(NSObject, AsynchronousFrontEndBase):' | |||||
200 | result = blockingCallFromThread(self.engine.pull, keys) |
|
200 | result = blockingCallFromThread(self.engine.pull, keys) | |
201 | self.waitingForEngine = False |
|
201 | self.waitingForEngine = False | |
202 |
|
202 | |||
203 | def executeFileAtPath_(self, path): |
|
203 | @objc.signature('v@:@I') | |
|
204 | def executeFileAtPath_encoding_(self, path, encoding): | |||
204 | """Execute file at path in an empty namespace. Update the engine |
|
205 | """Execute file at path in an empty namespace. Update the engine | |
205 | user_ns with the resulting locals.""" |
|
206 | user_ns with the resulting locals.""" | |
206 |
|
207 | |||
207 | lines,err = NSString.stringWithContentsOfFile_encoding_error_( |
|
208 | lines,err = NSString.stringWithContentsOfFile_encoding_error_( | |
208 | path, |
|
209 | path, | |
209 |
|
|
210 | encoding, | |
210 | None) |
|
211 | None) | |
211 | self.engine.execute(lines) |
|
212 | self.engine.execute(lines) | |
212 |
|
213 |
@@ -11,7 +11,7 b'' | |||||
11 | isa = PBXContainerItemProxy; |
|
11 | isa = PBXContainerItemProxy; | |
12 | containerPortal = 4C96F4FE0E199AB500B03430 /* Project object */; |
|
12 | containerPortal = 4C96F4FE0E199AB500B03430 /* Project object */; | |
13 | proxyType = 1; |
|
13 | proxyType = 1; | |
14 |
remoteGlobalIDString = 4C96F50C0E199AF100B03430 |
|
14 | remoteGlobalIDString = 4C96F50C0E199AF100B03430; | |
15 | remoteInfo = "Cocoa Frontend Plugin"; |
|
15 | remoteInfo = "Cocoa Frontend Plugin"; | |
16 | }; |
|
16 | }; | |
17 | /* End PBXContainerItemProxy section */ |
|
17 | /* End PBXContainerItemProxy section */ |
@@ -355,7 +355,7 b' class FrontEndBase(object):' | |||||
355 |
|
355 | |||
356 |
|
356 | |||
357 |
|
357 | |||
358 |
class Async |
|
358 | class AsyncFrontEndBase(FrontEndBase): | |
359 | """ |
|
359 | """ | |
360 | Overrides FrontEndBase to wrap execute in a deferred result. |
|
360 | Overrides FrontEndBase to wrap execute in a deferred result. | |
361 | All callbacks are made as callbacks on the deferred result. |
|
361 | All callbacks are made as callbacks on the deferred result. |
@@ -19,7 +19,7 b' import unittest' | |||||
19 | from IPython.frontend import frontendbase |
|
19 | from IPython.frontend import frontendbase | |
20 | from IPython.kernel.engineservice import EngineService |
|
20 | from IPython.kernel.engineservice import EngineService | |
21 |
|
21 | |||
22 |
class FrontEndCallbackChecker(frontendbase.Async |
|
22 | class FrontEndCallbackChecker(frontendbase.AsyncFrontEndBase): | |
23 | """FrontEndBase subclass for checking callbacks""" |
|
23 | """FrontEndBase subclass for checking callbacks""" | |
24 | def __init__(self, engine=None, history=None): |
|
24 | def __init__(self, engine=None, history=None): | |
25 | super(FrontEndCallbackChecker, self).__init__(engine=engine, |
|
25 | super(FrontEndCallbackChecker, self).__init__(engine=engine, | |
@@ -44,7 +44,7 b' class FrontEndCallbackChecker(frontendbase.AsynchronousFrontEndBase):' | |||||
44 |
|
44 | |||
45 |
|
45 | |||
46 |
|
46 | |||
47 |
class TestAsync |
|
47 | class TestAsyncFrontendBase(unittest.TestCase): | |
48 | def setUp(self): |
|
48 | def setUp(self): | |
49 | """Setup the EngineService and FrontEndBase""" |
|
49 | """Setup the EngineService and FrontEndBase""" | |
50 |
|
50 | |||
@@ -53,7 +53,7 b' class TestAsynchronousFrontendBase(unittest.TestCase):' | |||||
53 |
|
53 | |||
54 | def test_implements_IFrontEnd(self): |
|
54 | def test_implements_IFrontEnd(self): | |
55 | assert(frontendbase.IFrontEnd.implementedBy( |
|
55 | assert(frontendbase.IFrontEnd.implementedBy( | |
56 |
frontendbase.Async |
|
56 | frontendbase.AsyncFrontEndBase)) | |
57 |
|
57 | |||
58 |
|
58 | |||
59 | def test_is_complete_returns_False_for_incomplete_block(self): |
|
59 | def test_is_complete_returns_False_for_incomplete_block(self): |
@@ -16,7 +16,6 b' graft IPython/tools' | |||||
16 | graft docs |
|
16 | graft docs | |
17 | exclude docs/\#* |
|
17 | exclude docs/\#* | |
18 | exclude docs/man/*.1 |
|
18 | exclude docs/man/*.1 | |
19 | exclude docs/ChangeLog.* |
|
|||
20 |
|
19 | |||
21 | # There seems to be no way of excluding whole subdirectories, other than |
|
20 | # There seems to be no way of excluding whole subdirectories, other than | |
22 | # manually excluding all their subdirs. distutils really is horrible... |
|
21 | # manually excluding all their subdirs. distutils really is horrible... |
@@ -124,7 +124,11 b' def find_package_data():' | |||||
124 | """ |
|
124 | """ | |
125 | # This is not enough for these things to appear in an sdist. |
|
125 | # This is not enough for these things to appear in an sdist. | |
126 | # We need to muck with the MANIFEST to get this to work |
|
126 | # We need to muck with the MANIFEST to get this to work | |
127 | package_data = {'IPython.UserConfig' : ['*'] } |
|
127 | package_data = { | |
|
128 | 'IPython.UserConfig' : ['*'], | |||
|
129 | 'IPython.tools.tests' : ['*.txt'], | |||
|
130 | 'IPython.testing' : ['*.txt'] | |||
|
131 | } | |||
128 | return package_data |
|
132 | return package_data | |
129 |
|
133 | |||
130 |
|
134 |
General Comments 0
You need to be logged in to leave comments.
Login now