Merge pull request #6605 from SylvainCorlay/tooltip

Adding a tooltip in IPython buttons
This commit is contained in:
Min RK 2014-10-03 09:48:15 -07:00
commit ed43a196b4
2 changed files with 4 additions and 2 deletions

View File

@ -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 {

View File

@ -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(