Show More
@@ -171,7 +171,8 b' class NonBlockingIPShell(object):' | |||||
171 | #we replace the ipython default pager by our pager |
|
171 | #we replace the ipython default pager by our pager | |
172 | self._IP.set_hook('show_in_pager', self._pager) |
|
172 | self._IP.set_hook('show_in_pager', self._pager) | |
173 |
|
173 | |||
174 |
#we replace the ipython default shell command caller |
|
174 | #we replace the ipython default shell command caller | |
|
175 | #by our shell handler | |||
175 | self._IP.set_hook('shell_hook', self._shell) |
|
176 | self._IP.set_hook('shell_hook', self._shell) | |
176 |
|
177 | |||
177 | #we replace the ipython default input command caller by our method |
|
178 | #we replace the ipython default input command caller by our method | |
@@ -210,7 +211,7 b' class NonBlockingIPShell(object):' | |||||
210 |
|
211 | |||
211 | sys.excepthook = excepthook |
|
212 | sys.excepthook = excepthook | |
212 |
|
213 | |||
213 |
#----------------------- Thread management section ---------------------- |
|
214 | #----------------------- Thread management section ---------------------- | |
214 | def do_execute(self, line): |
|
215 | def do_execute(self, line): | |
215 | """ |
|
216 | """ | |
216 | Tell the thread to process the 'line' command |
|
217 | Tell the thread to process the 'line' command | |
@@ -219,8 +220,9 b' class NonBlockingIPShell(object):' | |||||
219 | self._line_to_execute = line |
|
220 | self._line_to_execute = line | |
220 |
|
221 | |||
221 | if self._threading: |
|
222 | if self._threading: | |
222 |
#we launch the ipython line execution in a thread to make it |
|
223 | #we launch the ipython line execution in a thread to make it | |
223 |
#with include it in self namespace to be able |
|
224 | #interruptible with include it in self namespace to be able | |
|
225 | #to call ce.raise_exc(KeyboardInterrupt) | |||
224 | self.ce = _CodeExecutor(self) |
|
226 | self.ce = _CodeExecutor(self) | |
225 | self.ce.start() |
|
227 | self.ce.start() | |
226 | else: |
|
228 | else: | |
@@ -234,7 +236,7 b' class NonBlockingIPShell(object):' | |||||
234 | except KeyboardInterrupt: |
|
236 | except KeyboardInterrupt: | |
235 | pass |
|
237 | pass | |
236 |
|
238 | |||
237 |
#----------------------- IPython management section ---------------------- |
|
239 | #----------------------- IPython management section ---------------------- | |
238 | def get_threading(self): |
|
240 | def get_threading(self): | |
239 | """ |
|
241 | """ | |
240 | Returns threading status, is set to True, then each command sent to |
|
242 | Returns threading status, is set to True, then each command sent to | |
@@ -501,7 +503,8 b' class NonBlockingIPShell(object):' | |||||
501 | else: |
|
503 | else: | |
502 | self._IP.write(str(self._IP.outputcache.prompt_out).strip()) |
|
504 | self._IP.write(str(self._IP.outputcache.prompt_out).strip()) | |
503 | self._iter_more = self._IP.push(line) |
|
505 | self._iter_more = self._IP.push(line) | |
504 |
if (self._IP.SyntaxTB.last_syntax_error and |
|
506 | if (self._IP.SyntaxTB.last_syntax_error and \ | |
|
507 | self._IP.rc.autoedit_syntax): | |||
505 | self._IP.edit_syntax_error() |
|
508 | self._IP.edit_syntax_error() | |
506 | if self._iter_more: |
|
509 | if self._iter_more: | |
507 | self._prompt = str(self._IP.outputcache.prompt2).strip() |
|
510 | self._prompt = str(self._IP.outputcache.prompt2).strip() | |
@@ -524,7 +527,8 b' class NonBlockingIPShell(object):' | |||||
524 | @type cmd: string |
|
527 | @type cmd: string | |
525 | ''' |
|
528 | ''' | |
526 | stdin, stdout = os.popen4(cmd) |
|
529 | stdin, stdout = os.popen4(cmd) | |
527 |
result = stdout.read().decode('cp437'). |
|
530 | result = stdout.read().decode('cp437').\ | |
|
531 | encode(locale.getpreferredencoding()) | |||
528 | #we use print command because the shell command is called |
|
532 | #we use print command because the shell command is called | |
529 | #inside IPython instance and thus is redirected to thread cout |
|
533 | #inside IPython instance and thus is redirected to thread cout | |
530 | #"\x01\x1b[1;36m\x02" <-- add colour to the text... |
|
534 | #"\x01\x1b[1;36m\x02" <-- add colour to the text... |
@@ -29,17 +29,21 b' class IPythonHistoryPanel(wx.Panel):' | |||||
29 | self.filter_magic = wx.CheckBox(self, -1, "%: Magic keys") |
|
29 | self.filter_magic = wx.CheckBox(self, -1, "%: Magic keys") | |
30 |
|
30 | |||
31 | self.options={'filter_empty':{'value':'True', |
|
31 | self.options={'filter_empty':{'value':'True', | |
32 |
|
|
32 | 'checkbox':self.filter_empty, \ | |
33 |
' |
|
33 | 'True':True,'False':False, | |
|
34 | 'setfunc':lambda x:None}, | |||
34 | 'filter_doc':{'value':'True', |
|
35 | 'filter_doc':{'value':'True', | |
35 |
|
|
36 | 'checkbox':self.filter_doc, \ | |
36 |
' |
|
37 | 'True':True,'False':False, | |
|
38 | 'setfunc':lambda x:None}, | |||
37 | 'filter_cmd':{'value':'True', |
|
39 | 'filter_cmd':{'value':'True', | |
38 |
|
|
40 | 'checkbox':self.filter_cmd, \ | |
39 |
' |
|
41 | 'True':True,'False':False, | |
|
42 | 'setfunc':lambda x:None}, | |||
40 | 'filter_magic':{'value':'True', |
|
43 | 'filter_magic':{'value':'True', | |
41 |
|
|
44 | 'checkbox':self.filter_magic, \ | |
42 |
' |
|
45 | 'True':True,'False':False, | |
|
46 | 'setfunc':lambda x:None}, | |||
43 | } |
|
47 | } | |
44 | self.reloadOptions(self.options) |
|
48 | self.reloadOptions(self.options) | |
45 |
|
49 | |||
@@ -199,51 +203,81 b' class PythonSTC(stc.StyledTextCtrl):' | |||||
199 | self.SetLayoutCache(stc.STC_CACHE_PAGE) |
|
203 | self.SetLayoutCache(stc.STC_CACHE_PAGE) | |
200 |
|
204 | |||
201 | # Setup a margin to hold fold markers |
|
205 | # Setup a margin to hold fold markers | |
202 | #self.SetFoldFlags(16) ### WHAT IS THIS VALUE? WHAT ARE THE OTHER FLAGS? DOES IT MATTER? |
|
206 | #self.SetFoldFlags(16) | |
|
207 | ### WHAT IS THIS VALUE? WHAT ARE THE OTHER FLAGS? DOES IT MATTER? | |||
203 | self.SetMarginType(2, stc.STC_MARGIN_SYMBOL) |
|
208 | self.SetMarginType(2, stc.STC_MARGIN_SYMBOL) | |
204 | self.SetMarginMask(2, stc.STC_MASK_FOLDERS) |
|
209 | self.SetMarginMask(2, stc.STC_MASK_FOLDERS) | |
205 | self.SetMarginSensitive(2, True) |
|
210 | self.SetMarginSensitive(2, True) | |
206 | self.SetMarginWidth(2, 12) |
|
211 | self.SetMarginWidth(2, 12) | |
207 |
|
212 | |||
208 | if self.fold_symbols == 0: |
|
213 | if self.fold_symbols == 0: | |
209 |
# Arrow pointing right for contracted folders, |
|
214 | # Arrow pointing right for contracted folders, | |
210 | self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_ARROWDOWN, "black", "black") |
|
215 | # arrow pointing down for expanded | |
211 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDER |
|
216 | self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, \ | |
212 | self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, stc.STC_MARK_EMPTY, "black", "black") |
|
217 | stc.STC_MARK_ARROWDOWN, "black", "black") | |
213 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDER |
|
218 | self.MarkerDefine(stc.STC_MARKNUM_FOLDER, \ | |
214 | self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, stc.STC_MARK_EMPTY, "white", "black") |
|
219 | stc.STC_MARK_ARROW, "black", "black") | |
215 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDER |
|
220 | self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, \ | |
216 | self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_EMPTY, "white", "black") |
|
221 | stc.STC_MARK_EMPTY, "black", "black") | |
|
222 | self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, \ | |||
|
223 | stc.STC_MARK_EMPTY, "black", "black") | |||
|
224 | self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, \ | |||
|
225 | stc.STC_MARK_EMPTY, "white", "black") | |||
|
226 | self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, \ | |||
|
227 | stc.STC_MARK_EMPTY, "white", "black") | |||
|
228 | self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, \ | |||
|
229 | stc.STC_MARK_EMPTY, "white", "black") | |||
217 |
|
230 | |||
218 | elif self.fold_symbols == 1: |
|
231 | elif self.fold_symbols == 1: | |
219 | # Plus for contracted folders, minus for expanded |
|
232 | # Plus for contracted folders, minus for expanded | |
220 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, |
|
233 | self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, \ | |
221 |
|
|
234 | stc.STC_MARK_MINUS, "white", "black") | |
222 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDER |
|
235 | self.MarkerDefine(stc.STC_MARKNUM_FOLDER, \ | |
223 | self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_EMPTY, "white", "black") |
|
236 | stc.STC_MARK_PLUS, "white", "black") | |
224 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDER |
|
237 | self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, \ | |
225 | self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_EMPTY, "white", "black") |
|
238 | stc.STC_MARK_EMPTY, "white", "black") | |
226 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDER |
|
239 | self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, \ | |
|
240 | stc.STC_MARK_EMPTY, "white", "black") | |||
|
241 | self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, \ | |||
|
242 | stc.STC_MARK_EMPTY, "white", "black") | |||
|
243 | self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, \ | |||
|
244 | stc.STC_MARK_EMPTY, "white", "black") | |||
|
245 | self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, \ | |||
|
246 | stc.STC_MARK_EMPTY, "white", "black") | |||
227 |
|
247 | |||
228 | elif self.fold_symbols == 2: |
|
248 | elif self.fold_symbols == 2: | |
229 | # Like a flattened tree control using circular headers and curved joins |
|
249 | # Like a flattened tree control using circular headers and curved joins | |
230 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, |
|
250 | self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, \ | |
231 |
|
|
251 | stc.STC_MARK_CIRCLEMINUS, "white", "#404040") | |
232 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDER |
|
252 | self.MarkerDefine(stc.STC_MARKNUM_FOLDER, \ | |
233 | self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_LCORNERCURVE, "white", "#404040") |
|
253 | stc.STC_MARK_CIRCLEPLUS, "white", "#404040") | |
234 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDER |
|
254 | self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, \ | |
235 | self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_CIRCLEMINUSCONNECTED, "white", "#404040") |
|
255 | stc.STC_MARK_VLINE, "white", "#404040") | |
236 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDER |
|
256 | self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, \ | |
|
257 | stc.STC_MARK_LCORNERCURVE, "white", "#404040") | |||
|
258 | self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, \ | |||
|
259 | stc.STC_MARK_CIRCLEPLUSCONNECTED, "white", "#404040") | |||
|
260 | self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, \ | |||
|
261 | stc.STC_MARK_CIRCLEMINUSCONNECTED, "white", "#404040") | |||
|
262 | self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, \ | |||
|
263 | stc.STC_MARK_TCORNERCURVE, "white", "#404040") | |||
237 |
|
264 | |||
238 | elif self.fold_symbols == 3: |
|
265 | elif self.fold_symbols == 3: | |
239 | # Like a flattened tree control using square headers |
|
266 | # Like a flattened tree control using square headers | |
240 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, |
|
267 | self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, \ | |
241 |
|
|
268 | stc.STC_MARK_BOXMINUS, "white", "#808080") | |
242 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDER |
|
269 | self.MarkerDefine(stc.STC_MARKNUM_FOLDER, \ | |
243 | self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_LCORNER, "white", "#808080") |
|
270 | stc.STC_MARK_BOXPLUS, "white", "#808080") | |
244 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDER |
|
271 | self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, \ | |
245 | self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_BOXMINUSCONNECTED, "white", "#808080") |
|
272 | stc.STC_MARK_VLINE, "white", "#808080") | |
246 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDER |
|
273 | self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, \ | |
|
274 | stc.STC_MARK_LCORNER, "white", "#808080") | |||
|
275 | self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, \ | |||
|
276 | stc.STC_MARK_BOXPLUSCONNECTED, "white", "#808080") | |||
|
277 | self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, \ | |||
|
278 | stc.STC_MARK_BOXMINUSCONNECTED, "white", "#808080") | |||
|
279 | self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, \ | |||
|
280 | stc.STC_MARK_TCORNER, "white", "#808080") | |||
247 |
|
281 | |||
248 |
|
282 | |||
249 | self.Bind(stc.EVT_STC_UPDATEUI, self.OnUpdateUI) |
|
283 | self.Bind(stc.EVT_STC_UPDATEUI, self.OnUpdateUI) | |
@@ -363,7 +397,7 b' class PythonSTC(stc.StyledTextCtrl):' | |||||
363 | if braceAtCaret < 0: |
|
397 | if braceAtCaret < 0: | |
364 | charAfter = self.GetCharAt(caretPos) |
|
398 | charAfter = self.GetCharAt(caretPos) | |
365 | styleAfter = self.GetStyleAt(caretPos) |
|
399 | styleAfter = self.GetStyleAt(caretPos) | |
366 |
|
400 | |||
367 | if charAfter and chr(charAfter) in "[]{}()" and styleAfter == stc.STC_P_OPERATOR: |
|
401 | if charAfter and chr(charAfter) in "[]{}()" and styleAfter == stc.STC_P_OPERATOR: | |
368 | braceAtCaret = caretPos |
|
402 | braceAtCaret = caretPos | |
369 |
|
403 |
@@ -633,8 +633,6 b' class IPShellWidget(wx.Panel):' | |||||
633 | self.setCurrentState('WAIT_END_OF_EXECUTION') |
|
633 | self.setCurrentState('WAIT_END_OF_EXECUTION') | |
634 |
|
634 | |||
635 | def evtStateExecuteDone(self,evt): |
|
635 | def evtStateExecuteDone(self,evt): | |
636 | if(self.text_ctrl.getCursorPos()!=0): |
|
|||
637 | self.text_ctrl.removeCurrentLine() |
|
|||
638 | self.doc = self.IP.get_doc_text() |
|
636 | self.doc = self.IP.get_doc_text() | |
639 | self.help = self.IP.get_help_text() |
|
637 | self.help = self.IP.get_help_text() | |
640 | if self.doc: |
|
638 | if self.doc: | |
@@ -648,6 +646,8 b' class IPShellWidget(wx.Panel):' | |||||
648 | self.setCurrentState('SHOW_DOC') |
|
646 | self.setCurrentState('SHOW_DOC') | |
649 | self.pager(self.help) |
|
647 | self.pager(self.help) | |
650 | else: |
|
648 | else: | |
|
649 | if(self.text_ctrl.getCursorPos()!=0): | |||
|
650 | self.text_ctrl.removeCurrentLine() | |||
651 | self.stateShowPrompt() |
|
651 | self.stateShowPrompt() | |
652 |
|
652 | |||
653 | def stateShowPrompt(self): |
|
653 | def stateShowPrompt(self): |
General Comments 0
You need to be logged in to leave comments.
Login now