#9238: J. Gutow's update to Jmol in the notebook...
------------------------------------------------+---------------------------
   Reporter:  gutow                             |       Owner:  gutow       
       Type:  enhancement                       |      Status:  needs_review
   Priority:  major                             |   Milestone:  sage-4.7    
  Component:  notebook                          |    Keywords:              
     Author:  Jonathan Gutow                    |    Upstream:  N/A         
   Reviewer:  Jason Grout, Karl-Dieter Crisman  |      Merged:              
Work_issues:                                    |  
------------------------------------------------+---------------------------

Comment(by gutow):

 Replying to [comment:83 kcrisman]:
 I think what you've found is the stuff for the notebook, which does seem
 to be working.  I've found the following in the base.pyx file inside the
 plot3d directory, but am not sure what is going on.
 {{{
 if 'filename' in kwds:
             filename = kwds['filename']
             del kwds['filename']
         else:
             filename = sage.misc.misc.tmp_filename()

         from sage.plot.plot import EMBEDDED_MODE, DOCTEST_MODE
         ext = None
 [snip...]
         if DOCTEST_MODE or viewer=='jmol':
             # Temporary hack: encode the desired applet size in the end of
 the filename:
             # (This will be removed once we have dynamic resizing of
 applets in the browser.)
             base, ext = os.path.splitext(filename)
             fg = figsize[0]
             #if fg >= 2:
             #    fg = 2
             filename = '%s-size%s%s'%(base, fg*100, ext)
             ext = "jmol"
             archive_name = "%s.%s.zip" % (filename, ext)
             if EMBEDDED_MODE:
                 # jmol doesn't seem to correctly parse the ?params part of
 a URL
                 archive_name = "%s-%s.%s.zip" % (filename, randint(0, 1 <<
 30), ext)

             T = self._prepare_for_jmol(frame, axes, frame_aspect_ratio,
 aspect_ratio, zoom)
             T.export_jmol(archive_name, force_reload=EMBEDDED_MODE,
 zoom=zoom*100, **kwds)
             viewer_app = "sage-native-execute " +
 os.path.join(sage.misc.misc.SAGE_LOCAL, "bin/jmol")

             # We need a script to load the file
             f = open(filename + '.jmol', 'w')
             f.write('set defaultdirectory "%s"\n' % archive_name)
             f.write('script SCRIPT\n')
             f.close()
 }}}

 Somehow the building of "archive_name" is getting messed up.  I'm
 suspicious of
  filename = sage.misc.misc.tmp_filename()
 near the top or
  base, ext = os.path.splitext(filename)
 in the viewer=='jmol' block.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9238#comment:84>
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.

Reply via email to