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