##// END OF EJS Templates
load %guiref magic on kernel start
MinRK -
Show More
@@ -255,11 +255,27 b' class IPythonWidget(FrontendWidget):'
255 self._append_plain_text(u'\n', True)
255 self._append_plain_text(u'\n', True)
256
256
257 def _started_channels(self):
257 def _started_channels(self):
258 """ Reimplemented to make a history request.
258 """Reimplemented to make a history request and load %guiref."""
259 """
260 super(IPythonWidget, self)._started_channels()
259 super(IPythonWidget, self)._started_channels()
260 self._load_guiref_magic()
261 self.kernel_manager.shell_channel.history(hist_access_type='tail',
261 self.kernel_manager.shell_channel.history(hist_access_type='tail',
262 n=1000)
262 n=1000)
263
264 def _started_kernel(self):
265 """Load %guiref when the kernel starts (if channels are also started).
266
267 Principally triggered by kernel restart.
268 """
269 if self.kernel_manager.shell_channel is not None:
270 self._load_guiref_magic()
271
272 def _load_guiref_magic(self):
273 """Load %guiref magic."""
274 self.kernel_manager.shell_channel.execute('\n'.join([
275 "from IPython.core import usage",
276 "get_ipython().register_magic_function(usage.page_guiref, 'line', 'guiref')",
277 ]), silent=True)
278
263 #---------------------------------------------------------------------------
279 #---------------------------------------------------------------------------
264 # 'ConsoleWidget' public interface
280 # 'ConsoleWidget' public interface
265 #---------------------------------------------------------------------------
281 #---------------------------------------------------------------------------
General Comments 0
You need to be logged in to leave comments. Login now