##// END OF EJS Templates
highlight input from other front ends...
MinRK -
Show More
@@ -219,16 +219,24 b' class IPythonWidget(FrontendWidget):'
219 items.append(cell)
219 items.append(cell)
220 last_cell = cell
220 last_cell = cell
221 self._set_history(items)
221 self._set_history(items)
222
222
223 def _insert_other_input(self, cursor, content):
224 """Insert function for input from other frontends"""
225 cursor.beginEditBlock()
226 start = cursor.position()
227 n = content.get('execution_count', 0)
228 cursor.insertText('\n')
229 self._insert_html(cursor, self._make_in_prompt(n))
230 cursor.insertText(content['code'])
231 self._highlighter.rehighlightBlock(cursor.block())
232 cursor.endEditBlock()
233
223 def _handle_execute_input(self, msg):
234 def _handle_execute_input(self, msg):
224 """Handle an execute_input message"""
235 """Handle an execute_input message"""
225 self.log.debug("execute_input: %s", msg.get('content', ''))
236 self.log.debug("execute_input: %s", msg.get('content', ''))
226 if self.include_output(msg):
237 if self.include_output(msg):
227 content = msg['content']
238 self._append_custom(self._insert_other_input, msg['content'], before_prompt=True)
228 prompt_number = content.get('execution_count', 0)
239
229 self._append_html(self._make_in_prompt(prompt_number), True)
230 self._append_plain_text(content['code'], True)
231
232
240
233 def _handle_execute_result(self, msg):
241 def _handle_execute_result(self, msg):
234 """ Reimplemented for IPython-style "display hook".
242 """ Reimplemented for IPython-style "display hook".
General Comments 0
You need to be logged in to leave comments. Login now