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: | |
115 | obj._repr_widget_(**kwargs) |
|
114 | format = InteractiveShell.instance().display_formatter.format | |
116 | else: |
|
115 | ||
117 | if raw: |
|
116 | for obj in objs: | |
118 | for obj in objs: |
|
117 | if hasattr(obj, '_repr_widget_'): | |
119 | publish_display_data('display', obj, metadata) |
|
118 | obj._repr_widget_(**kwargs) | |
120 | else: |
|
119 | else: | |
121 | format = InteractiveShell.instance().display_formatter.format |
|
120 | if raw: | |
122 | for obj in objs: |
|
121 | publish_display_data('display', obj, metadata) | |
|
122 | else: | |||
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,13 +241,16 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 | self.start_displayhook() |
|
244 | if hasattr(result, '_repr_widget_'): | |
245 | self.write_output_prompt() |
|
245 | result._repr_widget_() | |
246 | format_dict, md_dict = self.compute_format_data(result) |
|
246 | else: | |
247 | self.write_format_data(format_dict, md_dict) |
|
247 | self.start_displayhook() | |
248 | self.update_user_ns(result) |
|
248 | self.write_output_prompt() | |
249 | self.log_output(format_dict) |
|
249 | format_dict, md_dict = self.compute_format_data(result) | |
250 | self.finish_displayhook() |
|
250 | self.write_format_data(format_dict, md_dict) | |
|
251 | self.update_user_ns(result) | |||
|
252 | self.log_output(format_dict) | |||
|
253 | self.finish_displayhook() | |||
251 |
|
254 | |||
252 | def flush(self): |
|
255 | def flush(self): | |
253 | if not self.do_full_cache: |
|
256 | if not self.do_full_cache: |
General Comments 0
You need to be logged in to leave comments.
Login now