Show More
@@ -26,7 +26,7 b' from IPython.html.widgets import (Widget, TextWidget,' | |||||
26 | ContainerWidget, DOMWidget) |
|
26 | ContainerWidget, DOMWidget) | |
27 | from IPython.display import display, clear_output |
|
27 | from IPython.display import display, clear_output | |
28 | from IPython.utils.py3compat import string_types, unicode_type |
|
28 | from IPython.utils.py3compat import string_types, unicode_type | |
29 |
from IPython.utils.traitlets import HasTraits, |
|
29 | from IPython.utils.traitlets import HasTraits, Any, Unicode | |
30 |
|
30 | |||
31 | empty = Parameter.empty |
|
31 | empty = Parameter.empty | |
32 |
|
32 | |||
@@ -116,13 +116,13 b' def _widget_from_abbrev(abbrev, default=empty):' | |||||
116 | return abbrev |
|
116 | return abbrev | |
117 |
|
117 | |||
118 | widget = _widget_abbrev(abbrev) |
|
118 | widget = _widget_abbrev(abbrev) | |
119 | if default is not empty and isinstance(abbrev, (list, tuple)): |
|
119 | if default is not empty and isinstance(abbrev, (list, tuple, dict)): | |
120 | # if it's not a single-value abbreviation, |
|
120 | # if it's not a single-value abbreviation, | |
121 | # set the initial value from the default |
|
121 | # set the initial value from the default | |
122 | try: |
|
122 | try: | |
123 | widget.value = default |
|
123 | widget.value = default | |
124 |
except |
|
124 | except Exception: | |
125 | # warn? |
|
125 | # ignore failure to set default | |
126 | pass |
|
126 | pass | |
127 | if widget is None: |
|
127 | if widget is None: | |
128 | raise ValueError("%r cannot be transformed to a Widget" % (abbrev,)) |
|
128 | raise ValueError("%r cannot be transformed to a Widget" % (abbrev,)) |
General Comments 0
You need to be logged in to leave comments.
Login now