##// END OF EJS Templates
Backport PR #5822: Don't overwrite widget description in interact...
MinRK -
Show More
@@ -166,6 +166,7 b' def _widgets_from_abbreviations(seq):'
166 166 result = []
167 167 for name, abbrev, default in seq:
168 168 widget = _widget_from_abbrev(abbrev, default)
169 if not widget.description:
169 170 widget.description = name
170 171 result.append(widget)
171 172 return result
@@ -463,3 +463,20 b' def test_fixed():'
463 463 description='b',
464 464 )
465 465
466 def test_default_description():
467 c = interactive(f, b='text')
468 w = c.children[0]
469 check_widget(w,
470 cls=widgets.TextWidget,
471 value='text',
472 description='b',
473 )
474
475 def test_custom_description():
476 c = interactive(f, b=widgets.TextWidget(value='text', description='foo'))
477 w = c.children[0]
478 check_widget(w,
479 cls=widgets.TextWidget,
480 value='text',
481 description='foo',
482 )
@@ -1,7 +1,7 b''
1 1 {
2 2 "metadata": {
3 3 "name": "",
4 "signature": "sha256:d75ab1c53fa3389eeac78ecf8e89beb52871950f296aad25776699b6d6125037"
4 "signature": "sha256:3f30c6e839ac39f890da34a2af6bf50bf0d99ea32f7aadc043f3e31f619e4bc9"
5 5 },
6 6 "nbformat": 3,
7 7 "nbformat_minor": 0,
@@ -87,7 +87,7 b''
87 87 "metadata": {},
88 88 "output_type": "display_data",
89 89 "text": [
90 "<IPython.core.display.HTML at 0x10efc0d50>"
90 "<IPython.core.display.HTML object>"
91 91 ]
92 92 }
93 93 ],
@@ -110,7 +110,7 b''
110 110 " z=True,\n",
111 111 " Text=u'Type here!',\n",
112 112 " #Algorithm=['This','That','Other'],\n",
113 " a=widgets.FloatSliderWidget(min=-10.0, max=10.0, step=0.1, value=5.0)\n",
113 " a=widgets.FloatSliderWidget(min=-10.0, max=10.0, step=0.1, value=5.0, description=\"Float (a)\")\n",
114 114 " )"
115 115 ],
116 116 "language": "python",
@@ -122,14 +122,14 b''
122 122 "<tr><td>Current</td><td>4.99</td></tr>\n",
123 123 "<tr><td>Text</td><td>Type here!</td></tr>\n",
124 124 "<tr><td>z</td><td>True</td></tr>\n",
125 "<tr><td>a</td><td>5.0</td></tr>\n",
126 125 "<tr><td>Temp</td><td>5</td></tr>\n",
126 "<tr><td>Float (a)</td><td>5.0</td></tr>\n",
127 127 "</table>"
128 128 ],
129 129 "metadata": {},
130 130 "output_type": "display_data",
131 131 "text": [
132 "<IPython.core.display.HTML at 0x10efcca10>"
132 "<IPython.core.display.HTML object>"
133 133 ]
134 134 }
135 135 ],
@@ -150,14 +150,14 b''
150 150 "<tr><td>Current</td><td>4.99</td></tr>\n",
151 151 "<tr><td>Text</td><td>Type here!</td></tr>\n",
152 152 "<tr><td>z</td><td>True</td></tr>\n",
153 "<tr><td>a</td><td>5.0</td></tr>\n",
154 153 "<tr><td>Temp</td><td>5</td></tr>\n",
154 "<tr><td>Float (a)</td><td>5.0</td></tr>\n",
155 155 "</table>"
156 156 ],
157 157 "metadata": {},
158 158 "output_type": "display_data",
159 159 "text": [
160 "<IPython.core.display.HTML at 0x10f027050>"
160 "<IPython.core.display.HTML object>"
161 161 ]
162 162 }
163 163 ],
General Comments 0
You need to be logged in to leave comments. Login now