##// END OF EJS Templates
Add Math display support for qtconsole
Carlos Cordoba -
Show More
@@ -7,6 +7,7 b' import re'
7
7
8 from IPython.external.qt import QtCore, QtGui
8 from IPython.external.qt import QtCore, QtGui
9
9
10 from IPython.lib.latextools import latex_to_png
10 from IPython.utils.path import ensure_dir_exists
11 from IPython.utils.path import ensure_dir_exists
11 from IPython.utils.traitlets import Bool
12 from IPython.utils.traitlets import Bool
12 from IPython.qt.svg import save_svg, svg_to_clipboard, svg_to_image
13 from IPython.qt.svg import save_svg, svg_to_clipboard, svg_to_image
@@ -126,6 +127,18 b' class RichIPythonWidget(IPythonWidget):'
126 jpg = decodestring(data['image/jpeg'].encode('ascii'))
127 jpg = decodestring(data['image/jpeg'].encode('ascii'))
127 self._append_jpg(jpg, True, metadata=metadata.get('image/jpeg', None))
128 self._append_jpg(jpg, True, metadata=metadata.get('image/jpeg', None))
128 self._append_html(self.output_sep2, True)
129 self._append_html(self.output_sep2, True)
130 elif 'text/latex' in data:
131 self._pre_image_append(msg, prompt_number)
132 latex = data['text/latex'].encode('ascii')
133 # latex_to_png takes care of handling $
134 latex = latex.strip('$')
135 png = latex_to_png(latex, wrap=True)
136 if png is not None:
137 self._append_png(png, True)
138 self._append_html(self.output_sep2, True)
139 else:
140 # Print plain text if png can't be generated
141 return super(RichIPythonWidget, self)._handle_execute_result(msg)
129 else:
142 else:
130 # Default back to the plain text representation.
143 # Default back to the plain text representation.
131 return super(RichIPythonWidget, self)._handle_execute_result(msg)
144 return super(RichIPythonWidget, self)._handle_execute_result(msg)
General Comments 0
You need to be logged in to leave comments. Login now