Show More
@@ -24,7 +24,6 b' import struct' | |||||
24 |
|
24 | |||
25 | from IPython.utils.py3compat import (string_types, cast_bytes_py2, cast_unicode, |
|
25 | from IPython.utils.py3compat import (string_types, cast_bytes_py2, cast_unicode, | |
26 | unicode_type) |
|
26 | unicode_type) | |
27 | from IPython.html.widgets import Widget |
|
|||
28 |
|
27 | |||
29 | from .displaypub import publish_display_data |
|
28 | from .displaypub import publish_display_data | |
30 |
|
29 | |||
@@ -111,15 +110,16 b' def display(*objs, **kwargs):' | |||||
111 |
|
110 | |||
112 | from IPython.core.interactiveshell import InteractiveShell |
|
111 | from IPython.core.interactiveshell import InteractiveShell | |
113 |
|
112 | |||
114 | if isinstance(obj, Widget): |
|
113 | if not raw: | |
|
114 | format = InteractiveShell.instance().display_formatter.format | |||
|
115 | ||||
|
116 | for obj in objs: | |||
|
117 | if hasattr(obj, '_repr_widget_'): | |||
115 | obj._repr_widget_(**kwargs) |
|
118 | obj._repr_widget_(**kwargs) | |
116 | else: |
|
119 | else: | |
117 | if raw: |
|
120 | if raw: | |
118 | for obj in objs: |
|
|||
119 | publish_display_data('display', obj, metadata) |
|
121 | publish_display_data('display', obj, metadata) | |
120 | else: |
|
122 | else: | |
121 | format = InteractiveShell.instance().display_formatter.format |
|
|||
122 | for obj in objs: |
|
|||
123 | format_dict, md_dict = format(obj, include=include, exclude=exclude) |
|
123 | format_dict, md_dict = format(obj, include=include, exclude=exclude) | |
124 | if metadata: |
|
124 | if metadata: | |
125 | # kwarg-specified metadata gets precedence |
|
125 | # kwarg-specified metadata gets precedence |
@@ -241,6 +241,9 b' class DisplayHook(Configurable):' | |||||
241 | """ |
|
241 | """ | |
242 | self.check_for_underscore() |
|
242 | self.check_for_underscore() | |
243 | if result is not None and not self.quiet(): |
|
243 | if result is not None and not self.quiet(): | |
|
244 | if hasattr(result, '_repr_widget_'): | |||
|
245 | result._repr_widget_() | |||
|
246 | else: | |||
244 | self.start_displayhook() |
|
247 | self.start_displayhook() | |
245 | self.write_output_prompt() |
|
248 | self.write_output_prompt() | |
246 | format_dict, md_dict = self.compute_format_data(result) |
|
249 | format_dict, md_dict = self.compute_format_data(result) |
General Comments 0
You need to be logged in to leave comments.
Login now