##// END OF EJS Templates
Nice background color for already entered code....
Gael Varoquaux -
Show More
@@ -105,7 +105,7 class LineFrontEndBase(FrontEndBase):
105 105 raw_string in the history and starts a new prompt.
106 106 """
107 107 if raw_string is None:
108 raw_string = string
108 raw_string = python_string
109 109 # Create a false result, in case there is an exception
110 110 self.last_result = dict(number=self.prompt_number)
111 111 try:
@@ -53,8 +53,7 _DEFAULT_STYLE = {
53 53 'tripledouble': 'fore:#7F0000',
54 54 'class' : 'fore:#0000FF,bold,underline',
55 55 'def' : 'fore:#007F7F,bold',
56 'operator' : 'bold',
57
56 'operator' : 'bold'
58 57 }
59 58
60 59 # new style numbers
@@ -190,6 +189,7 class ConsoleWidget(editwindow.EditWindow):
190 189 self.StyleSetSpec(stc.STC_P_STRING, p['string'])
191 190 self.StyleSetSpec(stc.STC_P_CHARACTER, p['char'])
192 191 self.StyleSetSpec(stc.STC_P_WORD, p['keyword'])
192 self.StyleSetSpec(stc.STC_P_WORD2, p['keyword'])
193 193 self.StyleSetSpec(stc.STC_P_TRIPLE, p['triple'])
194 194 self.StyleSetSpec(stc.STC_P_TRIPLEDOUBLE, p['tripledouble'])
195 195 self.StyleSetSpec(stc.STC_P_CLASSNAME, p['class'])
@@ -23,10 +23,17 __docformat__ = "restructuredtext en"
23 23
24 24 import wx
25 25 import re
26 from wx import stc
26 27 from console_widget import ConsoleWidget
27 28
28 29 from IPython.frontend.prefilterfrontend import PrefilterFrontEnd
29 30
31 #_COMMAND_BG = '#FAFAF1' # Nice green
32 _RUNNING_BUFFER_BG = '#FDFFBE' # Nice yellow
33
34 _RUNNING_BUFFER_MARKER = 31
35
36
30 37 #-------------------------------------------------------------------------------
31 38 # Classes to implement the Wx frontend
32 39 #-------------------------------------------------------------------------------
@@ -50,6 +57,11 class IPythonWxController(PrefilterFrontEnd, ConsoleWidget):
50 57 # Capture Character keys
51 58 self.Bind(wx.EVT_KEY_DOWN, self._on_key_down)
52 59
60 # Marker for running buffer.
61 self.MarkerDefine(_RUNNING_BUFFER_MARKER, stc.STC_MARK_BACKGROUND,
62 background=_RUNNING_BUFFER_BG)
63
64
53 65
54 66 def do_completion(self, mode=None):
55 67 """ Do code completion.
@@ -57,6 +69,7 class IPythonWxController(PrefilterFrontEnd, ConsoleWidget):
57 69 """
58 70 line = self.get_current_edit_buffer()
59 71 completions = self.complete(line)
72 if len(completions)>0:
60 73 self.write_completion(completions, mode=mode)
61 74
62 75
@@ -71,9 +84,15 class IPythonWxController(PrefilterFrontEnd, ConsoleWidget):
71 84 self.AutoCompSetChooseSingle(choose_single)
72 85
73 86
74 def execute(self, *args, **kwargs):
87 def execute(self, python_string, raw_string=None):
75 88 self._cursor = wx.BusyCursor()
76 PrefilterFrontEnd.execute(self, *args, **kwargs)
89 if raw_string is None:
90 raw_string = python_string
91 end_line = self.current_prompt_line \
92 + max(1, len(raw_string.split('\n'))-1)
93 for i in range(self.current_prompt_line, end_line):
94 self.MarkerAdd(i, 31)
95 PrefilterFrontEnd.execute(self, python_string, raw_string=raw_string)
77 96
78 97
79 98 def after_execute(self):
@@ -133,7 +152,7 class IPythonWxController(PrefilterFrontEnd, ConsoleWidget):
133 152 if event.KeyCode == 59:
134 153 # Intercepting '.'
135 154 event.Skip()
136 self.do_completion(mode='popup')
155 #self.do_completion(mode='popup')
137 156 else:
138 157 ConsoleWidget._on_key_up(self, event, skip=skip)
139 158
General Comments 0
You need to be logged in to leave comments. Login now