Skip to content

Commit

Permalink
Merge pull request ipython#4787 from sn6uv/master
Browse files Browse the repository at this point in the history
Don't execute guiref code in qtconsole unless kernel is Python
  • Loading branch information
minrk committed Jan 13, 2014
2 parents 111a263 + 61b59a4 commit 7e38f59
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 7e38f59

Please sign in to comment.