Hi all, I'm forwarding this message to sage-support as well, because I could get no support on sage-notebook. I hope you don't consider this as spam, I would just like to hear some comments. Eventually I'll try on sage-devel :) Thanks
Maurizio ---------- Forwarded message ---------- From: Maurizio <maurizio.gran...@gmail.com> Date: 3 Ago, 19:26 Subject: Console and editor in the notebook To: sage-notebook Hi all, I'd like to kindly ask for some support. I'd like to try an experiment with the notebook. My aim is to create a new python function, something like: file_editor(filename) which would open a new browser windows (like a popup), which contains two main elements which are fixed in the html layout: 1) a file editor, containing the filename specified (let's say, a script named "my_script.sage") which is opened, or created if not existing, into the DATA folder of the worksheet; it provides syntax highlighting and (possibly) tab-completion 2) an interactive console, composed of a one-line input and some lines of output, like if it were a live sage session opened. it should also provide facilities like tab-completion. That console should be attached to the same SAGE session opened in the worksheet where the "file_editor" command has been called, so have the same globals, etc.. The problem is: I know how to open a popup, and I used the edit mode of the file attached to the notebook as a template for having a box with syntax highlighting using codemirror (so the necessary javascript library is already there). I don't know how to create a simil-console in the way I descripted it: I would like to keep it quite simple, so I don't know if it is possible to create something like a single-line cell, and how to send the input to the SAGE console and to get the result back. Moreover, I don't know how to reach the same SAGE session that is operating in the calling worksheet. Can you help me with this? I had a look at the notebook_lib.js file, but I am not sure which methods to focus on. Regarding the editor, where do I find the "save" methods already present in the notebook? Moreover, I'd like to have a couple of buttons with the editor (I know how to make a toolbar, by the way), which are: 1) save file (shortcut F5) 2) save file and run it (shortcut, maybe CTRL+F5) 3) run selected code in the console (shortcut F9) ... something similar to this Finally, I'm considering to also show the output of the console (or that of the script), as the output of the cell in the original worksheet. Thanks for any kind of support. If you can point me to something similar already existing, or to some specific documentation, I'll be happy. I already had a look athttp://www.sagemath.org/doc/reference/sagenb/simple/twist.html I'm wondering if there's some similar doc for existing javascript functions. Regards Maurizio -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org