<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi,</div><div><br></div><div><br></div><div>i'm used to have my "c.NotebookManager.notebook_dir" under version control, for now SVN … i should switch to GIT</div><div><br></div><div>i was playing with js in a custom.js file,  in order to add some "buttons"  to "COMMITT"  change to a notebook into my repository</div><div>(the plan was to add a custom toolbar to execute simple svn commands)</div><div><br></div><div>an example to store the results of svn info in a dict can be like :</div><div><br></div><div><br></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">               </span>IPython.toolbar.add_buttons_group([</div><div><span class="Apple-tab-span" style="white-space:pre">          </span>    {</div><div><span class="Apple-tab-span" style="white-space:pre">              </span>         'label'   : 'SVN Info',</div><div><span class="Apple-tab-span" style="white-space:pre">            </span>         'icon'    : 'ui-icon-info', </div><div><span class="Apple-tab-span" style="white-space:pre">             </span>         'callback': function(){IPython.notebook.kernel.execute('svninfolist = !svn info'),</div><div><span class="Apple-tab-span" style="white-space:pre">                              </span>                        IPython.notebook.kernel.execute('svninfo = {}'),</div><div><span class="Apple-tab-span" style="white-space:pre">                         </span>                        IPython.notebook.kernel.execute('for i in svninfolist[:-1]: j=i.split(":") ; svninfo[j[0]]=j[1].strip()')</div><div><span class="Apple-tab-span" style="white-space:pre">                                                                              </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">            </span>    }</div><div><span class="Apple-tab-span" style="white-space:pre">              </span>    ]);</div><div><br></div><div>this give me a dict like :</div><div><br></div><div><div class="input hbox" style="margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; display: -webkit-box; -webkit-box-orient: horizontal; -webkit-box-align: stretch; -webkit-box-flex: 0; page-break-inside: avoid; color: rgb(34, 34, 34); font-family: 'Lucinda Grande', 'Lucinda Sans Unicode', Helvetica, Arial, Verdana, sans-serif; line-height: 17px; "><div class="prompt input_prompt" style="margin: 0px; padding: 0.4em; border-width: 1px 0px 0px; border-top-style: solid; border-top-color: transparent; font-size: 14px; font: inherit; vertical-align: baseline; -webkit-box-flex: 0; width: 11ex; font-family: monospace; text-align: right; color: navy;">2]:</div><div class="input_area box-flex1" style="margin: 0px; padding: 0px; border: 1px solid rgb(221, 221, 221); font-size: 14px; font: inherit; vertical-align: baseline; -webkit-box-flex: 1; color: black; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(247, 247, 247); background-position: initial initial; background-repeat: initial initial;"><div class="CodeMirror" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; font: inherit; vertical-align: baseline; line-height: 1.231; font-family: monospace; position: relative; overflow: hidden;"><div style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; font: inherit; vertical-align: baseline; overflow: hidden; position: relative; width: 3px; height: 0px; top: 5.7166748046875px; left: 61.71666717529297px;"><textarea wrap="off" autocorrect="off" autocapitalize="off" style="font-size: 1em; font-family: 'Lucinda Grande', 'Lucinda Sans Unicode', Helvetica, Arial, Verdana, sans-serif; outline: none !important; position: absolute; padding: 0px; width: 1px; height: 1em; "></textarea></div><div class="CodeMirror-scroll cm-s-ipython" tabindex="-1" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; font: inherit; vertical-align: baseline; overflow-x: auto; overflow-y: hidden; height: auto; position: relative; outline: none;"><div style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; font: inherit; vertical-align: baseline; position: relative;"><div style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; font: inherit; vertical-align: baseline; position: relative; top: 0px;"><div class="CodeMirror-lines" style="margin: 0px; padding: 0.4em; border: 0px; font-size: 14px; font: inherit; vertical-align: baseline; white-space: pre; cursor: text;"><div style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; font: inherit; vertical-align: baseline; pointer-events: none; position: relative; z-index: 0; outline: none; min-width: 57px;"><div style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; font: inherit; vertical-align: baseline; pointer-events: none; position: absolute; width: 1177.6666259765625px; height: 0px; overflow: hidden; visibility: hidden;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; font-family: inherit; pointer-events: none; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; background-color: transparent; word-wrap: normal; line-height: inherit; color: inherit; "><span class="cm-variable" style="margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; pointer-events: none; "></span><span id="CodeMirror-temp-f775c4" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; font: inherit; vertical-align: baseline; pointer-events: none;"></span></pre></div><pre class="CodeMirror-cursor" style="margin-top: 0px; margin-bottom: 0px; padding: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 1px; border-right-style: none; border-left-style: solid; border-left-color: black; font: inherit; vertical-align: baseline; font-family: inherit; pointer-events: none; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; background-color: transparent; word-wrap: normal; line-height: inherit; color: inherit; z-index: 10; position: absolute; visibility: hidden; width: 0px; top: 0px; left: 56px; "></pre><pre class="CodeMirror-cursor" style="margin-top: 0px; margin-bottom: 0px; padding: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 1px; border-right-style: none; border-left-style: solid; border-left-color: black; font: inherit; vertical-align: baseline; font-family: inherit; pointer-events: none; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; background-color: transparent; word-wrap: normal; line-height: inherit; color: inherit; z-index: 10; position: absolute; visibility: hidden; width: 0px; left: 56px; "></pre><div style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; font: inherit; vertical-align: baseline; pointer-events: none;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; font-family: inherit; pointer-events: none; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; background-color: transparent; word-wrap: normal; line-height: inherit; color: inherit; "><span class="cm-variable" style="margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; pointer-events: none; ">svninfo</span></pre></div></div></div></div></div></div></div></div></div><div class="output_wrapper" style="margin: 5px 0px 0px 5px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; -webkit-box-flex: 0; width: 1272px; position: relative; color: rgb(34, 34, 34); font-family: 'Lucinda Grande', 'Lucinda Sans Unicode', Helvetica, Arial, Verdana, sans-serif; line-height: 17px; "><div class="out_prompt_overlay prompt" title="click to scroll output; double click to hide" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; font: inherit; vertical-align: baseline; width: 11ex; font-family: monospace; text-align: right; height: 182px; position: absolute; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"></div><div class="output vbox" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; font: inherit; vertical-align: baseline; display: -webkit-box; -webkit-box-orient: vertical; -webkit-box-align: stretch;"><div class="hbox output_area" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; font: inherit; vertical-align: baseline; display: -webkit-box; -webkit-box-orient: horizontal; -webkit-box-align: stretch; -webkit-box-flex: 0; page-break-inside: avoid;"><div class="prompt output_prompt" style="margin: 0px 5px 0px -5px; padding: 0.4em; border: 0px; font-size: 14px; font: inherit; vertical-align: baseline; -webkit-box-flex: 0; width: 11ex; font-family: monospace; text-align: right; color: rgb(139, 0, 0);">Out[2]:</div><div class="box-flex1 output_subarea output_text" style="margin: 0px; padding: 0.44em 0.4em 0.4em 1px; border: 0px; font-size: 14px; font: inherit; vertical-align: baseline; -webkit-box-flex: 1; text-align: left; color: black; font-family: monospace;"><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; font-family: monospace, sans-serif; white-space: pre-wrap; ">{'Last Changed Author': 'epifanio',
 'Last Changed Date': '2012-11-20 15:30:34 -0500 (Tue, 20 Nov 2012)',
 'Last Changed Rev': '7847',
 'Node Kind': 'directory',
 'Path': '.',
 'Repository Root': '<a target="_blank" href="https://myuser@myserver.org/svn" style="color: rgb(34, 34, 34);">https://myuser@myserver.org/svn</a>',
 'Repository UUID': 'e8c77636-c7aa-4457-b6c1-051e789c14f2',
 'Revision': '7877',
 'Schedule': 'normal',
 'URL': '<a target="_blank" href="https://myuser@myserver.org/svn/path/to/dir'" style="color: rgb(34, 34, 34); ">https://myuser@myserver.org/svn/path/to/dir'<br></a>'}</pre></div></div></div></div><div><br></div></div><div>while in order to "commit" changes, i was looking for something like :</div><div><br></div><div>- detect the name  for the "notebook" (filename.ipnb)</div><div><br></div><div>- clean all the output of the "notebook"</div><div><br></div><div>- save the "notebook"</div><div><br></div><div>- commit the saved file (here should prompt a js text input box where to add the commit notes, but i can live without it as a start)</div><div><br></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">               </span>IPython.toolbar.add_buttons_group([</div><div><span class="Apple-tab-span" style="white-space:pre">          </span>    {</div><div><span class="Apple-tab-span" style="white-space:pre">              </span>         'label'   : 'Save & Commit Notebook',</div><div><span class="Apple-tab-span" style="white-space:pre">          </span>         'icon'    : 'ui-icon-circle-arrow-n', </div><div><span class="Apple-tab-span" style="white-space:pre">           </span>         'callback': function(){IPython.notebook.kernel.execute('detect the notebook name'),</div><div><span class="Apple-tab-span" style="white-space:pre">                             </span>                        IPython.notebook.kernel.execute('clean notebook'),</div><div><span class="Apple-tab-span" style="white-space:pre">                                                       </span>IPython.notebook.kernel.execute('save notebook'),</div><div><span class="Apple-tab-span" style="white-space:pre">                                                    </span>IPython.notebook.kernel.execute('svn commit notebook')}</div><div><span class="Apple-tab-span" style="white-space:pre">              </span>    }</div><div><span class="Apple-tab-span" style="white-space:pre">              </span>    ]);</div><div><br></div><div><br></div><div>i need an help to learn how to use "IPython.notebook.kernel.execute" from inside a JS code</div><div>i was looking in `docs/examples/widgets/directview` but i got lost :(</div><div><br></div><div>have you any hints on how can i use the ipython.notebook.kernel  in order to :</div><div><br></div><div>- print out some text in a new notebook cell </div><div>- detect the name for the active notebook</div><div>- clear all the output for the active notebook</div><div><br></div><div><br></div><div>Thanks a lot for you help,</div><div><br></div><div>Massimo</div><div><br></div><div><br></div></body></html>