##// END OF EJS Templates
change set_preset to activate_preset...
Matthias BUSSONNIER -
Show More
@@ -46,7 +46,7 b' var IPython = (function (IPython) {'
46 $('body').removeClass('celltoolbar-on')
46 $('body').removeClass('celltoolbar-on')
47 } else {
47 } else {
48 $('body').addClass('celltoolbar-on')
48 $('body').addClass('celltoolbar-on')
49 CellToolbar.set_preset(val)
49 CellToolbar.activate_preset(val)
50 }
50 }
51 })
51 })
52
52
@@ -57,6 +57,8 b' var IPython = (function (IPython) {'
57 * we need to think of wether or not we allow nested namespace
57 * we need to think of wether or not we allow nested namespace
58 * @property _callback_dict
58 * @property _callback_dict
59 * @private
59 * @private
60 * @static
61 * @type Dict
60 */
62 */
61 CellToolbar._callback_dict = {};
63 CellToolbar._callback_dict = {};
62
64
@@ -65,17 +67,19 b' var IPython = (function (IPython) {'
65 * to add to the toolbar of each cell
67 * to add to the toolbar of each cell
66 * @property _ui_controls_list
68 * @property _ui_controls_list
67 * @private
69 * @private
70 * @static
71 * @type List
68 */
72 */
69 CellToolbar._ui_controls_list = [];
73 CellToolbar._ui_controls_list = [];
70
74
71 /**
75 /**
72 * keep a list of all instances to
76 * Class variable that should contains the CellToolbar instances for each
73 * be able to llop over them...
77 * cell of the notebook
74 * but how to 'destroy' them ?
78 *
75 * have to think about it...
76 * or loop over the cells, and find their CellToolbar instances.
77 * @private
79 * @private
78 * @property _instances
80 * @property _instances
81 * @static
82 * @type List
79 */
83 */
80 CellToolbar._instances =[]
84 CellToolbar._instances =[]
81
85
@@ -83,6 +87,8 b' var IPython = (function (IPython) {'
83 * keep a list of all the availlabel presets for the toolbar
87 * keep a list of all the availlabel presets for the toolbar
84 * @private
88 * @private
85 * @property _presets
89 * @property _presets
90 * @static
91 * @type Dict
86 */
92 */
87 CellToolbar._presets ={}
93 CellToolbar._presets ={}
88
94
@@ -98,7 +104,7 b' var IPython = (function (IPython) {'
98 * The callback will receive the following element :
104 * The callback will receive the following element :
99 *
105 *
100 * * a div in which to add element.
106 * * a div in which to add element.
101 * * the cell it is responsable from
107 * * the cell it is responsible from
102 *
108 *
103 * @example
109 * @example
104 *
110 *
@@ -129,7 +135,7 b' var IPython = (function (IPython) {'
129 * CellToolbar.register_callback('foo', toggle);
135 * CellToolbar.register_callback('foo', toggle);
130 */
136 */
131 CellToolbar.register_callback = function(name, callback){
137 CellToolbar.register_callback = function(name, callback){
132 // what do we do if name already exist ?
138 // Overwrite if it already exists.
133 CellToolbar._callback_dict[name] = callback;
139 CellToolbar._callback_dict[name] = callback;
134 };
140 };
135
141
@@ -161,17 +167,20 b' var IPython = (function (IPython) {'
161 )
167 )
162 }
168 }
163 /**
169 /**
164 * set an UI preset from `register_preset`
170 * Activate an UI preset from `register_preset`
165 * @method set_preset
171 *
172 * This does not update the selection UI.
173 *
174 * @method activate_preset
166 * @param preset_name {String} string corresponding to the preset name
175 * @param preset_name {String} string corresponding to the preset name
167 *
176 *
168 * @static
177 * @static
169 * @private
178 * @private
170 * @example
179 * @example
171 *
180 *
172 * CellToolbar.set_preset('foo.foo_preset1');
181 * CellToolbar.activate_preset('foo.foo_preset1');
173 */
182 */
174 CellToolbar.set_preset= function(preset_name){
183 CellToolbar.activate_preset= function(preset_name){
175 var preset = CellToolbar._presets[preset_name];
184 var preset = CellToolbar._presets[preset_name];
176
185
177 if(preset != undefined){
186 if(preset != undefined){
General Comments 0
You need to be logged in to leave comments. Login now