adding a tooltip in IPython buttons

pull/37/head
Sylvain Corlay 11 years ago
parent 0d9db64180
commit 8a384cd489

@ -12,7 +12,7 @@ define([
// Called when view is rendered.
this.setElement($("<button />")
.addClass('btn btn-default'));
this.$el.attr("data-toggle", "tooltip");
this.model.on('change:button_style', function(model, value) {
this.update_button_style();
}, this);
@ -27,6 +27,7 @@ define([
// Called when the model is changed. The model may have been
// changed by another view or by a state update from the back-end.
var description = this.model.get('description');
this.$el.attr("title", this.model.get("tooltip"));
if (description.length === 0) {
this.$el.html("&nbsp;"); // Preserve button height
} else {

@ -29,7 +29,8 @@ class Button(DOMWidget):
_view_name = Unicode('ButtonView', sync=True)
# Keys
description = Unicode('', help="Description of the button (label).", sync=True)
description = Unicode('', help="Button label.", sync=True)
tooltip = Unicode(help="Tooltip caption of the button.", sync=True)
disabled = Bool(False, help="Enable or disable user changes.", sync=True)
button_style = CaselessStrEnum(

Loading…
Cancel
Save