Skip to content

Commit

Permalink
only load %guiref in qtconsole with python kernels - fixes ipython#4787
Browse files Browse the repository at this point in the history
  • Loading branch information
sn6uv committed Jan 13, 2014
1 parent eefb5f8 commit 61b59a4
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion IPython/qt/console/ipython_widget.py
Expand Up @@ -135,6 +135,8 @@ def __init__(self, *args, **kw):
else:
self.set_default_style()

self._guiref_loaded = False

#---------------------------------------------------------------------------
# 'BaseFrontendMixin' abstract interface
#---------------------------------------------------------------------------
Expand Down Expand Up @@ -258,10 +260,21 @@ def _handle_display_data(self, msg):
# This newline seems to be needed for text and html output.
self._append_plain_text(u'\n', True)

def _handle_kernel_info_reply(self, rep):
""" Handle kernel info replies.
"""
if not self._guiref_loaded:
if rep['content']['language'] == 'python':
self._load_guiref_magic()
self._guiref_loaded = True

def _started_channels(self):
"""Reimplemented to make a history request and load %guiref."""
super(IPythonWidget, self)._started_channels()
self._load_guiref_magic()

# The reply will trigger %guiref load provided language=='python'
self.kernel_client.kernel_info()

self.kernel_client.shell_channel.history(hist_access_type='tail',
n=1000)

Expand Down

0 comments on commit 61b59a4

Please sign in to comment.