From 54ccc1dbe494fcf45f287dc22f838fcfbcaad35b Mon Sep 17 00:00:00 2001 From: MinRK Date: Wed, 20 Nov 2013 16:45:12 -0800 Subject: [PATCH] store cell toolbar preset in notebook metadata allows resume on load --- IPython/html/static/notebook/js/celltoolbar.js | 2 +- IPython/html/static/notebook/js/maintoolbar.js | 2 ++ IPython/html/static/notebook/js/notebook.js | 9 ++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/IPython/html/static/notebook/js/celltoolbar.js b/IPython/html/static/notebook/js/celltoolbar.js index 9c43f0dd3..74186b1d4 100644 --- a/IPython/html/static/notebook/js/celltoolbar.js +++ b/IPython/html/static/notebook/js/celltoolbar.js @@ -214,7 +214,7 @@ var IPython = (function (IPython) { * * CellToolbar.activate_preset('foo.foo_preset1'); */ - CellToolbar.activate_preset= function(preset_name){ + CellToolbar.activate_preset = function(preset_name){ var preset = CellToolbar._presets[preset_name]; if(preset != undefined){ diff --git a/IPython/html/static/notebook/js/maintoolbar.js b/IPython/html/static/notebook/js/maintoolbar.js index b26622986..b17f04a9c 100644 --- a/IPython/html/static/notebook/js/maintoolbar.js +++ b/IPython/html/static/notebook/js/maintoolbar.js @@ -147,9 +147,11 @@ var IPython = (function (IPython) { var val = $(this).val() if (val =='') { IPython.CellToolbar.global_hide(); + delete IPython.notebook.metadata.celltoolbar; } else { IPython.CellToolbar.global_show(); IPython.CellToolbar.activate_preset(val); + IPython.notebook.metadata.celltoolbar = val; } }); // Setup the currently registered presets. diff --git a/IPython/html/static/notebook/js/notebook.js b/IPython/html/static/notebook/js/notebook.js index 67a27a7aa..5f53e1bd5 100644 --- a/IPython/html/static/notebook/js/notebook.js +++ b/IPython/html/static/notebook/js/notebook.js @@ -1958,7 +1958,14 @@ var IPython = (function (IPython) { this.start_session(); } // load our checkpoint list - IPython.notebook.list_checkpoints(); + this.list_checkpoints(); + + // load toolbar state + if (this.metadata.celltoolbar) { + IPython.CellToolbar.global_show(); + IPython.CellToolbar.activate_preset(this.metadata.celltoolbar); + } + $([IPython.events]).trigger('notebook_loaded.Notebook'); };