# HG changeset patch
# User William Stein <wstein@gmail.com>
# Date 1218683055 25200
# Node ID f92bfd1c9ab223cd2fb1f908e728ea28cd196e4b
# Parent bb9049584f0cfd09fdc2ac2afef28dd1ab37258c
trac #3844 -- notebook -- worksheet should call sys.path.append(DATA) when being initalized
diff -r bb9049584f0c -r f92bfd1c9ab2 sage/server/notebook/css.py
|
a
|
b
|
|
| 1421 | 1421 | background-color: white; |
| 1422 | 1422 | padding: 3px; |
| 1423 | 1423 | overflow:auto; |
| 1424 | | /* width: 100%; */ |
| | 1424 | width: 98%; |
| 1425 | 1425 | margin-top: 0.5em; |
| 1426 | 1426 | } |
| 1427 | 1427 | |
| … |
… |
|
| 1693 | 1693 | blockquote,q { |
| 1694 | 1694 | quotes:"" "" |
| 1695 | 1695 | } |
| 1696 | | """ |
| 1697 | | No newline at end of file |
| | 1696 | """ |
diff -r bb9049584f0c -r f92bfd1c9ab2 sage/server/notebook/notebook.py
|
a
|
b
|
|
| 1748 | 1748 | elif ext in ['.txt', '.tex', '.sage', '.spyx', '.py', '.f', '.f90', '.c']: |
| 1749 | 1749 | body += '<form method="post" action="savedatafile" enctype="multipart/form-data">' |
| 1750 | 1750 | body += '<input type="submit" value="Save Changes" name="button_save"> <input type="submit" value="Cancel" name="button_cancel"><br>' |
| 1751 | | body += '<textarea class="edit" name="textfield" rows=17 cols=70 id="textfield">%s</textarea>'%open('%s/%s'%(ws.data_directory(), filename)).read() |
| | 1751 | body += '<textarea class="edit" name="textfield" rows=17 cols=90 id="textfield">%s</textarea>'%open('%s/%s'%(ws.data_directory(), filename)).read() |
| 1752 | 1752 | body += '<input type="hidden" name="filename" value="%s" id="filename">'%filename |
| 1753 | 1753 | body += '</form>' |
| 1754 | 1754 | |
diff -r bb9049584f0c -r f92bfd1c9ab2 sage/server/notebook/tutorial.py
|
a
|
b
|
|
| 379 | 379 | ('Input Rules', "Code is evaluated by exec'ing (after preparsing). Only the output of the last line of the cell is implicitly printed. If any line starts with \"sage:\" or \">>>\" the entire block is assumed to contain text and examples, so only lines that begin with a prompt are executed. Thus you can paste in complete examples from the docs without any editing, and you can write input cells that contains non-evaluated plain text mixed with examples by starting the block with \">>>\" or including an example."), |
| 380 | 380 | ('Working Directory', 'Each block of code is run from its own directory. If any images are created as a side effect, they will automatically be displayed.'), |
| 381 | 381 | ('DIR variable', 'The variable DIR contains the directory from which you started the SAGE notebook. For example, to open a file in that directory, do "open(DIR+\'filename\')".'), |
| 382 | | ('DATA variable', 'The variable DATA contains the directory with data files that you upload into the worksheet. For example, to open a file in that directory, do "open(DATA+\'filename\')".'), |
| | 382 | ('Data...', 'Use the Data menu to upload images and other files, and create new files that can be shared between worksheets. The DATA variable contains the path to the data files. For example, to open a file in that directory, do "open(DATA+\'filename\')". If foo.sage is a Sage file that you uploaded, type "load foo.sage"; if foo.py is a Python, you can import it by typing "import foo".'), |
| 383 | 383 | ('Split and join cells', 'Press ctrl-; in a cell to split it into two cells, and ctrl-backspace to join them. Press ctrl-enter to split a cell and evaluate both pieces.'), |
| 384 | 384 | # ('Emacs Keybindings', 'If you are using GNU/Linux, you can change (or create) a <tt>.gtkrc-2.0</tt> file. Add the line <tt>gtk-key-theme-name = "Emacs"</tt> to it. See <a target="_blank" href="http://kb.mozillazine.org/Emacs_Keybindings_(Firefox)">this page</a> [mozillazine.org] for more details.'), |
| 385 | 385 | # ('More Help', 'Type "help(sage.server.notebook.notebook)" for a detailed discussion of the architecture of the SAGE notebook and a tutorial (or see the SAGE reference manual).'), |
diff -r bb9049584f0c -r f92bfd1c9ab2 sage/server/notebook/worksheet.py
|
a
|
b
|
|
| 2398 | 2398 | S = self.sage() |
| 2399 | 2399 | try: |
| 2400 | 2400 | cmd = '__DIR__="%s/"; DIR=__DIR__; DATA="%s/"; '%(self.DIR(), os.path.abspath(self.data_directory())) |
| | 2401 | cmd += 'sys.path.append(DATA); ' |
| 2401 | 2402 | cmd += '_support_.init(None, globals()); ' |
| 2402 | 2403 | S._send(cmd) # non blocking |
| 2403 | 2404 | except Exception, msg: |