##// END OF EJS Templates
Merge pull request #1449 from icmurray/master...
Thomas Kluyver -
r6867:b4a3ed44 merge
parent child Browse files
Show More
@@ -29,6 +29,11 b' class RichIPythonWidget(IPythonWidget):'
29 # RichIPythonWidget protected class variables.
29 # RichIPythonWidget protected class variables.
30 _payload_source_plot = 'IPython.zmq.pylab.backend_payload.add_plot_payload'
30 _payload_source_plot = 'IPython.zmq.pylab.backend_payload.add_plot_payload'
31 _jpg_supported = Bool(False)
31 _jpg_supported = Bool(False)
32
33 # Used to determine whether a given html export attempt has already
34 # displayed a warning about being unable to convert a png to svg.
35 _svg_warning_displayed = False
36
32 #---------------------------------------------------------------------------
37 #---------------------------------------------------------------------------
33 # 'object' interface
38 # 'object' interface
34 #---------------------------------------------------------------------------
39 #---------------------------------------------------------------------------
@@ -53,6 +58,20 b' class RichIPythonWidget(IPythonWidget):'
53
58
54
59
55 #---------------------------------------------------------------------------
60 #---------------------------------------------------------------------------
61 # 'ConsoleWidget' public interface overides
62 #---------------------------------------------------------------------------
63
64 def export_html(self):
65 """ Shows a dialog to export HTML/XML in various formats.
66
67 Overridden in order to reset the _svg_warning_displayed flag prior
68 to the export running.
69 """
70 self._svg_warning_displayed = False
71 super(RichIPythonWidget, self).export_html()
72
73
74 #---------------------------------------------------------------------------
56 # 'ConsoleWidget' protected interface
75 # 'ConsoleWidget' protected interface
57 #---------------------------------------------------------------------------
76 #---------------------------------------------------------------------------
58
77
@@ -231,7 +250,18 b' class RichIPythonWidget(IPythonWidget):'
231 try:
250 try:
232 svg = str(self._name_to_svg_map[match.group("name")])
251 svg = str(self._name_to_svg_map[match.group("name")])
233 except KeyError:
252 except KeyError:
234 return "<b>Couldn't find image %s</b>" % match.group("name")
253 if not self._svg_warning_displayed:
254 QtGui.QMessageBox.warning(self, 'Error converting PNG to SVG.',
255 'Cannot convert a PNG to SVG. To fix this, add this '
256 'to your ipython config:\n\n'
257 '\tc.InlineBackendConfig.figure_format = \'svg\'\n\n'
258 'And regenerate the figures.',
259 QtGui.QMessageBox.Ok)
260 self._svg_warning_displayed = True
261 return ("<b>Cannot convert a PNG to SVG.</b> "
262 "To fix this, add this to your config: "
263 "<span>c.InlineBackendConfig.figure_format = 'svg'</span> "
264 "and regenerate the figures.")
235
265
236 # Not currently checking path, because it's tricky to find a
266 # Not currently checking path, because it's tricky to find a
237 # cross-browser way to embed external SVG images (e.g., via
267 # cross-browser way to embed external SVG images (e.g., via
General Comments 0
You need to be logged in to leave comments. Login now