##// END OF EJS Templates
IPythonX: terminate the mainloop when exiting, to close the child windows...
Gael Varoquaux -
Show More
@@ -80,6 +80,15 b' class IPythonX(wx.Frame):'
80 self.SetSizer(self._sizer)
80 self.SetSizer(self._sizer)
81 self.SetAutoLayout(1)
81 self.SetAutoLayout(1)
82 self.Show(True)
82 self.Show(True)
83 wx.EVT_CLOSE(self, self.on_close)
84
85
86 def on_close(self, event):
87 """ Called on closing the windows.
88
89 Stops the event loop, to close all the child windows.
90 """
91 wx.CallAfter(wx.Exit)
83
92
84
93
85 def main():
94 def main():
@@ -275,6 +275,30 b' class WxController(ConsoleWidget, PrefilterFrontEnd):'
275 milliseconds=100, oneShot=True)
275 milliseconds=100, oneShot=True)
276
276
277
277
278 #--------------------------------------------------------------------------
279 # LineFrontEnd interface
280 #--------------------------------------------------------------------------
281
282 def execute(self, python_string, raw_string=None):
283 self._input_state = 'buffering'
284 self.CallTipCancel()
285 self._cursor = wx.BusyCursor()
286 if raw_string is None:
287 raw_string = python_string
288 end_line = self.current_prompt_line \
289 + max(1, len(raw_string.split('\n'))-1)
290 for i in range(self.current_prompt_line, end_line):
291 if i in self._markers:
292 self.MarkerDeleteHandle(self._markers[i])
293 self._markers[i] = self.MarkerAdd(i, _COMPLETE_BUFFER_MARKER)
294 # Use a callafter to update the display robustly under windows
295 def callback():
296 self.GotoPos(self.GetLength())
297 PrefilterFrontEnd.execute(self, python_string,
298 raw_string=raw_string)
299 wx.CallAfter(callback)
300
301
278 def execute_command(self, command, hidden=False):
302 def execute_command(self, command, hidden=False):
279 """ Execute a command, not only in the model, but also in the
303 """ Execute a command, not only in the model, but also in the
280 view.
304 view.
@@ -307,29 +331,6 b' class WxController(ConsoleWidget, PrefilterFrontEnd):'
307 return True
331 return True
308
332
309
333
310 #--------------------------------------------------------------------------
311 # LineFrontEnd interface
312 #--------------------------------------------------------------------------
313
314 def execute(self, python_string, raw_string=None):
315 self._input_state = 'buffering'
316 self.CallTipCancel()
317 self._cursor = wx.BusyCursor()
318 if raw_string is None:
319 raw_string = python_string
320 end_line = self.current_prompt_line \
321 + max(1, len(raw_string.split('\n'))-1)
322 for i in range(self.current_prompt_line, end_line):
323 if i in self._markers:
324 self.MarkerDeleteHandle(self._markers[i])
325 self._markers[i] = self.MarkerAdd(i, _COMPLETE_BUFFER_MARKER)
326 # Use a callafter to update the display robustly under windows
327 def callback():
328 self.GotoPos(self.GetLength())
329 PrefilterFrontEnd.execute(self, python_string,
330 raw_string=raw_string)
331 wx.CallAfter(callback)
332
333 def save_output_hooks(self):
334 def save_output_hooks(self):
334 self.__old_raw_input = __builtin__.raw_input
335 self.__old_raw_input = __builtin__.raw_input
335 PrefilterFrontEnd.save_output_hooks(self)
336 PrefilterFrontEnd.save_output_hooks(self)
General Comments 0
You need to be logged in to leave comments. Login now