##// END OF EJS Templates
Calltips are now working.
Gael Varoquaux -
Show More
@@ -289,16 +289,15 b' class ConsoleWidget(editwindow.EditWindow):'
289 289 self.new_prompt(self.prompt % (self.last_result['number'] + 1))
290 290 self.replace_current_edit_buffer(current_buffer)
291 291 else:
292 #possibilities.sort() # Python sorts are case sensitive
293 292 self.AutoCompSetIgnoreCase(False)
294 293 self.AutoCompSetAutoHide(False)
295 #let compute the length ot text)last word
296 splitter = [' ', '(', '[', '{']
297 last_word = self.get_current_edit_buffer()
298 for breaker in splitter:
299 last_word = last_word.split(breaker)[-1]
294 # compute the length ot the last word
295 separators = [' ', '(', '[', '{', '\n', '\t', '.']
296 symbol = self.get_current_edit_buffer()
297 for separator in separators:
298 symbol = symbol.split(separator)[-1]
300 299 self.AutoCompSetMaxHeight(len(possibilities))
301 self.AutoCompShow(len(last_word), " ".join(possibilities))
300 self.AutoCompShow(len(symbol), " ".join(possibilities))
302 301
303 302
304 303 def scroll_to_bottom(self):
@@ -25,11 +25,12 b' import wx'
25 25 import re
26 26 from wx import stc
27 27 from console_widget import ConsoleWidget
28 import __builtin__
28 29
29 30 from IPython.frontend.prefilterfrontend import PrefilterFrontEnd
30 31
31 32 #_COMMAND_BG = '#FAFAF1' # Nice green
32 _RUNNING_BUFFER_BG = '#FDFFBE' # Nice yellow
33 _RUNNING_BUFFER_BG = '#FDFFD3' # Nice yellow
33 34
34 35 _RUNNING_BUFFER_MARKER = 31
35 36
@@ -73,6 +74,25 b' class IPythonWxController(PrefilterFrontEnd, ConsoleWidget):'
73 74 self.write_completion(completions, mode=mode)
74 75
75 76
77 def do_calltip(self):
78 # compute the length ot the last word
79 separators = [' ', '(', '[', '{', '\n', '\t']
80 symbol = self.get_current_edit_buffer()
81 for separator in separators:
82 symbol_string = symbol.split(separator)[-1]
83 base_symbol_string = symbol_string.split('.')[0]
84 if base_symbol_string in self.shell.user_ns:
85 symbol = self.shell.user_ns[base_symbol_string]
86 elif base_symbol_string in self.shell.user_global_ns:
87 symbol = self.shell.user_global_ns[base_symbol_string]
88 elif base_symbol_string in __builtin__.__dict__:
89 symbol = __builtin__.__dict__[base_symbol_string]
90 else:
91 return False
92 for name in base_symbol_string.split('.')[1:] + ['__doc__']:
93 symbol = getattr(symbol, name)
94 self.CallTipShow(self.GetCurrentPos(), symbol)
95
76 96 def update_completion(self):
77 97 line = self.get_current_edit_buffer()
78 98 if self.AutoCompActive() and not line[-1] == '.':
@@ -144,6 +164,9 b' class IPythonWxController(PrefilterFrontEnd, ConsoleWidget):'
144 164 self.do_completion(mode='text')
145 165 else:
146 166 event.Skip()
167 elif event.KeyCode == ord('('):
168 event.Skip()
169 self.do_calltip()
147 170 else:
148 171 ConsoleWidget._on_key_down(self, event, skip=skip)
149 172
General Comments 0
You need to be logged in to leave comments. Login now