Show More
@@ -221,7 +221,7 b' class ConsoleWidget(editwindow.EditWindow):' | |||
|
221 | 221 | self.GotoPos(self.GetLength()) |
|
222 | 222 | wx.Yield() |
|
223 | 223 | |
|
224 |
|
|
|
224 | ||
|
225 | 225 | def new_prompt(self, prompt): |
|
226 | 226 | """ Prints a prompt at start of line, and move the start of the |
|
227 | 227 | current block there. |
@@ -26,6 +26,7 b' import re' | |||
|
26 | 26 | from wx import stc |
|
27 | 27 | from console_widget import ConsoleWidget |
|
28 | 28 | import __builtin__ |
|
29 | from time import sleep | |
|
29 | 30 | |
|
30 | 31 | from IPython.frontend.prefilterfrontend import PrefilterFrontEnd |
|
31 | 32 | |
@@ -118,6 +119,23 b' class IPythonWxController(PrefilterFrontEnd, ConsoleWidget):' | |||
|
118 | 119 | self.pop_completion(completions, offset=offset) |
|
119 | 120 | |
|
120 | 121 | |
|
122 | def raw_input(self, prompt): | |
|
123 | """ A replacement from python's raw_input. | |
|
124 | """ | |
|
125 | self.new_prompt(prompt) | |
|
126 | self.waiting = True | |
|
127 | self.__old_on_enter = self._on_enter | |
|
128 | def my_on_enter(): | |
|
129 | self.waiting = False | |
|
130 | self._on_enter = my_on_enter | |
|
131 | # Busy waiting, ugly. | |
|
132 | while self.waiting: | |
|
133 | wx.Yield() | |
|
134 | sleep(0.1) | |
|
135 | self._on_enter = self.__old_on_enter | |
|
136 | return self.get_current_edit_buffer().rstrip('\n') | |
|
137 | ||
|
138 | ||
|
121 | 139 | def execute(self, python_string, raw_string=None): |
|
122 | 140 | self.CallTipCancel() |
|
123 | 141 | self._cursor = wx.BusyCursor() |
@@ -133,7 +151,10 b' class IPythonWxController(PrefilterFrontEnd, ConsoleWidget):' | |||
|
133 | 151 | #self.SetSelection(self.GetLength()-1, self.GetLength()) |
|
134 | 152 | #self.ReplaceSelection('') |
|
135 | 153 | self.GotoPos(self.GetLength()) |
|
154 | self.__old_raw_input = __builtin__.raw_input | |
|
155 | __builtin__.raw_input = self.raw_input | |
|
136 | 156 | PrefilterFrontEnd.execute(self, python_string, raw_string=raw_string) |
|
157 | __builtin__.raw_input = self.__old_raw_input | |
|
137 | 158 | |
|
138 | 159 | |
|
139 | 160 | def after_execute(self): |
General Comments 0
You need to be logged in to leave comments.
Login now