##// END OF EJS Templates
Added ability to title multicontainer pages before multicontainer display()
Jonathan Frederic -
Show More
@@ -14,10 +14,14 b' require(["notebook/js/widget"], function(){'
14 // Set tab titles
14 // Set tab titles
15 var titles = this.model.get('_titles');
15 var titles = this.model.get('_titles');
16 for (var page_index in titles) {
16 for (var page_index in titles) {
17 var accordian_toggle = this.containers[page_index]
17
18 .find('.accordion-heading')
18 var accordian = this.containers[page_index]
19 .find('.accordion-toggle');
19 if (accordian != undefined) {
20 accordian_toggle.html(titles[page_index]);
20 accordian
21 .find('.accordion-heading')
22 .find('.accordion-toggle')
23 .html(titles[page_index]);
24 }
21 }
25 }
22
26
23 return IPython.WidgetView.prototype.update.call(this);
27 return IPython.WidgetView.prototype.update.call(this);
@@ -49,6 +53,7 b' require(["notebook/js/widget"], function(){'
49 this.containers.push(accordion_group);
53 this.containers.push(accordion_group);
50
54
51 accordion_inner.append(view.$el);
55 accordion_inner.append(view.$el);
56 this.update();
52 },
57 },
53 });
58 });
54
59
@@ -160,21 +160,22 b' class Widget(LoggingConfigurable):'
160 key : unicode (optional)
160 key : unicode (optional)
161 A single property's name to sync with the frontend.
161 A single property's name to sync with the frontend.
162 """
162 """
163 state = {}
163 if self.comm is not None:
164
164 state = {}
165 # If a key is provided, just send the state of that key.
165
166 keys = []
166 # If a key is provided, just send the state of that key.
167 if key is None:
167 keys = []
168 keys.extend(self.keys)
168 if key is None:
169 else:
169 keys.extend(self.keys)
170 keys.append(key)
170 else:
171 for key in self.keys:
171 keys.append(key)
172 try:
172 for key in self.keys:
173 state[key] = getattr(self, key)
173 try:
174 except Exception as e:
174 state[key] = getattr(self, key)
175 pass # Eat errors, nom nom nom
175 except Exception as e:
176 self.comm.send({"method": "update",
176 pass # Eat errors, nom nom nom
177 "state": state})
177 self.comm.send({"method": "update",
178 "state": state})
178
179
179
180
180 def get_css(self, key, selector=""):
181 def get_css(self, key, selector=""):
General Comments 0
You need to be logged in to leave comments. Login now