##// END OF EJS Templates
enable dropdown preset change
Matthias BUSSONNIER -
Show More
@@ -17,6 +17,9 b' var IPython = (function (IPython) {'
17 17 this.construct();
18 18 this.add_drop_down_list();
19 19 this.bind_events();
20 $(this.selector)
21 .append($('<label/>').text('MetaUI'))
22 .append(IPython.MetaUI.dropdown_preset_selector)
20 23 };
21 24
22 25 MainToolBar.prototype = new IPython.ToolBar();
@@ -115,18 +118,6 b' var IPython = (function (IPython) {'
115 118 }
116 119 }
117 120 ],'run_int');
118
119 this.add_buttons_group([
120 {
121 id : 'show_meta',
122 label : 'Show Per Cell Toolbar',
123 icon : 'ui-icon-image',
124 callback : function () {
125 $('body').toggleClass('editmetaon');
126 }
127 }
128 ],'meta_on');
129
130 121 };
131 122
132 123 MainToolBar.prototype.add_drop_down_list = function () {
@@ -35,6 +35,22 b' var IPython = (function (IPython) {'
35 35 return this;
36 36 };
37 37
38 MetaUI.dropdown_preset_selector = $('<select/>')
39 .attr('id','metaui_selector')
40 .append($('<option/>').attr('value','').text('-'))
41
42 MetaUI.dropdown_preset_selector.change(function(){
43 var val = MetaUI.dropdown_preset_selector.val()
44 if(val ==''){
45 $('body').removeClass('editmetaon')
46 } else {
47 $('body').addClass('editmetaon')
48 MetaUI.set_preset(val)
49 }
50 })
51
52
53
38 54 /**
39 55 * Class variable that should contain a dict of all availlable callback
40 56 * we need to think of wether or not we allow nested namespace
@@ -139,6 +155,9 b' var IPython = (function (IPython) {'
139 155 */
140 156 MetaUI.register_preset = function(name, preset_list){
141 157 MetaUI._presets[name] = preset_list
158 MetaUI.dropdown_preset_selector.append(
159 $('<option/>').attr('value',name).text(name)
160 )
142 161 }
143 162 /**
144 163 * set an UI preset from `register_preset`
@@ -160,6 +179,7 b' var IPython = (function (IPython) {'
160 179 }
161 180 }
162 181
182
163 183 // this is by design not a prototype.
164 184 /**
165 185 * This should be called on the class and not on a instance as it will trigger
General Comments 0
You need to be logged in to leave comments. Login now