Show More
@@ -302,18 +302,6 b' class WxConsoleView(stc.StyledTextCtrl):' | |||
|
302 | 302 | return self.GetTextRange(self.getCurrentPromptStart(), |
|
303 | 303 | self.getCurrentLineEnd()) |
|
304 | 304 | |
|
305 | def showReturned(self, text): | |
|
306 | ''' | |
|
307 | Show returned text from last command and print new prompt. | |
|
308 | ||
|
309 | @param text: Text to show. | |
|
310 | @type text: string | |
|
311 | ''' | |
|
312 | self.write('\n'+text) | |
|
313 | if text: | |
|
314 | self.write('\n') | |
|
315 | self.showPrompt() | |
|
316 | ||
|
317 | 305 | def moveCursorOnNewValidKey(self): |
|
318 | 306 | #If cursor is at wrong position put it at last line... |
|
319 | 307 | if self.GetCurrentPos() < self.getCurrentPromptStart(): |
@@ -461,6 +449,7 b' class IPShellWidget(wx.Panel):' | |||
|
461 | 449 | because it seems to be more useful |
|
462 | 450 | Any idea to make it more 'generic' welcomed. |
|
463 | 451 | ''' |
|
452 | ||
|
464 | 453 | def __init__(self, parent, intro=None, |
|
465 | 454 | background_color="BLACK", add_button_handler=None, |
|
466 | 455 | wx_ip_shell=None, |
@@ -475,7 +464,6 b' class IPShellWidget(wx.Panel):' | |||
|
475 | 464 | |
|
476 | 465 | ### IPython non blocking shell instanciation ### |
|
477 | 466 | self.cout = StringIO() |
|
478 | ||
|
479 | 467 | self.add_button_handler = add_button_handler |
|
480 | 468 | |
|
481 | 469 | if wx_ip_shell is not None: |
@@ -502,6 +490,8 b' class IPShellWidget(wx.Panel):' | |||
|
502 | 490 | intro=welcome_text, |
|
503 | 491 | background_color=background_color) |
|
504 | 492 | |
|
493 | self.cout.write = self.text_ctrl.write | |
|
494 | ||
|
505 | 495 | self.text_ctrl.Bind(wx.EVT_KEY_DOWN, self.keyPress, self.text_ctrl) |
|
506 | 496 | |
|
507 | 497 | ### making the layout of the panel ### |
@@ -525,6 +515,7 b' class IPShellWidget(wx.Panel):' | |||
|
525 | 515 | def stateDoExecuteLine(self): |
|
526 | 516 | #print >>sys.__stdout__,"command:",self.getCurrentLine() |
|
527 | 517 | line=self.text_ctrl.getCurrentLine() |
|
518 | self.text_ctrl.write('\n') | |
|
528 | 519 | self.IP.doExecute((line.replace('\t',' '*4)).encode('cp1252')) |
|
529 | 520 | self.updateHistoryTracker(self.text_ctrl.getCurrentLine()) |
|
530 | 521 | self.setCurrentState('WAIT_END_OF_EXECUTION') |
@@ -550,10 +541,7 b' class IPShellWidget(wx.Panel):' | |||
|
550 | 541 | self.text_ctrl.setPrompt(self.IP.getPrompt()) |
|
551 | 542 | self.text_ctrl.setIndentation(self.IP.getIndentation()) |
|
552 | 543 | self.text_ctrl.setPromptCount(self.IP.getPromptCount()) |
|
553 | rv = self.cout.getvalue() | |
|
554 | if rv: rv = rv.strip('\n') | |
|
555 | self.text_ctrl.showReturned(rv) | |
|
556 | self.cout.truncate(0) | |
|
544 | self.text_ctrl.showPrompt() | |
|
557 | 545 | self.IP.initHistoryIndex() |
|
558 | 546 | self.setCurrentState('IDLE') |
|
559 | 547 | |
@@ -641,7 +629,10 b' class IPShellWidget(wx.Panel):' | |||
|
641 | 629 | self.stateShowPrompt() |
|
642 | 630 | return |
|
643 | 631 | |
|
644 | #scroll_position = self.text_ctrl.GetScrollPos(wx.VERTICAL) | |
|
632 | # if self.cur_state == 'WAIT_END_OF_EXECUTION': | |
|
633 | # print self.cur_state | |
|
634 | # self.text_ctrl.write('.') | |
|
635 | ||
|
645 | 636 | if self.cur_state == 'IDLE': |
|
646 | 637 | if event.KeyCode == wx.WXK_UP: |
|
647 | 638 | history = self.IP.historyBack() |
@@ -36,8 +36,7 b' class MyFrame(wx.Frame):' | |||
|
36 | 36 | |
|
37 | 37 | self.ipython_panel = IPShellWidget(self,background_color = "BLACK") |
|
38 | 38 | |
|
39 |
#self.ipython_panel = |
|
|
40 | # background_color = "WHITE") | |
|
39 | #self.ipython_panel = IPShellWidget(self,background_color = "WHITE") | |
|
41 | 40 | |
|
42 | 41 | self.ipython_panel.setHistoryTrackerHook(self.history_panel.write) |
|
43 | 42 | self.ipython_panel.setStatusTrackerHook(self.updateStatus) |
General Comments 0
You need to be logged in to leave comments.
Login now