Show More
@@ -60,28 +60,27 b' class RichIPythonWidget(IPythonWidget):' | |||||
60 | """ Reimplemented to handle matplotlib plot payloads. |
|
60 | """ Reimplemented to handle matplotlib plot payloads. | |
61 | """ |
|
61 | """ | |
62 | payload = msg['content']['payload'] |
|
62 | payload = msg['content']['payload'] | |
63 |
|
|
63 | for item in payload: | |
64 |
f |
|
64 | if item['type'] == 'plot': | |
65 |
if item['t |
|
65 | if item['format'] == 'svg': | |
66 |
|
|
66 | svg = item['data'] | |
67 |
|
|
67 | try: | |
68 |
|
|
68 | image = svg_to_image(svg) | |
69 | image = svg_to_image(svg) |
|
69 | except ValueError: | |
70 | except ValueError: |
|
70 | self._append_plain_text('Received invalid plot data.') | |
71 | self._append_plain_text('Received invalid plot data.') |
|
|||
72 | else: |
|
|||
73 | format = self._add_image(image) |
|
|||
74 | format.setProperty(self._svg_text_format_property, svg) |
|
|||
75 | cursor = self._get_end_cursor() |
|
|||
76 | cursor.insertBlock() |
|
|||
77 | cursor.insertImage(format) |
|
|||
78 | cursor.insertBlock() |
|
|||
79 | else: |
|
71 | else: | |
80 |
|
|
72 | format = self._add_image(image) | |
81 | pass |
|
73 | format.setProperty(self._svg_text_format_property, svg) | |
|
74 | cursor = self._get_end_cursor() | |||
|
75 | cursor.insertBlock() | |||
|
76 | cursor.insertImage(format) | |||
|
77 | cursor.insertBlock() | |||
82 | else: |
|
78 | else: | |
83 |
# Add other p |
|
79 | # Add other plot formats here! | |
84 | pass |
|
80 | pass | |
|
81 | else: | |||
|
82 | # Add other payload types here! | |||
|
83 | pass | |||
85 | else: |
|
84 | else: | |
86 | super(RichIPythonWidget, self)._process_execute_ok(msg) |
|
85 | super(RichIPythonWidget, self)._process_execute_ok(msg) | |
87 |
|
86 |
General Comments 0
You need to be logged in to leave comments.
Login now