#16004: Update notebook to utilize pure javascript JSmol for default live 3-D
-------------------------------------+-------------------------------------
Reporter: gutow | Owner: gutow
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-6.4
Component: notebook | Resolution:
Keywords: Jmol 3D 3-D | Merged in:
Authors: Jonathan Gutow, | Reviewers: Steven Trogdon, Karl-
Volker Braun | Dieter Crisman, Jonathan Gutow
Report Upstream: Reported | Work issues:
upstream. Developers acknowledge | Commit:
bug. | Stopgaps:
Branch: |
Dependencies: #17020 |
-------------------------------------+-------------------------------------
Comment (by kcrisman):
Okay, ''this'' much more hackish code does seem to work properly,
including dealing with reloading pages with old files, etc.
{{{
#!diff
diff --git a/sagenb/notebook/cell.py b/sagenb/notebook/cell.py
index 7c322c9..20ea9c1 100755
--- a/sagenb/notebook/cell.py
+++ b/sagenb/notebook/cell.py
@@ -2333,8 +2333,8 @@ class Cell(Cell_generic):
#
# So we need to prepend the worksheet URL, in order
# for the zip to be accessed correctly.
+ jmol_name = os.path.join(self.directory(), F)
if self.worksheet().docbrowser():
- jmol_name = os.path.join(self.directory(), F)
with open(jmol_name, 'r') as f:
jmol_script = f.read()
jmol_script = jmol_script.replace(
@@ -2343,8 +2343,12 @@ class Cell(Cell_generic):
with open(jmol_name, 'w') as f:
f.write(jmol_script)
+ F_time = F.replace('.jmol','-{}time.jmol'.format( time.time() ))
+ jmol_name_time = os.path.join(self.directory(), F_time)
+ shutil.copy2(jmol_name, jmol_name_time)
+
image_name = os.path.join(self.url_to_self(),'.jmol_images',F)
- script_name = os.path.join(self.url_to_self(), F)
+ script_name = os.path.join(self.url_to_self(), F_time)
return textwrap.dedent("""
<div id="sage_jmol_{id}" class="3DPlotDiv">
<div id="loadJmol" style="display:none;">{id}</div>
@@ -2423,6 +2427,8 @@ class Cell(Cell_generic):
pass # obj data
elif F.endswith('.svg'):
images.append('<embed src="%s" type="image/svg+xml"
name="emap">' % url)
+ elif F.endswith('time.jmol'):
+ pass
elif F.endswith('.jmol'):
images.append(self._jmol_files_html(F))
jmolimagebase = F
}}}
But I'd much rather hear that there is a way to make Chrome like the `?`
syntax for the script and not just the graphic.
--
Ticket URL: <http://trac.sagemath.org/ticket/16004#comment:125>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.