##// END OF EJS Templates
Added display hook logic to handle widgets
Jonathan Frederic -
Show More
@@ -24,6 +24,7 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
27 28
28 29 from .displaypub import publish_display_data
29 30
@@ -110,17 +111,20 b' def display(*objs, **kwargs):'
110 111
111 112 from IPython.core.interactiveshell import InteractiveShell
112 113
113 if raw:
114 for obj in objs:
115 publish_display_data('display', obj, metadata)
114 if isinstance(obj, Widget):
115 obj._repr_widget_(**kwargs)
116 116 else:
117 format = InteractiveShell.instance().display_formatter.format
118 for obj in objs:
119 format_dict, md_dict = format(obj, include=include, exclude=exclude)
120 if metadata:
121 # kwarg-specified metadata gets precedence
122 _merge(md_dict, metadata)
123 publish_display_data('display', format_dict, md_dict)
117 if raw:
118 for obj in objs:
119 publish_display_data('display', obj, metadata)
120 else:
121 format = InteractiveShell.instance().display_formatter.format
122 for obj in objs:
123 format_dict, md_dict = format(obj, include=include, exclude=exclude)
124 if metadata:
125 # kwarg-specified metadata gets precedence
126 _merge(md_dict, metadata)
127 publish_display_data('display', format_dict, md_dict)
124 128
125 129
126 130 def display_pretty(*objs, **kwargs):
General Comments 0
You need to be logged in to leave comments. Login now