Show More
@@ -1,4 +1,5 b'' | |||||
1 | # encoding: utf-8 -*- test-case-name: |
|
1 | # encoding: utf-8 -*- test-case-name: | |
|
2 | # FIXME: Need to add tests. | |||
2 | # ipython1.frontend.cocoa.tests.test_cocoa_frontend -*- |
|
3 | # ipython1.frontend.cocoa.tests.test_cocoa_frontend -*- | |
3 |
|
4 | |||
4 | """Classes to provide a Wx frontend to the |
|
5 | """Classes to provide a Wx frontend to the | |
@@ -25,8 +26,7 b' from console_widget import ConsoleWidget' | |||||
25 | import re |
|
26 | import re | |
26 |
|
27 | |||
27 | import IPython |
|
28 | import IPython | |
28 |
from IPython.kernel. |
|
29 | from IPython.kernel.core.interpreter import Interpreter | |
29 | from IPython.kernel.core.history import FrontEndHistory |
|
|||
30 | from IPython.frontend.frontendbase import FrontEndBase |
|
30 | from IPython.frontend.frontendbase import FrontEndBase | |
31 |
|
31 | |||
32 | #------------------------------------------------------------------------------- |
|
32 | #------------------------------------------------------------------------------- | |
@@ -59,7 +59,7 b' class IPythonWxController(FrontEndBase, ConsoleWidget):' | |||||
59 | """ Create Shell instance. |
|
59 | """ Create Shell instance. | |
60 | """ |
|
60 | """ | |
61 | ConsoleWidget.__init__(self, parent, id, pos, size, style) |
|
61 | ConsoleWidget.__init__(self, parent, id, pos, size, style) | |
62 |
FrontEndBase.__init__(self, |
|
62 | FrontEndBase.__init__(self, shell=Interpreter(), | |
63 | ) |
|
63 | ) | |
64 |
|
64 | |||
65 | # FIXME: Something is wrong with the history, I instanciate it |
|
65 | # FIXME: Something is wrong with the history, I instanciate it | |
@@ -67,7 +67,7 b' class IPythonWxController(FrontEndBase, ConsoleWidget):' | |||||
67 | self.lines = {} |
|
67 | self.lines = {} | |
68 |
|
68 | |||
69 | # Start the IPython engine |
|
69 | # Start the IPython engine | |
70 | self.engine.startService() |
|
70 | self.shell | |
71 |
|
71 | |||
72 | # Capture Character keys |
|
72 | # Capture Character keys | |
73 | self.Bind(wx.EVT_KEY_DOWN, self._on_key_down) |
|
73 | self.Bind(wx.EVT_KEY_DOWN, self._on_key_down) | |
@@ -77,12 +77,6 b' class IPythonWxController(FrontEndBase, ConsoleWidget):' | |||||
77 | % IPython.__version__ |
|
77 | % IPython.__version__ | |
78 |
|
78 | |||
79 |
|
79 | |||
80 | def appWillTerminate_(self, notification): |
|
|||
81 | """appWillTerminate""" |
|
|||
82 |
|
||||
83 | self.engine.stopService() |
|
|||
84 |
|
||||
85 |
|
||||
86 | def complete(self, token): |
|
80 | def complete(self, token): | |
87 | """Complete token in engine's user_ns |
|
81 | """Complete token in engine's user_ns | |
88 |
|
82 | |||
@@ -96,7 +90,7 b' class IPythonWxController(FrontEndBase, ConsoleWidget):' | |||||
96 | IPython.kernel.engineservice.IEngineBase.complete |
|
90 | IPython.kernel.engineservice.IEngineBase.complete | |
97 | """ |
|
91 | """ | |
98 |
|
92 | |||
99 |
return self. |
|
93 | return self.shell.complete(token) | |
100 |
|
94 | |||
101 |
|
95 | |||
102 | def render_result(self, result): |
|
96 | def render_result(self, result): | |
@@ -162,7 +156,7 b' class IPythonWxController(FrontEndBase, ConsoleWidget):' | |||||
162 | or re.findall(r"\n[\t ]*$", cleaned_buffer)): |
|
156 | or re.findall(r"\n[\t ]*$", cleaned_buffer)): | |
163 | if self.is_complete(cleaned_buffer): |
|
157 | if self.is_complete(cleaned_buffer): | |
164 | self._add_history(None, cleaned_buffer.rstrip()) |
|
158 | self._add_history(None, cleaned_buffer.rstrip()) | |
165 |
result = self. |
|
159 | result = self.shell.execute(cleaned_buffer) | |
166 | self.render_result(result) |
|
160 | self.render_result(result) | |
167 | self.new_prompt(self.prompt % (result['number'] + 1)) |
|
161 | self.new_prompt(self.prompt % (result['number'] + 1)) | |
168 | self.multi_line_input = False |
|
162 | self.multi_line_input = False |
General Comments 0
You need to be logged in to leave comments.
Login now