##// END OF EJS Templates
Added a check in case user don't have twisted installed....
laurent dufrechou -
Show More
@@ -11,12 +11,16 b' from IPython.gui.wx.ipython_view import IPShellWidget'
11 from IPython.gui.wx.ipython_history import IPythonHistoryPanel
11 from IPython.gui.wx.ipython_history import IPythonHistoryPanel
12
12
13 #used to invoke ipython1 wx implementation
13 #used to invoke ipython1 wx implementation
14 from IPython.frontend.wx.ipythonx import IPythonXController
14 is_sync_frontend_ok = True
15 try:
16 from IPython.frontend.wx.ipythonx import IPythonXController
17 except ImportError:
18 is_sync_frontend_ok = False
15
19
16 #used to create options.conf file in user directory
20 #used to create options.conf file in user directory
17 from IPython.ipapi import get
21 from IPython.ipapi import get
18
22
19 __version__ = 0.9
23 __version__ = 0.91
20 __author__ = "Laurent Dufrechou"
24 __author__ = "Laurent Dufrechou"
21 __email__ = "laurent.dufrechou _at_ gmail.com"
25 __email__ = "laurent.dufrechou _at_ gmail.com"
22 __license__ = "BSD"
26 __license__ = "BSD"
@@ -30,7 +34,7 b' class MyFrame(wx.Frame):'
30 application with movables windows"""
34 application with movables windows"""
31 def __init__(self, parent=None, id=-1, title="WxIPython",
35 def __init__(self, parent=None, id=-1, title="WxIPython",
32 pos=wx.DefaultPosition,
36 pos=wx.DefaultPosition,
33 size=(800, 600), style=wx.DEFAULT_FRAME_STYLE):
37 size=(800, 600), style=wx.DEFAULT_FRAME_STYLE, sync_ok=False):
34 wx.Frame.__init__(self, parent, id, title, pos, size, style)
38 wx.Frame.__init__(self, parent, id, title, pos, size, style)
35 self._mgr = wx.aui.AuiManager()
39 self._mgr = wx.aui.AuiManager()
36
40
@@ -43,9 +47,11 b' class MyFrame(wx.Frame):'
43 self.history_panel.setOptionTrackerHook(self.optionSave)
47 self.history_panel.setOptionTrackerHook(self.optionSave)
44
48
45 self.ipython_panel = IPShellWidget(self,background_color = "BLACK")
49 self.ipython_panel = IPShellWidget(self,background_color = "BLACK")
46 self.ipython_panel2 = IPythonXController(self)
47 #self.ipython_panel = IPShellWidget(self,background_color = "WHITE")
50 #self.ipython_panel = IPShellWidget(self,background_color = "WHITE")
48
51 if(sync_ok):
52 self.ipython_panel2 = IPythonXController(self)
53 else:
54 self.ipython_panel2 = None
49 self.ipython_panel.setHistoryTrackerHook(self.history_panel.write)
55 self.ipython_panel.setHistoryTrackerHook(self.history_panel.write)
50 self.ipython_panel.setStatusTrackerHook(self.updateStatus)
56 self.ipython_panel.setStatusTrackerHook(self.updateStatus)
51 self.ipython_panel.setAskExitHandler(self.OnExitDlg)
57 self.ipython_panel.setAskExitHandler(self.OnExitDlg)
@@ -64,7 +70,8 b' class MyFrame(wx.Frame):'
64 # main panels
70 # main panels
65 self._mgr.AddPane(self.nb , wx.CENTER, "IPython Shells")
71 self._mgr.AddPane(self.nb , wx.CENTER, "IPython Shells")
66 self.nb.AddPage(self.ipython_panel , "IPython0 Shell")
72 self.nb.AddPage(self.ipython_panel , "IPython0 Shell")
67 self.nb.AddPage(self.ipython_panel2, "IPython1 Synchroneous Shell")
73 if(sync_ok):
74 self.nb.AddPage(self.ipython_panel2, "IPython1 Synchroneous Shell")
68
75
69 self._mgr.AddPane(self.history_panel , wx.RIGHT, "IPython history")
76 self._mgr.AddPane(self.history_panel , wx.RIGHT, "IPython history")
70
77
@@ -237,20 +244,20 b' class MyFrame(wx.Frame):'
237 #-----------------------------------------
244 #-----------------------------------------
238 class MyApp(wx.PySimpleApp):
245 class MyApp(wx.PySimpleApp):
239 """Creating our application"""
246 """Creating our application"""
240 def __init__(self):
247 def __init__(self, sync_ok=False):
241 wx.PySimpleApp.__init__(self)
248 wx.PySimpleApp.__init__(self)
242
249
243 self.frame = MyFrame()
250 self.frame = MyFrame(sync_ok=sync_ok)
244 self.frame.Show()
251 self.frame.Show()
245
252
246 #-----------------------------------------
253 #-----------------------------------------
247 #Main loop
254 #Main loop
248 #-----------------------------------------
255 #-----------------------------------------
249 def main():
256 def main(sync_ok):
250 app = MyApp()
257 app = MyApp(sync_ok)
251 app.SetTopWindow(app.frame)
258 app.SetTopWindow(app.frame)
252 app.MainLoop()
259 app.MainLoop()
253
260
254 #if launched as main program run this
261 #if launched as main program run this
255 if __name__ == '__main__':
262 if __name__ == '__main__':
256 main()
263 main(is_sync_frontend_ok)
General Comments 0
You need to be logged in to leave comments. Login now