##// END OF EJS Templates
Put the whole history interface into kernelmanager.
Thomas Kluyver -
Show More
@@ -212,7 +212,7 b' class IPythonWidget(FrontendWidget):'
212 """ Reimplemented to make a history request.
212 """ Reimplemented to make a history request.
213 """
213 """
214 super(IPythonWidget, self)._started_channels()
214 super(IPythonWidget, self)._started_channels()
215 self.kernel_manager.xreq_channel.history_tail(1000)
215 self.kernel_manager.xreq_channel.history(hist_access_type='tail', n=1000)
216
216
217 #---------------------------------------------------------------------------
217 #---------------------------------------------------------------------------
218 # 'ConsoleWidget' public interface
218 # 'ConsoleWidget' public interface
@@ -282,23 +282,40 b' class XReqSocketChannel(ZmqSocketChannel):'
282 self._queue_request(msg)
282 self._queue_request(msg)
283 return msg['header']['msg_id']
283 return msg['header']['msg_id']
284
284
285 def history_tail(self, n=10, raw=True, output=False):
285 def history(self, raw=True, output=False, hist_access_type='range', **kwargs):
286 """Get the history list.
286 """Get entries from the history list.
287
287
288 Parameters
288 Parameters
289 ----------
289 ----------
290 n : int
291 The number of lines of history to get.
292 raw : bool
290 raw : bool
293 If True, return the raw input.
291 If True, return the raw input.
294 output : bool
292 output : bool
295 If True, then return the output as well.
293 If True, then return the output as well.
294 hist_access_type : str
295 'range' (fill in session, start and stop params), 'tail' (fill in n)
296 or 'search' (fill in pattern param).
297
298 session : int
299 For a range request, the session from which to get lines. Session
300 numbers are positive integers; negative ones count back from the
301 current session.
302 start : int
303 The first line number of a history range.
304 stop : int
305 The final (excluded) line number of a history range.
306
307 n : int
308 The number of lines of history to get for a tail request.
309
310 pattern : str
311 The glob-syntax pattern for a search request.
296
312
297 Returns
313 Returns
298 -------
314 -------
299 The msg_id of the message sent.
315 The msg_id of the message sent.
300 """
316 """
301 content = dict(n=n, raw=raw, output=output, hist_access_type='tail')
317 content = dict(raw=raw, output=output, hist_access_type=hist_access_type,
318 **kwargs)
302 msg = self.session.msg('history_request', content)
319 msg = self.session.msg('history_request', content)
303 self._queue_request(msg)
320 self._queue_request(msg)
304 return msg['header']['msg_id']
321 return msg['header']['msg_id']
General Comments 0
You need to be logged in to leave comments. Login now