Show More
@@ -105,7 +105,7 b' class LineFrontEndBase(FrontEndBase):' | |||||
105 | raw_string in the history and starts a new prompt. |
|
105 | raw_string in the history and starts a new prompt. | |
106 | """ |
|
106 | """ | |
107 | if raw_string is None: |
|
107 | if raw_string is None: | |
108 | raw_string = string |
|
108 | raw_string = python_string | |
109 | # Create a false result, in case there is an exception |
|
109 | # Create a false result, in case there is an exception | |
110 | self.last_result = dict(number=self.prompt_number) |
|
110 | self.last_result = dict(number=self.prompt_number) | |
111 | try: |
|
111 | try: |
@@ -44,17 +44,16 b' _DEFAULT_STYLE = {' | |||||
44 | 'bracebad' : 'fore:#000000,back:#FF0000,bold', |
|
44 | 'bracebad' : 'fore:#000000,back:#FF0000,bold', | |
45 |
|
45 | |||
46 | # properties for the various Python lexer styles |
|
46 | # properties for the various Python lexer styles | |
47 | 'comment' : 'fore:#007F00', |
|
47 | 'comment' : 'fore:#007F00', | |
48 | 'number' : 'fore:#007F7F', |
|
48 | 'number' : 'fore:#007F7F', | |
49 | 'string' : 'fore:#7F007F,italic', |
|
49 | 'string' : 'fore:#7F007F,italic', | |
50 | 'char' : 'fore:#7F007F,italic', |
|
50 | 'char' : 'fore:#7F007F,italic', | |
51 | 'keyword' : 'fore:#00007F,bold', |
|
51 | 'keyword' : 'fore:#00007F,bold', | |
52 | 'triple' : 'fore:#7F0000', |
|
52 | 'triple' : 'fore:#7F0000', | |
53 | 'tripledouble': 'fore:#7F0000', |
|
53 | 'tripledouble' : 'fore:#7F0000', | |
54 | 'class' : 'fore:#0000FF,bold,underline', |
|
54 | 'class' : 'fore:#0000FF,bold,underline', | |
55 | 'def' : 'fore:#007F7F,bold', |
|
55 | 'def' : 'fore:#007F7F,bold', | |
56 |
'operator' : 'bold' |
|
56 | 'operator' : 'bold' | |
57 |
|
||||
58 | } |
|
57 | } | |
59 |
|
58 | |||
60 | # new style numbers |
|
59 | # new style numbers | |
@@ -190,6 +189,7 b' class ConsoleWidget(editwindow.EditWindow):' | |||||
190 | self.StyleSetSpec(stc.STC_P_STRING, p['string']) |
|
189 | self.StyleSetSpec(stc.STC_P_STRING, p['string']) | |
191 | self.StyleSetSpec(stc.STC_P_CHARACTER, p['char']) |
|
190 | self.StyleSetSpec(stc.STC_P_CHARACTER, p['char']) | |
192 | self.StyleSetSpec(stc.STC_P_WORD, p['keyword']) |
|
191 | self.StyleSetSpec(stc.STC_P_WORD, p['keyword']) | |
|
192 | self.StyleSetSpec(stc.STC_P_WORD2, p['keyword']) | |||
193 | self.StyleSetSpec(stc.STC_P_TRIPLE, p['triple']) |
|
193 | self.StyleSetSpec(stc.STC_P_TRIPLE, p['triple']) | |
194 | self.StyleSetSpec(stc.STC_P_TRIPLEDOUBLE, p['tripledouble']) |
|
194 | self.StyleSetSpec(stc.STC_P_TRIPLEDOUBLE, p['tripledouble']) | |
195 | self.StyleSetSpec(stc.STC_P_CLASSNAME, p['class']) |
|
195 | self.StyleSetSpec(stc.STC_P_CLASSNAME, p['class']) |
@@ -23,10 +23,17 b' __docformat__ = "restructuredtext en"' | |||||
23 |
|
23 | |||
24 | import wx |
|
24 | import wx | |
25 | import re |
|
25 | import re | |
|
26 | from wx import stc | |||
26 | from console_widget import ConsoleWidget |
|
27 | from console_widget import ConsoleWidget | |
27 |
|
28 | |||
28 | from IPython.frontend.prefilterfrontend import PrefilterFrontEnd |
|
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 | # Classes to implement the Wx frontend |
|
38 | # Classes to implement the Wx frontend | |
32 | #------------------------------------------------------------------------------- |
|
39 | #------------------------------------------------------------------------------- | |
@@ -50,6 +57,11 b' class IPythonWxController(PrefilterFrontEnd, ConsoleWidget):' | |||||
50 | # Capture Character keys |
|
57 | # Capture Character keys | |
51 | self.Bind(wx.EVT_KEY_DOWN, self._on_key_down) |
|
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 | def do_completion(self, mode=None): |
|
66 | def do_completion(self, mode=None): | |
55 | """ Do code completion. |
|
67 | """ Do code completion. | |
@@ -57,7 +69,8 b' class IPythonWxController(PrefilterFrontEnd, ConsoleWidget):' | |||||
57 | """ |
|
69 | """ | |
58 | line = self.get_current_edit_buffer() |
|
70 | line = self.get_current_edit_buffer() | |
59 | completions = self.complete(line) |
|
71 | completions = self.complete(line) | |
60 |
|
|
72 | if len(completions)>0: | |
|
73 | self.write_completion(completions, mode=mode) | |||
61 |
|
74 | |||
62 |
|
75 | |||
63 | def update_completion(self): |
|
76 | def update_completion(self): | |
@@ -71,11 +84,17 b' class IPythonWxController(PrefilterFrontEnd, ConsoleWidget):' | |||||
71 | self.AutoCompSetChooseSingle(choose_single) |
|
84 | self.AutoCompSetChooseSingle(choose_single) | |
72 |
|
85 | |||
73 |
|
86 | |||
74 |
def execute(self, |
|
87 | def execute(self, python_string, raw_string=None): | |
75 | self._cursor = wx.BusyCursor() |
|
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) | |||
|
96 | ||||
77 |
|
97 | |||
78 |
|
||||
79 | def after_execute(self): |
|
98 | def after_execute(self): | |
80 | PrefilterFrontEnd.after_execute(self) |
|
99 | PrefilterFrontEnd.after_execute(self) | |
81 | if hasattr(self, '_cursor'): |
|
100 | if hasattr(self, '_cursor'): | |
@@ -133,7 +152,7 b' class IPythonWxController(PrefilterFrontEnd, ConsoleWidget):' | |||||
133 | if event.KeyCode == 59: |
|
152 | if event.KeyCode == 59: | |
134 | # Intercepting '.' |
|
153 | # Intercepting '.' | |
135 | event.Skip() |
|
154 | event.Skip() | |
136 | self.do_completion(mode='popup') |
|
155 | #self.do_completion(mode='popup') | |
137 | else: |
|
156 | else: | |
138 | ConsoleWidget._on_key_up(self, event, skip=skip) |
|
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