Show More
@@ -0,0 +1,19 b'' | |||||
|
1 | """ Completers for miscellaneous command line apps | |||
|
2 | ||||
|
3 | """ | |||
|
4 | import IPython.ipapi | |||
|
5 | ip = IPython.ipapi.get() | |||
|
6 | import os | |||
|
7 | ||||
|
8 | def surfraw_completer(self,cmdline): | |||
|
9 | """ Completer for 'surfraw' | |||
|
10 | ||||
|
11 | example:: | |||
|
12 | sr go<tab> => sr google | |||
|
13 | ||||
|
14 | """ | |||
|
15 | compl = [l.split(None,1)[0] for l in os.popen('sr -elvi')] | |||
|
16 | return compl | |||
|
17 | ||||
|
18 | ||||
|
19 | ip.set_hook('complete_command', surfraw_completer, str_key = 'sr') No newline at end of file |
@@ -0,0 +1,22 b'' | |||||
|
1 | # If you want ipython to appear in a linux app launcher ("start menu"), install this by doing: | |||
|
2 | # sudo desktop-file-install ipython-sh.desktop | |||
|
3 | ||||
|
4 | [Desktop Entry] | |||
|
5 | Comment=Perform shell-like tasks in interactive ipython session | |||
|
6 | Exec=ipython -p sh | |||
|
7 | GenericName[en_US]=IPython shell mode | |||
|
8 | GenericName=IPython shell mode | |||
|
9 | Icon=gnome-netstatus-idle | |||
|
10 | MimeType= | |||
|
11 | Name[en_US]=ipython-sh | |||
|
12 | Name=ipython-sh | |||
|
13 | Path= | |||
|
14 | Categories=Development;Utility; | |||
|
15 | StartupNotify=false | |||
|
16 | Terminal=true | |||
|
17 | TerminalOptions= | |||
|
18 | Type=Application | |||
|
19 | X-DBUS-ServiceName= | |||
|
20 | X-DBUS-StartupType=none | |||
|
21 | X-KDE-SubstituteUID=false | |||
|
22 | X-KDE-Username= |
@@ -0,0 +1,22 b'' | |||||
|
1 | # If you want ipython to appear in a linux app launcher ("start menu"), install this by doing: | |||
|
2 | # sudo desktop-file-install ipython.desktop | |||
|
3 | ||||
|
4 | [Desktop Entry] | |||
|
5 | Comment=Enhanced interactive Python shell | |||
|
6 | Exec=ipython | |||
|
7 | GenericName[en_US]=IPython | |||
|
8 | GenericName=IPython | |||
|
9 | Icon=gnome-netstatus-idle | |||
|
10 | MimeType= | |||
|
11 | Name[en_US]=ipython | |||
|
12 | Name=ipython | |||
|
13 | Path= | |||
|
14 | Categories=Development;Utility; | |||
|
15 | StartupNotify=false | |||
|
16 | Terminal=true | |||
|
17 | TerminalOptions= | |||
|
18 | Type=Application | |||
|
19 | X-DBUS-ServiceName= | |||
|
20 | X-DBUS-StartupType=none | |||
|
21 | X-KDE-SubstituteUID=false | |||
|
22 | X-KDE-Username= |
@@ -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() |
@@ -154,13 +154,18 b' class NonBlockingIPShell(object):' | |||||
154 | self._term = IPython.genutils.IOTerm(cin=cin, cout=cout, cerr=cerr) |
|
154 | self._term = IPython.genutils.IOTerm(cin=cin, cout=cout, cerr=cerr) | |
155 |
|
155 | |||
156 | excepthook = sys.excepthook |
|
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 | self._IP = IPython.Shell.make_IPython( |
|
160 | self._IP = IPython.Shell.make_IPython( | |
159 | argv,user_ns=user_ns, |
|
161 | argv,user_ns=user_ns, | |
160 | user_global_ns=user_global_ns, |
|
162 | user_global_ns=user_global_ns, | |
161 | embedded=True, |
|
163 | embedded=True, | |
162 | shell_class=IPython.Shell.InteractiveShell) |
|
164 | shell_class=IPython.Shell.InteractiveShell) | |
163 |
|
165 | |||
|
166 | #we restore sys.displayhook | |||
|
167 | sys.displayhook = self.sys_displayhook_ori | |||
|
168 | ||||
164 | #we replace IPython default encoding by wx locale encoding |
|
169 | #we replace IPython default encoding by wx locale encoding | |
165 | loc = locale.getpreferredencoding() |
|
170 | loc = locale.getpreferredencoding() | |
166 | if loc: |
|
171 | if loc: | |
@@ -195,8 +200,9 b' class NonBlockingIPShell(object):' | |||||
195 |
|
200 | |||
196 | self._line_to_execute = line |
|
201 | self._line_to_execute = line | |
197 | #we launch the ipython line execution in a thread to make it interruptible |
|
202 | #we launch the ipython line execution in a thread to make it interruptible | |
198 | ce = _CodeExecutor(self, self._afterExecute) |
|
203 | #with include it in self namespace to be able to call ce.raise_exc(KeyboardInterrupt) | |
199 | ce.start() |
|
204 | self.ce = _CodeExecutor(self, self._afterExecute) | |
|
205 | self.ce.start() | |||
200 |
|
206 | |||
201 | #----------------------- IPython management section ---------------------- |
|
207 | #----------------------- IPython management section ---------------------- | |
202 | def getDocText(self): |
|
208 | def getDocText(self): |
@@ -30,6 +30,21 b' import wx.stc as stc' | |||||
30 | import re |
|
30 | import re | |
31 | from StringIO import StringIO |
|
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 | from ipshell_nonblocking import NonBlockingIPShell |
|
48 | from ipshell_nonblocking import NonBlockingIPShell | |
34 |
|
49 | |||
35 | class WxNonBlockingIPShell(NonBlockingIPShell): |
|
50 | class WxNonBlockingIPShell(NonBlockingIPShell): | |
@@ -604,7 +619,7 b' class IPShellWidget(wx.Panel):' | |||||
604 | self.text_ctrl.write('\n') |
|
619 | self.text_ctrl.write('\n') | |
605 | lines_to_execute = lines.replace('\t',' '*4) |
|
620 | lines_to_execute = lines.replace('\t',' '*4) | |
606 | lines_to_execute = lines_to_execute.replace('\r','') |
|
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 | self.updateHistoryTracker(lines) |
|
623 | self.updateHistoryTracker(lines) | |
609 | self.setCurrentState('WAIT_END_OF_EXECUTION') |
|
624 | self.setCurrentState('WAIT_END_OF_EXECUTION') | |
610 |
|
625 |
@@ -2,7 +2,7 b'' | |||||
2 | # -*- coding: iso-8859-15 -*- |
|
2 | # -*- coding: iso-8859-15 -*- | |
3 |
|
3 | |||
4 | import wx.aui |
|
4 | import wx.aui | |
5 |
|
5 | import sys | ||
6 | #used for about dialog |
|
6 | #used for about dialog | |
7 | from wx.lib.wordwrap import wordwrap |
|
7 | from wx.lib.wordwrap import wordwrap | |
8 |
|
8 | |||
@@ -10,6 +10,9 b' from wx.lib.wordwrap import wordwrap' | |||||
10 | from IPython.gui.wx.ipython_view import IPShellWidget |
|
10 | 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 create options.conf file in user directory | |||
|
14 | from IPython.ipapi import get | |||
|
15 | ||||
13 | __version__ = 0.8 |
|
16 | __version__ = 0.8 | |
14 | __author__ = "Laurent Dufrechou" |
|
17 | __author__ = "Laurent Dufrechou" | |
15 | __email__ = "laurent.dufrechou _at_ gmail.com" |
|
18 | __email__ = "laurent.dufrechou _at_ gmail.com" | |
@@ -84,7 +87,9 b' class MyFrame(wx.Frame):' | |||||
84 | dlg.Destroy() |
|
87 | dlg.Destroy() | |
85 |
|
88 | |||
86 | def optionSave(self, name, value): |
|
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 | try: |
|
94 | try: | |
90 | options_ipython_panel = self.ipython_panel.getOptions() |
|
95 | options_ipython_panel = self.ipython_panel.getOptions() | |
@@ -98,24 +103,31 b' class MyFrame(wx.Frame):' | |||||
98 | opt.close() |
|
103 | opt.close() | |
99 |
|
104 | |||
100 | def optionLoad(self): |
|
105 | def optionLoad(self): | |
101 | opt = open('options.conf','r') |
|
106 | try: | |
102 | lines = opt.readlines() |
|
107 | ip = get() | |
103 | opt.close() |
|
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() |
|
113 | options_ipython_panel = self.ipython_panel.getOptions() | |
106 | options_history_panel = self.history_panel.getOptions() |
|
114 | options_history_panel = self.history_panel.getOptions() | |
107 |
|
115 | |||
108 | for line in lines: |
|
116 | for line in lines: | |
109 | key = line.split('=')[0] |
|
117 | key = line.split('=')[0] | |
110 | value = line.split('=')[1].replace('\n','').replace('\r','') |
|
118 | value = line.split('=')[1].replace('\n','').replace('\r','') | |
111 | if key in options_ipython_panel.keys(): |
|
119 | if key in options_ipython_panel.keys(): | |
112 | options_ipython_panel[key]['value'] = value |
|
120 | options_ipython_panel[key]['value'] = value | |
113 | elif key in options_history_panel.keys(): |
|
121 | elif key in options_history_panel.keys(): | |
114 | options_history_panel[key]['value'] = value |
|
122 | options_history_panel[key]['value'] = value | |
115 | else: |
|
123 | else: | |
116 | print >>sys.__stdout__,"Warning: key ",key,"not found in widget options. Check Options.conf" |
|
124 | print >>sys.__stdout__,"Warning: key ",key,"not found in widget options. Check Options.conf" | |
117 | self.ipython_panel.reloadOptions(options_ipython_panel) |
|
125 | self.ipython_panel.reloadOptions(options_ipython_panel) | |
118 | self.history_panel.reloadOptions(options_history_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 | def createMenu(self): |
|
132 | def createMenu(self): | |
121 | """local method used to create one menu bar""" |
|
133 | """local method used to create one menu bar""" |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now