Show More
@@ -25,17 +25,22 b' define(["notebook/js/widgets/widget"], function(WidgetManager){' | |||||
25 | .appendTo(this.$el) |
|
25 | .appendTo(this.$el) | |
26 | .addClass('widget-hlabel') |
|
26 | .addClass('widget-hlabel') | |
27 | .hide(); |
|
27 | .hide(); | |
|
28 | ||||
28 | this.$slider = $('<div />') |
|
29 | this.$slider = $('<div />') | |
29 | .slider({}) |
|
30 | .slider({}) | |
30 | .addClass('slider'); |
|
31 | .addClass('slider'); | |
31 |
|
||||
32 | // Put the slider in a container |
|
32 | // Put the slider in a container | |
33 | this.$slider_container = $('<div />') |
|
33 | this.$slider_container = $('<div />') | |
34 | .addClass('widget-hslider') |
|
34 | .addClass('widget-hslider') | |
35 |
.append(this.$slider) |
|
35 | .append(this.$slider) | |
36 | this.$el_to_style = this.$slider_container; // Set default element to style |
|
36 | this.$el_to_style = this.$slider_container; // Set default element to style | |
37 | this.$el.append(this.$slider_container); |
|
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 | // Set defaults. |
|
44 | // Set defaults. | |
40 | this.update(); |
|
45 | this.update(); | |
41 | }, |
|
46 | }, | |
@@ -103,6 +108,13 b' define(["notebook/js/widgets/widget"], function(WidgetManager){' | |||||
103 | this.$label.text(description); |
|
108 | this.$label.text(description); | |
104 | this.$label.show(); |
|
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 | return IntSliderView.__super__.update.apply(this); |
|
119 | return IntSliderView.__super__.update.apply(this); | |
108 | }, |
|
120 | }, | |
@@ -117,7 +129,9 b' define(["notebook/js/widgets/widget"], function(WidgetManager){' | |||||
117 |
|
129 | |||
118 | // Calling model.set will trigger all of the other views of the |
|
130 | // Calling model.set will trigger all of the other views of the | |
119 | // model to update. |
|
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 | this.touch(); |
|
135 | this.touch(); | |
122 | }, |
|
136 | }, | |
123 |
|
137 |
@@ -53,6 +53,7 b' class FloatSliderWidget(_BoundedFloatWidget):' | |||||
53 | _view_name = Unicode('FloatSliderView', sync=True) |
|
53 | _view_name = Unicode('FloatSliderView', sync=True) | |
54 | orientation = Enum([u'horizontal', u'vertical'], u'horizontal', |
|
54 | orientation = Enum([u'horizontal', u'vertical'], u'horizontal', | |
55 | help="Vertical or horizontal.", sync=True) |
|
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 | class FloatProgressWidget(_BoundedFloatWidget): |
|
59 | class FloatProgressWidget(_BoundedFloatWidget): |
@@ -53,6 +53,7 b' class IntSliderWidget(_BoundedIntWidget):' | |||||
53 | _view_name = Unicode('IntSliderView', sync=True) |
|
53 | _view_name = Unicode('IntSliderView', sync=True) | |
54 | orientation = Enum([u'horizontal', u'vertical'], u'horizontal', |
|
54 | orientation = Enum([u'horizontal', u'vertical'], u'horizontal', | |
55 | help="Vertical or horizontal.", sync=True) |
|
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 | class IntProgressWidget(_BoundedIntWidget): |
|
59 | class IntProgressWidget(_BoundedIntWidget): |
General Comments 0
You need to be logged in to leave comments.
Login now