Show More
@@ -44,7 +44,7 b' class _Helper(object):' | |||
|
44 | 44 | |
|
45 | 45 | def __call__(self, *args, **kwds): |
|
46 | 46 | class DummyWriter(object): |
|
47 | '''Dumy class to handle help output''' | |
|
47 | '''Dumy class to handle help output''' | |
|
48 | 48 | def __init__(self, pager): |
|
49 | 49 | self._pager = pager |
|
50 | 50 | |
@@ -113,7 +113,6 b' class NonBlockingIPShell(object):' | |||
|
113 | 113 | ''' |
|
114 | 114 | #ipython0 initialisation |
|
115 | 115 | self._IP = None |
|
116 | self._term = None | |
|
117 | 116 | self.initIpython0(argv, user_ns, user_global_ns, |
|
118 | 117 | cin, cout, cerr, |
|
119 | 118 | ask_exit_handler) |
@@ -139,21 +138,19 b' class NonBlockingIPShell(object):' | |||
|
139 | 138 | ask_exit_handler=None): |
|
140 | 139 | ''' Initialize an ipython0 instance ''' |
|
141 | 140 | |
|
142 |
#first we redefine in/out/error functions of IPython |
|
|
141 | #first we redefine in/out/error functions of IPython | |
|
142 | #BUG: we've got a limitation form ipython0 there | |
|
143 | #only one instance can be instanciated else tehre will be | |
|
144 | #cin/cout/cerr clash... | |
|
143 | 145 | if cin: |
|
144 |
IPython. |
|
|
146 | IPython.genutils.Term.cin = cin | |
|
145 | 147 | if cout: |
|
146 |
IPython. |
|
|
148 | IPython.genutils.Term.cout = cout | |
|
147 | 149 | if cerr: |
|
148 |
IPython. |
|
|
150 | IPython.genutils.Term.cerr = cerr | |
|
149 | 151 | |
|
150 | # This is to get rid of the blockage that accurs during | |
|
151 | # IPython.Shell.InteractiveShell.user_setup() | |
|
152 | IPython.iplib.raw_input = lambda x: None | |
|
153 | ||
|
154 | self._term = IPython.genutils.IOTerm(cin=cin, cout=cout, cerr=cerr) | |
|
155 | ||
|
156 | 152 | excepthook = sys.excepthook |
|
153 | ||
|
157 | 154 | #Hack to save sys.displayhook, because ipython seems to overwrite it... |
|
158 | 155 | self.sys_displayhook_ori = sys.displayhook |
|
159 | 156 | |
@@ -163,7 +160,8 b' class NonBlockingIPShell(object):' | |||
|
163 | 160 | embedded=True, |
|
164 | 161 | shell_class=IPython.Shell.InteractiveShell) |
|
165 | 162 | |
|
166 | #we restore sys.displayhook | |
|
163 | #we save ipython0 displayhook and we restore sys.displayhook | |
|
164 | self.displayhook = sys.displayhook | |
|
167 | 165 | sys.displayhook = self.sys_displayhook_ori |
|
168 | 166 | |
|
169 | 167 | #we replace IPython default encoding by wx locale encoding |
@@ -199,6 +197,7 b' class NonBlockingIPShell(object):' | |||
|
199 | 197 | """ |
|
200 | 198 | |
|
201 | 199 | self._line_to_execute = line |
|
200 | ||
|
202 | 201 | if self._threading: |
|
203 | 202 | #we launch the ipython line execution in a thread to make it interruptible |
|
204 | 203 | #with include it in self namespace to be able to call ce.raise_exc(KeyboardInterrupt) |
@@ -214,6 +213,7 b' class NonBlockingIPShell(object):' | |||
|
214 | 213 | |
|
215 | 214 | except KeyboardInterrupt: |
|
216 | 215 | pass |
|
216 | ||
|
217 | 217 | #----------------------- IPython management section ---------------------- |
|
218 | 218 | def getThreading(self): |
|
219 | 219 | """ |
@@ -456,9 +456,12 b' class NonBlockingIPShell(object):' | |||
|
456 | 456 | ''' |
|
457 | 457 | Executes the current line provided by the shell object. |
|
458 | 458 | ''' |
|
459 | ||
|
459 | 460 | orig_stdout = sys.stdout |
|
460 | 461 | sys.stdout = IPython.Shell.Term.cout |
|
461 | ||
|
462 | #self.sys_displayhook_ori = sys.displayhook | |
|
463 | #sys.displayhook = self.displayhook | |
|
464 | ||
|
462 | 465 | try: |
|
463 | 466 | line = self._IP.raw_input(None, self._iter_more) |
|
464 | 467 | if self._IP.autoindent: |
@@ -486,8 +489,10 b' class NonBlockingIPShell(object):' | |||
|
486 | 489 | else: |
|
487 | 490 | self._prompt = str(self._IP.outputcache.prompt1).strip() |
|
488 | 491 | self._IP.indent_current_nsp = 0 #we set indentation to 0 |
|
492 | ||
|
489 | 493 | sys.stdout = orig_stdout |
|
490 | ||
|
494 | #sys.displayhook = self.sys_displayhook_ori | |
|
495 | ||
|
491 | 496 | def _shell(self, ip, cmd): |
|
492 | 497 | ''' |
|
493 | 498 | Replacement method to allow shell commands without them blocking. |
@@ -10,6 +10,9 b' from wx.lib.wordwrap import wordwrap' | |||
|
10 | 10 | from IPython.gui.wx.ipython_view import IPShellWidget |
|
11 | 11 | from IPython.gui.wx.ipython_history import IPythonHistoryPanel |
|
12 | 12 | |
|
13 | #used to invoke ipython1 wx implementation | |
|
14 | from IPython.frontend.wx.ipythonx import IPythonXController | |
|
15 | ||
|
13 | 16 | #used to create options.conf file in user directory |
|
14 | 17 | from IPython.ipapi import get |
|
15 | 18 | |
@@ -40,6 +43,7 b' class MyFrame(wx.Frame):' | |||
|
40 | 43 | self.history_panel.setOptionTrackerHook(self.optionSave) |
|
41 | 44 | |
|
42 | 45 | self.ipython_panel = IPShellWidget(self,background_color = "BLACK") |
|
46 | self.ipython_panel2 = IPythonXController(self) | |
|
43 | 47 | #self.ipython_panel = IPShellWidget(self,background_color = "WHITE") |
|
44 | 48 | |
|
45 | 49 | self.ipython_panel.setHistoryTrackerHook(self.history_panel.write) |
@@ -47,6 +51,9 b' class MyFrame(wx.Frame):' | |||
|
47 | 51 | self.ipython_panel.setAskExitHandler(self.OnExitDlg) |
|
48 | 52 | self.ipython_panel.setOptionTrackerHook(self.optionSave) |
|
49 | 53 | |
|
54 | #Create a notebook to display different IPython shell implementations | |
|
55 | self.nb = wx.aui.AuiNotebook(self) | |
|
56 | ||
|
50 | 57 | self.optionLoad() |
|
51 | 58 | |
|
52 | 59 | self.statusbar = self.createStatus() |
@@ -55,7 +62,10 b' class MyFrame(wx.Frame):' | |||
|
55 | 62 | ######################################################################## |
|
56 | 63 | ### add the panes to the manager |
|
57 | 64 | # main panels |
|
58 |
self._mgr.AddPane(self. |
|
|
65 | self._mgr.AddPane(self.nb , wx.CENTER, "IPython Shells") | |
|
66 | self.nb.AddPage(self.ipython_panel , "IPython0 Shell") | |
|
67 | self.nb.AddPage(self.ipython_panel2, "IPython1 Synchroneous Shell") | |
|
68 | ||
|
59 | 69 | self._mgr.AddPane(self.history_panel , wx.RIGHT, "IPython history") |
|
60 | 70 | |
|
61 | 71 | # now we specify some panel characteristics |
@@ -146,13 +156,6 b' class MyFrame(wx.Frame):' | |||
|
146 | 156 | about_menu = wx.Menu() |
|
147 | 157 | about_menu.Append(wx.ID_HIGHEST+3, "About") |
|
148 | 158 | |
|
149 | #view_menu.AppendSeparator() | |
|
150 | #options_menu = wx.Menu() | |
|
151 | #options_menu.AppendCheckItem(wx.ID_HIGHEST+7, "Allow Floating") | |
|
152 | #options_menu.AppendCheckItem(wx.ID_HIGHEST+8, "Transparent Hint") | |
|
153 | #options_menu.AppendCheckItem(wx.ID_HIGHEST+9, "Transparent Hint Fade-in") | |
|
154 | ||
|
155 | ||
|
156 | 159 | mb.Append(file_menu, "File") |
|
157 | 160 | mb.Append(view_menu, "View") |
|
158 | 161 | mb.Append(about_menu, "About") |
General Comments 0
You need to be logged in to leave comments.
Login now