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