Show More
@@ -219,16 +219,24 b' class IPythonWidget(FrontendWidget):' | |||
|
219 | 219 | items.append(cell) |
|
220 | 220 | last_cell = cell |
|
221 | 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 | 234 | def _handle_execute_input(self, msg): |
|
224 | 235 | """Handle an execute_input message""" |
|
225 | 236 | self.log.debug("execute_input: %s", msg.get('content', '')) |
|
226 | 237 | if self.include_output(msg): |
|
227 | content = msg['content'] | |
|
228 | prompt_number = content.get('execution_count', 0) | |
|
229 | self._append_html(self._make_in_prompt(prompt_number), True) | |
|
230 | self._append_plain_text(content['code'], True) | |
|
231 | ||
|
238 | self._append_custom(self._insert_other_input, msg['content'], before_prompt=True) | |
|
239 | ||
|
232 | 240 | |
|
233 | 241 | def _handle_execute_result(self, msg): |
|
234 | 242 | """ Reimplemented for IPython-style "display hook". |
General Comments 0
You need to be logged in to leave comments.
Login now