mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-21 04:10:17 +08:00
Added ability to title multicontainer pages before multicontainer display()
This commit is contained in:
parent
510c97679d
commit
6dd1bce589
@ -14,10 +14,14 @@ require(["notebook/js/widget"], function(){
|
|||||||
// Set tab titles
|
// Set tab titles
|
||||||
var titles = this.model.get('_titles');
|
var titles = this.model.get('_titles');
|
||||||
for (var page_index in titles) {
|
for (var page_index in titles) {
|
||||||
var accordian_toggle = this.containers[page_index]
|
|
||||||
.find('.accordion-heading')
|
var accordian = this.containers[page_index]
|
||||||
.find('.accordion-toggle');
|
if (accordian != undefined) {
|
||||||
accordian_toggle.html(titles[page_index]);
|
accordian
|
||||||
|
.find('.accordion-heading')
|
||||||
|
.find('.accordion-toggle')
|
||||||
|
.html(titles[page_index]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return IPython.WidgetView.prototype.update.call(this);
|
return IPython.WidgetView.prototype.update.call(this);
|
||||||
@ -49,6 +53,7 @@ require(["notebook/js/widget"], function(){
|
|||||||
this.containers.push(accordion_group);
|
this.containers.push(accordion_group);
|
||||||
|
|
||||||
accordion_inner.append(view.$el);
|
accordion_inner.append(view.$el);
|
||||||
|
this.update();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -160,21 +160,22 @@ class Widget(LoggingConfigurable):
|
|||||||
key : unicode (optional)
|
key : unicode (optional)
|
||||||
A single property's name to sync with the frontend.
|
A single property's name to sync with the frontend.
|
||||||
"""
|
"""
|
||||||
state = {}
|
if self.comm is not None:
|
||||||
|
state = {}
|
||||||
|
|
||||||
# If a key is provided, just send the state of that key.
|
# If a key is provided, just send the state of that key.
|
||||||
keys = []
|
keys = []
|
||||||
if key is None:
|
if key is None:
|
||||||
keys.extend(self.keys)
|
keys.extend(self.keys)
|
||||||
else:
|
else:
|
||||||
keys.append(key)
|
keys.append(key)
|
||||||
for key in self.keys:
|
for key in self.keys:
|
||||||
try:
|
try:
|
||||||
state[key] = getattr(self, key)
|
state[key] = getattr(self, key)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass # Eat errors, nom nom nom
|
pass # Eat errors, nom nom nom
|
||||||
self.comm.send({"method": "update",
|
self.comm.send({"method": "update",
|
||||||
"state": state})
|
"state": state})
|
||||||
|
|
||||||
|
|
||||||
def get_css(self, key, selector=""):
|
def get_css(self, key, selector=""):
|
||||||
|
Loading…
Reference in New Issue
Block a user