#12299: Advance Jmol Interactive Features in Flask Notebook
------------------------------------------------------------+---------------
Reporter: gutow | Owner:
jason, mpatel, was
Type: enhancement | Status:
needs_review
Priority: major | Milestone:
sage-5.2
Component: notebook | Resolution:
Keywords: Jmol, 3D, notebook | Work issues:
Report Upstream: Workaround found; Bug reported upstream. | Reviewers:
Karl-Dieter Crisman, Steven Trogdon, Punarbasu Purkayastha
Authors: Jonathan Gutow | Merged in:
Dependencies: #11080,#11078,#11503 | Stopgaps:
------------------------------------------------------------+---------------
Comment (by jhpalmieri):
This passes tests for me. Regarding jmol_scratch: should this be a
temporary directory, or is it important that it persists from session to
session? If it should persist, then `~/.sage/` should be replaced by
`DOT_SAGE`, for example like this:
{{{
#!diff
diff --git a/sage/interfaces/jmoldata.py b/sage/interfaces/jmoldata.py
--- a/sage/interfaces/jmoldata.py
+++ b/sage/interfaces/jmoldata.py
@@ -22,7 +22,7 @@ AUTHORS:
from sage.structure.sage_object import SageObject
from sage.misc.misc import tmp_filename
-from sage.misc.misc import SAGE_LOCAL
+from sage.misc.misc import SAGE_LOCAL, DOT_SAGE, sage_makedirs
import subprocess
import os
@@ -81,12 +81,12 @@ class JmolData(SageObject):
<type 'bool'>
"""
#scratch file for Jmol errors and status
- jmolscratch =
os.path.expanduser("~/.sage/sage_notebook.sagenb/jmol_scratch")
+ jmolscratch = os.path.join(DOT_SAGE, "sage_notebook.sagenb",
"jmol_scratch")
if not os.path.exists(jmolscratch):
- os.mkdir(jmolscratch)
+ sage_makedirs(jmolscratch)
scratchout = os.path.join(jmolscratch,"jmolout.txt")
jout=open(scratchout,'w')
- testjavapath = os.path.join(SAGE_LOCAL, "share/jmol/testjava.sh")
+ testjavapath = os.path.join(SAGE_LOCAL, "share", "jmol",
"testjava.sh")
result = subprocess.call([testjavapath],stdout=jout)
jout.close()
if (result == 0):
@@ -168,7 +168,7 @@ class JmolData(SageObject):
"""
if (self.is_jvm_available()):
# Set up paths, file names and scripts
- jmolpath = os.path.join(SAGE_LOCAL,
"share/jmol/JmolData.jar")
+ jmolpath = os.path.join(SAGE_LOCAL, "share", "jmol",
"JmolData.jar")
launchscript = ""
if (datafile_cmd!='script'):
launchscript = "load "
@@ -179,9 +179,9 @@ class JmolData(SageObject):
sizeStr = "%sx%s" %(figsize*100,figsize*100)
#scratch file for Jmol errors and status
- jmolscratch =
os.path.expanduser("~/.sage/sage_notebook.sagenb/jmol_scratch")
+ jmolscratch = os.path.join(DOT_SAGE, "sage_notebook.sagenb",
"jmol_scratch")
if not os.path.exists(jmolscratch):
- os.mkdir(jmolscratch)
+ sage_makedirs(jmolscratch)
scratchout = os.path.join(jmolscratch,"jmolout.txt")
jout=open(scratchout,'w')
#now call the java application and write the file.
}}}
Otherwise, you could use `SAGE_TMP` so that it would be cleaned up when
Sage exits.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12299#comment:106>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.