Show More
@@ -43,7 +43,7 define([ | |||
|
43 | 43 | if (options === undefined || options.updated_view != this) { |
|
44 | 44 | // JQuery slider option keys. These keys happen to have a |
|
45 | 45 | // one-to-one mapping with the corrosponding keys of the model. |
|
46 |
var jquery_slider_keys = ['step', 'max', 'min', 'disabled' |
|
|
46 | var jquery_slider_keys = ['step', 'max', 'min', 'disabled']; | |
|
47 | 47 | var that = this; |
|
48 | 48 | that.$slider.slider({}); |
|
49 | 49 | _.each(jquery_slider_keys, function(key, i) { |
@@ -52,6 +52,10 define([ | |||
|
52 | 52 | that.$slider.slider("option", key, model_value); |
|
53 | 53 | } |
|
54 | 54 | }); |
|
55 | var range_value = this.model.get("_range"); | |
|
56 | if (range_value !== undefined) { | |
|
57 | this.$slider.slider("option", "range", range_value); | |
|
58 | } | |
|
55 | 59 | |
|
56 | 60 | // WORKAROUND FOR JQUERY SLIDER BUG. |
|
57 | 61 | // The horizontal position of the slider handle |
@@ -64,14 +68,14 define([ | |||
|
64 | 68 | var orientation = this.model.get('orientation'); |
|
65 | 69 | var min = this.model.get('min'); |
|
66 | 70 | var max = this.model.get('max'); |
|
67 | if (this.model.get('range')) { | |
|
71 | if (this.model.get('_range')) { | |
|
68 | 72 | this.$slider.slider('option', 'values', [min, min]); |
|
69 | 73 | } else { |
|
70 | 74 | this.$slider.slider('option', 'value', min); |
|
71 | 75 | } |
|
72 | 76 | this.$slider.slider('option', 'orientation', orientation); |
|
73 | 77 | var value = this.model.get('value'); |
|
74 | if (this.model.get('range')) { | |
|
78 | if (this.model.get('_range')) { | |
|
75 | 79 | // values for the range case are validated python-side in |
|
76 | 80 | // _Bounded{Int,Float}RangeWidget._validate |
|
77 | 81 | this.$slider.slider('option', 'values', value); |
@@ -151,7 +155,7 define([ | |||
|
151 | 155 | |
|
152 | 156 | // Calling model.set will trigger all of the other views of the |
|
153 | 157 | // model to update. |
|
154 | if (this.model.get("range")) { | |
|
158 | if (this.model.get("_range")) { | |
|
155 | 159 | var actual_value = ui.values.map(this._validate_slide_value); |
|
156 | 160 | this.$readout.text(actual_value.join("-")); |
|
157 | 161 | } else { |
@@ -55,7 +55,7 class FloatSlider(_BoundedFloat): | |||
|
55 | 55 | _view_name = Unicode('FloatSliderView', sync=True) |
|
56 | 56 | orientation = Enum([u'horizontal', u'vertical'], u'horizontal', |
|
57 | 57 | help="Vertical or horizontal.", sync=True) |
|
58 | range = Bool(False, help="Display a range selector", sync=True) | |
|
58 | _range = Bool(False, help="Display a range selector", sync=True) | |
|
59 | 59 | readout = Bool(True, help="Display the current value of the slider next to it.", sync=True) |
|
60 | 60 | |
|
61 | 61 | |
@@ -161,7 +161,7 class FloatRangeSlider(_BoundedFloatRange): | |||
|
161 | 161 | _view_name = Unicode('FloatSliderView', sync=True) |
|
162 | 162 | orientation = Enum([u'horizontal', u'vertical'], u'horizontal', |
|
163 | 163 | help="Vertical or horizontal.", sync=True) |
|
164 | range = Bool(True, help="Display a range selector", sync=True) | |
|
164 | _range = Bool(True, help="Display a range selector", sync=True) | |
|
165 | 165 | readout = Bool(True, help="Display the current value of the slider next to it.", sync=True) |
|
166 | 166 | |
|
167 | 167 | # Remove in IPython 4.0 |
@@ -60,7 +60,7 class IntSlider(_BoundedInt): | |||
|
60 | 60 | _view_name = Unicode('IntSliderView', sync=True) |
|
61 | 61 | orientation = Enum([u'horizontal', u'vertical'], u'horizontal', |
|
62 | 62 | help="Vertical or horizontal.", sync=True) |
|
63 | range = Bool(False, help="Display a range selector", sync=True) | |
|
63 | _range = Bool(False, help="Display a range selector", sync=True) | |
|
64 | 64 | readout = Bool(True, help="Display the current value of the slider next to it.", sync=True) |
|
65 | 65 | |
|
66 | 66 | |
@@ -165,7 +165,7 class IntRangeSlider(_BoundedIntRange): | |||
|
165 | 165 | _view_name = Unicode('IntSliderView', sync=True) |
|
166 | 166 | orientation = Enum([u'horizontal', u'vertical'], u'horizontal', |
|
167 | 167 | help="Vertical or horizontal.", sync=True) |
|
168 | range = Bool(True, help="Display a range selector", sync=True) | |
|
168 | _range = Bool(True, help="Display a range selector", sync=True) | |
|
169 | 169 | readout = Bool(True, help="Display the current value of the slider next to it.", sync=True) |
|
170 | 170 | |
|
171 | 171 | # Remove in IPython 4.0 |
General Comments 0
You need to be logged in to leave comments.
Login now