Show More
@@ -29,6 +29,9 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. | |||
32 | _svg_warning_displayed = False |
|
35 | _svg_warning_displayed = False | |
33 |
|
36 | |||
34 | #--------------------------------------------------------------------------- |
|
37 | #--------------------------------------------------------------------------- | |
@@ -61,7 +64,8 b' class RichIPythonWidget(IPythonWidget):' | |||||
61 | def export_html(self): |
|
64 | def export_html(self): | |
62 | """ Shows a dialog to export HTML/XML in various formats. |
|
65 | """ Shows a dialog to export HTML/XML in various formats. | |
63 |
|
66 | |||
64 |
Overridden in order to reset the _svg_warning_displayed flag |
|
67 | Overridden in order to reset the _svg_warning_displayed flag prior | |
|
68 | to the export running. | |||
65 | """ |
|
69 | """ | |
66 | self._svg_warning_displayed = False |
|
70 | self._svg_warning_displayed = False | |
67 | super(RichIPythonWidget, self).export_html() |
|
71 | super(RichIPythonWidget, self).export_html() | |
@@ -248,12 +252,16 b' class RichIPythonWidget(IPythonWidget):' | |||||
248 | except KeyError: |
|
252 | except KeyError: | |
249 | if not self._svg_warning_displayed: |
|
253 | if not self._svg_warning_displayed: | |
250 | QtGui.QMessageBox.warning(self, 'Error converting PNG to SVG.', |
|
254 | QtGui.QMessageBox.warning(self, 'Error converting PNG to SVG.', | |
251 |
'Cannot convert a PNG to SVG. To fix this, add this |
|
255 | 'Cannot convert a PNG to SVG. To fix this, add this ' | |
|
256 | 'to your ipython config:\n\n' | |||
252 | '\tc.InlineBackendConfig.figure_format = \'svg\'\n\n' |
|
257 | '\tc.InlineBackendConfig.figure_format = \'svg\'\n\n' | |
253 | 'And regenerate the figures.', |
|
258 | 'And regenerate the figures.', | |
254 | QtGui.QMessageBox.Ok) |
|
259 | QtGui.QMessageBox.Ok) | |
255 | self._svg_warning_displayed = True |
|
260 | self._svg_warning_displayed = True | |
256 | return "<b>Cannot convert a PNG to SVG. </b>To fix this, add this to your config: <span>c.InlineBackendConfig.figure_format = 'svg'</span> and regenerate the figures." |
|
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.") | |||
257 |
|
265 | |||
258 | # Not currently checking path, because it's tricky to find a |
|
266 | # Not currently checking path, because it's tricky to find a | |
259 | # 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