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