Show More
@@ -325,6 +325,7 b' define([' | |||
|
325 | 325 | .html(item_html) |
|
326 | 326 | .appendTo(that.$buttongroup) |
|
327 | 327 | .attr('data-value', encodeURIComponent(item)) |
|
328 | .attr('data-toggle', 'tooltip') | |
|
328 | 329 | .attr('value', item) |
|
329 | 330 | .on('click', $.proxy(that.handle_click, that)); |
|
330 | 331 | that.update_style_traits($item_element); |
@@ -334,7 +335,8 b' define([' | |||
|
334 | 335 | } else { |
|
335 | 336 | $item_element.removeClass('active'); |
|
336 | 337 | } |
|
337 |
$item_element.prop('disabled', disabled); |
|
|
338 | $item_element.prop('disabled', disabled); | |
|
339 | $item_element.attr('title', that.model.get('tooltips')[index]); | |
|
338 | 340 | }); |
|
339 | 341 | |
|
340 | 342 | // Remove items that no longer exist. |
@@ -19,7 +19,7 b' from threading import Lock' | |||
|
19 | 19 | |
|
20 | 20 | from .widget import DOMWidget, register |
|
21 | 21 | from IPython.utils.traitlets import ( |
|
22 | Unicode, Bool, Any, Dict, TraitError, CaselessStrEnum, Tuple | |
|
22 | Unicode, Bool, Any, Dict, TraitError, CaselessStrEnum, Tuple, List | |
|
23 | 23 | ) |
|
24 | 24 | from IPython.utils.py3compat import unicode_type |
|
25 | 25 | from IPython.utils.warn import DeprecatedClass |
@@ -32,6 +32,12 b' class _Selection(DOMWidget):' | |||
|
32 | 32 | |
|
33 | 33 | ``options`` can be specified as a list or dict. If given as a list, |
|
34 | 34 | it will be transformed to a dict of the form ``{str(value):value}``. |
|
35 | ||
|
36 | When programmatically setting the value, a reverse lookup is performed | |
|
37 | among the options to set the value of ``selected_label`` accordingly. The | |
|
38 | reverse lookup uses the equality operator by default, but an other | |
|
39 | predicate may be provided via the ``equals`` argument. For example, when | |
|
40 | dealing with numpy arrays, one may set equals=np.array_equal. | |
|
35 | 41 | """ |
|
36 | 42 | |
|
37 | 43 | value = Any(help="Selected value") |
@@ -194,6 +200,7 b' class ToggleButtons(_Selection):' | |||
|
194 | 200 | """Group of toggle buttons that represent an enumeration. Only one toggle |
|
195 | 201 | button can be toggled at any point in time.""" |
|
196 | 202 | _view_name = Unicode('ToggleButtonsView', sync=True) |
|
203 | tooltips = List(Unicode(), sync=True) | |
|
197 | 204 | |
|
198 | 205 | button_style = CaselessStrEnum( |
|
199 | 206 | values=['primary', 'success', 'info', 'warning', 'danger', ''], |
General Comments 0
You need to be logged in to leave comments.
Login now