Show More
@@ -18,10 +18,8 __docformat__ = "restructuredtext en" | |||||
18 | #------------------------------------------------------------------------------- |
|
18 | #------------------------------------------------------------------------------- | |
19 | import re |
|
19 | import re | |
20 |
|
20 | |||
21 | import IPython |
|
|||
22 | import sys |
|
21 | import sys | |
23 | import codeop |
|
22 | import codeop | |
24 | import traceback |
|
|||
25 |
|
23 | |||
26 | from frontendbase import FrontEndBase |
|
24 | from frontendbase import FrontEndBase | |
27 | from IPython.kernel.core.interpreter import Interpreter |
|
25 | from IPython.kernel.core.interpreter import Interpreter | |
@@ -297,6 +295,12 class LineFrontEndBase(FrontEndBase): | |||||
297 | self.write(prompt) |
|
295 | self.write(prompt) | |
298 |
|
296 | |||
299 |
|
297 | |||
|
298 | def execute_command(self, command, hidden=False): | |||
|
299 | """ Execute a command, not only in the model, but also in the | |||
|
300 | view, if any. | |||
|
301 | """ | |||
|
302 | return self.shell.execute(command) | |||
|
303 | ||||
300 | #-------------------------------------------------------------------------- |
|
304 | #-------------------------------------------------------------------------- | |
301 | # Private API |
|
305 | # Private API | |
302 | #-------------------------------------------------------------------------- |
|
306 | #-------------------------------------------------------------------------- |
@@ -25,7 +25,6 __docformat__ = "restructuredtext en" | |||||
25 | # Major library imports |
|
25 | # Major library imports | |
26 | import re |
|
26 | import re | |
27 | import __builtin__ |
|
27 | import __builtin__ | |
28 | from time import sleep |
|
|||
29 | import sys |
|
28 | import sys | |
30 | from threading import Lock |
|
29 | from threading import Lock | |
31 | import string |
|
30 | import string | |
@@ -276,6 +275,38 class WxController(ConsoleWidget, PrefilterFrontEnd): | |||||
276 | milliseconds=100, oneShot=True) |
|
275 | milliseconds=100, oneShot=True) | |
277 |
|
276 | |||
278 |
|
277 | |||
|
278 | def execute_command(self, command, hidden=False): | |||
|
279 | """ Execute a command, not only in the model, but also in the | |||
|
280 | view. | |||
|
281 | """ | |||
|
282 | if hidden: | |||
|
283 | return self.shell.execute(command) | |||
|
284 | else: | |||
|
285 | # XXX: we are not storing the input buffer previous to the | |||
|
286 | # execution, as this forces us to run the execution | |||
|
287 | # input_buffer a yield, which is not good. | |||
|
288 | ##current_buffer = self.shell.control.input_buffer | |||
|
289 | command = command.rstrip() | |||
|
290 | if len(command.split('\n')) > 1: | |||
|
291 | # The input command is several lines long, we need to | |||
|
292 | # force the execution to happen | |||
|
293 | command += '\n' | |||
|
294 | cleaned_command = self.prefilter_input(command) | |||
|
295 | self.input_buffer = command | |||
|
296 | # Do not use wx.Yield() (aka GUI.process_events()) to avoid | |||
|
297 | # recursive yields. | |||
|
298 | self.ProcessEvent(wx.PaintEvent()) | |||
|
299 | self.write('\n') | |||
|
300 | if not self.is_complete(cleaned_command + '\n'): | |||
|
301 | self._colorize_input_buffer() | |||
|
302 | self.render_error('Incomplete or invalid input') | |||
|
303 | self.new_prompt(self.input_prompt_template.substitute( | |||
|
304 | number=(self.last_result['number'] + 1))) | |||
|
305 | return False | |||
|
306 | self._on_enter() | |||
|
307 | return True | |||
|
308 | ||||
|
309 | ||||
279 | #-------------------------------------------------------------------------- |
|
310 | #-------------------------------------------------------------------------- | |
280 | # LineFrontEnd interface |
|
311 | # LineFrontEnd interface | |
281 | #-------------------------------------------------------------------------- |
|
312 | #-------------------------------------------------------------------------- |
General Comments 0
You need to be logged in to leave comments.
Login now