Show More
@@ -25,17 +25,22 define(["notebook/js/widgets/widget"], function(WidgetManager){ | |||
|
25 | 25 | .appendTo(this.$el) |
|
26 | 26 | .addClass('widget-hlabel') |
|
27 | 27 | .hide(); |
|
28 | ||
|
28 | 29 | this.$slider = $('<div />') |
|
29 | 30 | .slider({}) |
|
30 | 31 | .addClass('slider'); |
|
31 | ||
|
32 | 32 | // Put the slider in a container |
|
33 | 33 | this.$slider_container = $('<div />') |
|
34 | 34 | .addClass('widget-hslider') |
|
35 |
.append(this.$slider) |
|
|
35 | .append(this.$slider) | |
|
36 | 36 | this.$el_to_style = this.$slider_container; // Set default element to style |
|
37 | 37 | this.$el.append(this.$slider_container); |
|
38 | 38 | |
|
39 | this.$readout = $('<div/>') | |
|
40 | .appendTo(this.$el) | |
|
41 | .addClass('widget-hlabel') | |
|
42 | .hide(); | |
|
43 | ||
|
39 | 44 | // Set defaults. |
|
40 | 45 | this.update(); |
|
41 | 46 | }, |
@@ -103,6 +108,13 define(["notebook/js/widgets/widget"], function(WidgetManager){ | |||
|
103 | 108 | this.$label.text(description); |
|
104 | 109 | this.$label.show(); |
|
105 | 110 | } |
|
111 | ||
|
112 | var readout = this.model.get('readout'); | |
|
113 | if (readout) { | |
|
114 | this.$readout.show(); | |
|
115 | } else { | |
|
116 | this.$readout.hide(); | |
|
117 | } | |
|
106 | 118 | } |
|
107 | 119 | return IntSliderView.__super__.update.apply(this); |
|
108 | 120 | }, |
@@ -117,7 +129,9 define(["notebook/js/widgets/widget"], function(WidgetManager){ | |||
|
117 | 129 | |
|
118 | 130 | // Calling model.set will trigger all of the other views of the |
|
119 | 131 | // model to update. |
|
120 |
|
|
|
132 | var actual_value = this._validate_slide_value(ui.value); | |
|
133 | this.model.set('value', actual_value, {updated_view: this}); | |
|
134 | this.$readout.text(actual_value); | |
|
121 | 135 | this.touch(); |
|
122 | 136 | }, |
|
123 | 137 |
@@ -53,6 +53,7 class FloatSliderWidget(_BoundedFloatWidget): | |||
|
53 | 53 | _view_name = Unicode('FloatSliderView', sync=True) |
|
54 | 54 | orientation = Enum([u'horizontal', u'vertical'], u'horizontal', |
|
55 | 55 | help="Vertical or horizontal.", sync=True) |
|
56 | readout = Bool(False, help="Display the current value of the slider next to it.", sync=True) | |
|
56 | 57 | |
|
57 | 58 | |
|
58 | 59 | class FloatProgressWidget(_BoundedFloatWidget): |
@@ -53,6 +53,7 class IntSliderWidget(_BoundedIntWidget): | |||
|
53 | 53 | _view_name = Unicode('IntSliderView', sync=True) |
|
54 | 54 | orientation = Enum([u'horizontal', u'vertical'], u'horizontal', |
|
55 | 55 | help="Vertical or horizontal.", sync=True) |
|
56 | readout = Bool(False, help="Display the current value of the slider next to it.", sync=True) | |
|
56 | 57 | |
|
57 | 58 | |
|
58 | 59 | class IntProgressWidget(_BoundedIntWidget): |
General Comments 0
You need to be logged in to leave comments.
Login now