Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
oschuett committed Nov 9, 2017
1 parent 350652f commit be1c1cd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 40 deletions.
14 changes: 0 additions & 14 deletions appmode/appmode_bottom.css
@@ -1,18 +1,4 @@
/* hide extraneous cell parts when in appmode */

/* .appmode .container .cell .output_stderr */
/* .appmode .container .cell .output_error */

/*
This warning will be gone in future version. For the time being we have to hide .output_stderr
https://github.com/jupyter-widgets/ipywidgets/blob/c3e13ec8f2f0f3f7c7ba166ae8bc39be312bfc30/ipywidgets/widgets/widget.py#L564
This is because of a 3s timeout:
https://github.com/jupyter-widgets/ipywidgets/blob/abe3ee87de634df9bdb821c73f618d33efb51a6d/jupyter-js-widgets/src/manager-base.ts#L263
... which is probably cause by the run_all_cells, which blocks the kernel too long
Possible solution is to run cells more slowly e.g. with 100ms time inbetween delays.
*/

.cell > .input,
.celltoolbar,
.container .cell .prompt,
Expand Down
27 changes: 1 addition & 26 deletions appmode/static/main.js
@@ -1,5 +1,3 @@
// toggle display of all code cells' inputs

define([
'jquery',
'base/js/namespace',
Expand All @@ -19,8 +17,6 @@ define([

//==========================================================================
var appmode_unload_handler = function (e) {
console.log("Appmode: running unload handler");

var nb = Jupyter.notebook;
var url_parts = [nb.base_url, 'apps', nb.notebook_path];
var url = utils.url_path_join.apply(null, url_parts);
Expand All @@ -31,7 +27,6 @@ define([

//==========================================================================
function goto_app_mode() {
console.log("Appmode: going to app mode.");
// kill Jupyter session
Jupyter.notebook.session.delete();

Expand All @@ -55,8 +50,6 @@ define([

//==========================================================================
function goto_normal_mode() {
console.log("Appmode: going to normal mode.");

// build new URL
var url = new URL(window.location.href);
var base_url = Jupyter.notebook.base_url;
Expand All @@ -70,32 +63,20 @@ define([

//==========================================================================
function kernel_inject_url(kernel) {
console.log("Appmode: injecting url into new kernel");
kernel.execute("jupyter_notebook_url = '" + window.location + "'");
}

//==========================================================================
function initialize_step1() {
console.log("Appmode: initialize_step1");

if (Jupyter.notebook && Jupyter.notebook._fully_loaded) {
console.log("Appmode: notebook already loaded.");
initialize_step2();
}else{
console.log("Appmode: waiting for notebook to load.");
events.one('notebook_loaded.Notebook', initialize_step2);
}
}

//==========================================================================
function initialize_step2() {
console.log("Appmode: initialize_step2");
var nb = Jupyter.notebook

//console.log("Appmode: nb.kernel:"+nb.kernel);
//if(nb.kernel)
// console.log("Appmode: nb.kernel.info_reply:"+nb.kernel.info_reply.status);

// scroll to last position if in normal mode
var base_url = Jupyter.notebook.base_url;
if(window.location.pathname.startsWith(base_url+"notebooks/")){
Expand All @@ -105,19 +86,16 @@ define([
$('#site').scrollTop(m[1]);
}

var nb = Jupyter.notebook;
if(nb.kernel && nb.kernel.info_reply.status) {
console.log("Appmode: kernel already ready.");
initialize_step3();
}else{
console.log("Appmode: waiting for kernel_ready event.");
events.one('kernel_ready.Kernel', initialize_step3);
}
}

//==========================================================================
function initialize_step3() {
console.log("Appmode: initialize_step3");

kernel_inject_url(Jupyter.notebook.kernel);

// run kernel_inject_url() again when a new kernel is created
Expand All @@ -134,9 +112,6 @@ define([

//==========================================================================
function initialize_step4() {
console.log("Appmode: initialize_step4");
//console.log("Appmode info_reply.status: "+Jupyter.notebook.kernel.info_reply.status);

// disable autosave
Jupyter.notebook.set_autosave_interval(0);

Expand Down

0 comments on commit be1c1cd

Please sign in to comment.