##// END OF EJS Templates
fix to minrk suggestion
Matthias BUSSONNIER -
Show More
@@ -374,10 +374,8 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):'
374 """ Handles replies for code execution.
374 """ Handles replies for code execution.
375 """
375 """
376 self.log.debug("execute: %s", msg.get('content', ''))
376 self.log.debug("execute: %s", msg.get('content', ''))
377 info_list = self._request_info.get('execute')
378 msg_id = msg['parent_header']['msg_id']
377 msg_id = msg['parent_header']['msg_id']
379 if msg_id in info_list:
378 info = self._request_info['execute'].get(msg_id)
380 info = info_list[msg_id]
381 # unset reading flag, because if execute finished, raw_input can't
379 # unset reading flag, because if execute finished, raw_input can't
382 # still be pending.
380 # still be pending.
383 self._reading = False
381 self._reading = False
@@ -403,7 +401,7 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):'
403
401
404 self._show_interpreter_prompt_for_reply(msg)
402 self._show_interpreter_prompt_for_reply(msg)
405 self.executed.emit(msg)
403 self.executed.emit(msg)
406 info_list.pop(msg_id)
404 self._request_info['execute'].pop(msg_id)
407 elif info and info.kind == 'silent_exec_callback' and not self._hidden:
405 elif info and info.kind == 'silent_exec_callback' and not self._hidden:
408 self._handle_exec_callback(msg)
406 self._handle_exec_callback(msg)
409 else:
407 else:
@@ -216,15 +216,13 b' class HistoryConsoleWidget(ConsoleWidget):'
216 def _handle_execute_reply(self, msg):
216 def _handle_execute_reply(self, msg):
217 """ Handles replies for code execution, here only session history length
217 """ Handles replies for code execution, here only session history length
218 """
218 """
219 info_list = self._request_info.get('execute')
220 msg_id = msg['parent_header']['msg_id']
219 msg_id = msg['parent_header']['msg_id']
221 if msg_id in info_list:
220 info = self._request_info.get['execute'].pop(msg_id,None)
222 info = info_list.pop(msg_id)
221 if info and info.kind == 'save_magic' and not self._hidden:
223 if info.kind == 'save_magic' and not self._hidden:
222 content = msg['content']
224 content = msg['content']
223 status = content['status']
225 status = content['status']
224 if status == 'ok':
226 if status == 'ok':
225 self._max_session_history=(int(content['user_expressions']['hlen']))
227 self._max_session_history=(int(content['user_expressions']['hlen']))
228
226
229 def save_magic(self):
227 def save_magic(self):
230 # update the session history length
228 # update the session history length
@@ -165,16 +165,14 b' class IPythonWidget(FrontendWidget):'
165 def _handle_execute_reply(self, msg):
165 def _handle_execute_reply(self, msg):
166 """ Reimplemented to support prompt requests.
166 """ Reimplemented to support prompt requests.
167 """
167 """
168 info_list = self._request_info.get('execute')
168 msg_id = msg['parent_header'].get('msg_id')
169 msg_id = msg['parent_header']['msg_id']
169 info = self._request_info['execute'].get(msg_id)
170 if msg_id in info_list:
170 if info and info.kind == 'prompt':
171 info = info_list[msg_id]
171 number = msg['content']['execution_count'] + 1
172 if info.kind == 'prompt':
172 self._show_interpreter_prompt(number)
173 number = msg['content']['execution_count'] + 1
173 self._request_info['execute'].pop(msg_id)
174 self._show_interpreter_prompt(number)
174 else:
175 info_list.pop(msg_id)
175 super(IPythonWidget, self)._handle_execute_reply(msg)
176 else:
177 super(IPythonWidget, self)._handle_execute_reply(msg)
178
176
179 def _handle_history_reply(self, msg):
177 def _handle_history_reply(self, msg):
180 """ Implemented to handle history tail replies, which are only supported
178 """ Implemented to handle history tail replies, which are only supported
General Comments 0
You need to be logged in to leave comments. Login now