Show More
@@ -0,0 +1,11 b'' | |||
|
1 | #!/usr/bin/env python | |
|
2 | # -*- coding: utf-8 -*- | |
|
3 | """wxIPython -- An enhanced Interactive Python GUI fonrtend | |
|
4 | This script starts the Wx graphical frontend. | |
|
5 | This is experimental so far. | |
|
6 | Currently it support only ipython0 instance. Will be upgraded to ipython1 one. | |
|
7 | """ | |
|
8 | ||
|
9 | from IPython.gui.wx import wxIPython | |
|
10 | ||
|
11 | wxIPython.main() |
@@ -26,6 +26,7 b' def make_color_table(in_class):' | |||
|
26 | 26 | Helper function for building the *TermColors classes.""" |
|
27 | 27 | |
|
28 | 28 | color_templates = ( |
|
29 | # Dark colors | |
|
29 | 30 | ("Black" , "0;30"), |
|
30 | 31 | ("Red" , "0;31"), |
|
31 | 32 | ("Green" , "0;32"), |
@@ -34,6 +35,7 b' def make_color_table(in_class):' | |||
|
34 | 35 | ("Purple" , "0;35"), |
|
35 | 36 | ("Cyan" , "0;36"), |
|
36 | 37 | ("LightGray" , "0;37"), |
|
38 | # Light colors | |
|
37 | 39 | ("DarkGray" , "1;30"), |
|
38 | 40 | ("LightRed" , "1;31"), |
|
39 | 41 | ("LightGreen" , "1;32"), |
@@ -41,7 +43,17 b' def make_color_table(in_class):' | |||
|
41 | 43 | ("LightBlue" , "1;34"), |
|
42 | 44 | ("LightPurple" , "1;35"), |
|
43 | 45 | ("LightCyan" , "1;36"), |
|
44 |
("White" , "1;37"), |
|
|
46 | ("White" , "1;37"), | |
|
47 | # Blinking colors. Probably should not be used in anything serious. | |
|
48 | ("BlinkBlack" , "5;30"), | |
|
49 | ("BlinkRed" , "5;31"), | |
|
50 | ("BlinkGreen" , "5;32"), | |
|
51 | ("BlinkYellow" , "5;33"), | |
|
52 | ("BlinkBlue" , "5;34"), | |
|
53 | ("BlinkPurple" , "5;35"), | |
|
54 | ("BlinkCyan" , "5;36"), | |
|
55 | ("BlinkLightGray", "5;37"), | |
|
56 | ) | |
|
45 | 57 | |
|
46 | 58 | for name,value in color_templates: |
|
47 | 59 | setattr(in_class,name,in_class._base % value) |
@@ -154,13 +154,18 b' class NonBlockingIPShell(object):' | |||
|
154 | 154 | self._term = IPython.genutils.IOTerm(cin=cin, cout=cout, cerr=cerr) |
|
155 | 155 | |
|
156 | 156 | excepthook = sys.excepthook |
|
157 | ||
|
157 | #Hack to save sys.displayhook, because ipython seems to overwrite it... | |
|
158 | self.sys_displayhook_ori = sys.displayhook | |
|
159 | ||
|
158 | 160 | self._IP = IPython.Shell.make_IPython( |
|
159 | 161 | argv,user_ns=user_ns, |
|
160 | 162 | user_global_ns=user_global_ns, |
|
161 | 163 | embedded=True, |
|
162 | 164 | shell_class=IPython.Shell.InteractiveShell) |
|
163 | 165 | |
|
166 | #we restore sys.displayhook | |
|
167 | sys.displayhook = self.sys_displayhook_ori | |
|
168 | ||
|
164 | 169 | #we replace IPython default encoding by wx locale encoding |
|
165 | 170 | loc = locale.getpreferredencoding() |
|
166 | 171 | if loc: |
@@ -195,8 +200,9 b' class NonBlockingIPShell(object):' | |||
|
195 | 200 | |
|
196 | 201 | self._line_to_execute = line |
|
197 | 202 | #we launch the ipython line execution in a thread to make it interruptible |
|
198 | ce = _CodeExecutor(self, self._afterExecute) | |
|
199 | ce.start() | |
|
203 | #with include it in self namespace to be able to call ce.raise_exc(KeyboardInterrupt) | |
|
204 | self.ce = _CodeExecutor(self, self._afterExecute) | |
|
205 | self.ce.start() | |
|
200 | 206 | |
|
201 | 207 | #----------------------- IPython management section ---------------------- |
|
202 | 208 | def getDocText(self): |
@@ -30,6 +30,21 b' import wx.stc as stc' | |||
|
30 | 30 | import re |
|
31 | 31 | from StringIO import StringIO |
|
32 | 32 | |
|
33 | import sys | |
|
34 | import codecs | |
|
35 | import locale | |
|
36 | for enc in (locale.getpreferredencoding(), | |
|
37 | sys.getfilesystemencoding(), | |
|
38 | sys.getdefaultencoding()): | |
|
39 | try: | |
|
40 | codecs.lookup(enc) | |
|
41 | ENCODING = enc | |
|
42 | break | |
|
43 | except LookupError: | |
|
44 | pass | |
|
45 | else: | |
|
46 | ENCODING = 'utf-8' | |
|
47 | ||
|
33 | 48 | from ipshell_nonblocking import NonBlockingIPShell |
|
34 | 49 | |
|
35 | 50 | class WxNonBlockingIPShell(NonBlockingIPShell): |
@@ -604,7 +619,7 b' class IPShellWidget(wx.Panel):' | |||
|
604 | 619 | self.text_ctrl.write('\n') |
|
605 | 620 | lines_to_execute = lines.replace('\t',' '*4) |
|
606 | 621 | lines_to_execute = lines_to_execute.replace('\r','') |
|
607 |
self.IP.doExecute(lines_to_execute.encode( |
|
|
622 | self.IP.doExecute(lines_to_execute.encode(ENCODING)) | |
|
608 | 623 | self.updateHistoryTracker(lines) |
|
609 | 624 | self.setCurrentState('WAIT_END_OF_EXECUTION') |
|
610 | 625 |
@@ -2,7 +2,7 b'' | |||
|
2 | 2 | # -*- coding: iso-8859-15 -*- |
|
3 | 3 | |
|
4 | 4 | import wx.aui |
|
5 | ||
|
5 | import sys | |
|
6 | 6 | #used for about dialog |
|
7 | 7 | from wx.lib.wordwrap import wordwrap |
|
8 | 8 | |
@@ -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 create options.conf file in user directory | |
|
14 | from IPython.ipapi import get | |
|
15 | ||
|
13 | 16 | __version__ = 0.8 |
|
14 | 17 | __author__ = "Laurent Dufrechou" |
|
15 | 18 | __email__ = "laurent.dufrechou _at_ gmail.com" |
@@ -84,7 +87,9 b' class MyFrame(wx.Frame):' | |||
|
84 | 87 | dlg.Destroy() |
|
85 | 88 | |
|
86 | 89 | def optionSave(self, name, value): |
|
87 | opt = open('options.conf','w') | |
|
90 | ip = get() | |
|
91 | path = ip.IP.rc.ipythondir | |
|
92 | opt = open(path + '/options.conf','w') | |
|
88 | 93 | |
|
89 | 94 | try: |
|
90 | 95 | options_ipython_panel = self.ipython_panel.getOptions() |
@@ -98,24 +103,31 b' class MyFrame(wx.Frame):' | |||
|
98 | 103 | opt.close() |
|
99 | 104 | |
|
100 | 105 | def optionLoad(self): |
|
101 | opt = open('options.conf','r') | |
|
102 | lines = opt.readlines() | |
|
103 | opt.close() | |
|
106 | try: | |
|
107 | ip = get() | |
|
108 | path = ip.IP.rc.ipythondir | |
|
109 | opt = open(path + '/options.conf','r') | |
|
110 | lines = opt.readlines() | |
|
111 | opt.close() | |
|
104 | 112 | |
|
105 | options_ipython_panel = self.ipython_panel.getOptions() | |
|
106 | options_history_panel = self.history_panel.getOptions() | |
|
107 | ||
|
108 | for line in lines: | |
|
109 | key = line.split('=')[0] | |
|
110 | value = line.split('=')[1].replace('\n','').replace('\r','') | |
|
111 | if key in options_ipython_panel.keys(): | |
|
112 | options_ipython_panel[key]['value'] = value | |
|
113 | elif key in options_history_panel.keys(): | |
|
114 | options_history_panel[key]['value'] = value | |
|
115 | else: | |
|
116 | print >>sys.__stdout__,"Warning: key ",key,"not found in widget options. Check Options.conf" | |
|
117 | self.ipython_panel.reloadOptions(options_ipython_panel) | |
|
118 | self.history_panel.reloadOptions(options_history_panel) | |
|
113 | options_ipython_panel = self.ipython_panel.getOptions() | |
|
114 | options_history_panel = self.history_panel.getOptions() | |
|
115 | ||
|
116 | for line in lines: | |
|
117 | key = line.split('=')[0] | |
|
118 | value = line.split('=')[1].replace('\n','').replace('\r','') | |
|
119 | if key in options_ipython_panel.keys(): | |
|
120 | options_ipython_panel[key]['value'] = value | |
|
121 | elif key in options_history_panel.keys(): | |
|
122 | options_history_panel[key]['value'] = value | |
|
123 | else: | |
|
124 | print >>sys.__stdout__,"Warning: key ",key,"not found in widget options. Check Options.conf" | |
|
125 | self.ipython_panel.reloadOptions(options_ipython_panel) | |
|
126 | self.history_panel.reloadOptions(options_history_panel) | |
|
127 | ||
|
128 | except IOError: | |
|
129 | print >>sys.__stdout__,"Could not open Options.conf, defaulting to default values." | |
|
130 | ||
|
119 | 131 | |
|
120 | 132 | def createMenu(self): |
|
121 | 133 | """local method used to create one menu bar""" |
@@ -40,7 +40,7 b' def install():' | |||
|
40 | 40 | print ('To take full advantage of IPython, you need readline from:\n' |
|
41 | 41 | 'http://sourceforge.net/projects/uncpythontools') |
|
42 | 42 | |
|
43 | ipybase = '"'+prefix+r'\scripts\ipython"' | |
|
43 | ipybase = '"' + prefix + r'\scripts\ipython"' | |
|
44 | 44 | # Create IPython entry ... |
|
45 | 45 | if not os.path.isdir(ip_dir): |
|
46 | 46 | os.mkdir(ip_dir) |
@@ -59,12 +59,12 b' def install():' | |||
|
59 | 59 | a = ipybase+' -pylab -p scipy' |
|
60 | 60 | mkshortcut(python,'IPython scipy profile',f,a) |
|
61 | 61 | |
|
62 |
# Create documentation shortcuts ... |
|
|
62 | # Create documentation shortcuts ... | |
|
63 | 63 | t = prefix + r'\share\doc\ipython\manual\ipython.pdf' |
|
64 | 64 | f = ip_dir + r'\Manual in PDF.lnk' |
|
65 | 65 | mkshortcut(t,r'IPython Manual - PDF-Format',f) |
|
66 | 66 | |
|
67 |
t = prefix + r'\share\doc\ipython\manual\i |
|
|
67 | t = prefix + r'\share\doc\ipython\manual\html\index.html' | |
|
68 | 68 | f = ip_dir + r'\Manual in HTML.lnk' |
|
69 | 69 | mkshortcut(t,'IPython Manual - HTML-Format',f) |
|
70 | 70 |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now