sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.29k stars 439 forks source link

Update notebook to utilize pure javascript JSmol for default live 3-D #16004

Closed gutow closed 9 years ago

gutow commented 10 years ago

The notebook needs updates to utilize a pure javascript version of Jmol by default for live 3-D. This includes changes to make the notebook compatible with the newer jquery-1.9 (some things used in the notebook have been deprecated).

Jmol is cross compiled to java and javascript. Because so many browser/OS combinations now actively try to avoid using java applets, it is necessary to have a pure javascript alternative. This solution provides all the functionality of Jmol, but as expected since javascript is interpreted rather than bytecode ("~3/4" of the way to compiled) the performance when interacting with the plot is slower.

This first implementation removes the user tools that have appeared to the right of the 3-D plot as they need to be rewritten as well.

One added feature is a "load 3-D live" check box that can be used to make a worksheet load 3-D plots live when the worksheet is opened. For worksheets with a single interact or only 1-2 plots this should be OK.

This requires installation of an updated Jmol.spkg. See ticket #17020. Will require a new sagenb release: [INSERT HERE]

How to test:

  1. Update Sage with #17020
  2. Download the repackaged Jmol from the link provide in #17020 and save the package in the "upstream" directory of your sage install.
  3. run sage -f jmol to install the new jmol.
  4. If you don't have it yet, update Sage with #16911 or just use this branch that Volker has merged with that one.
  5. Same with #16396 if you want to build doc correctly.
  6. Update Sage with the branch here
  7. Put the new upstream package into SAGE_ROOT/upstream
  8. Do sage -f sagenb-0.11.0
  9. Test!
  10. For testing, #17170 is also advised, since without it display in the notebook does not work properly.

Depends on #17020

Upstream: Reported upstream. Developers acknowledge bug.

CC: @kcrisman @novoselt @strogdon @jasongrout @fchapoton

Component: notebook

Keywords: Jmol 3D 3-D

Author: Jonathan Gutow, Volker Braun

Branch: a4c94cd

Reviewer: Steven Trogdon, Karl-Dieter Crisman, Jonathan Gutow

Issue created by migration from https://trac.sagemath.org/ticket/16004

strogdon commented 10 years ago
comment:48

Replying to @strogdon:

Replying to @gutow:

Replying to @strogdon:

There are certain situations, and I haven't been able to isolate the sequence of things, where I'm unable to evaluate a cell - both with the mouse and from the keyboard. At these times I'm also unable to rename the worksheet.

Does this problem only occur when using interacts? I found an interact that has controls below where the applet is drawn and am seeing some funny things about who gets the click. I've also seen an issue with interacts not moving out of the way to show the evaluate button. That is probably a css issue that is separate from Jmol/JSmol.

This issue from my end is not associated with using interacts. I haven't isolated the exact sequence to reproduce it. But I have seen it on two occasions. Now I'm testing on top of the develop branch. So there could be some irregularity in switching to my testing branch that includes the newer jmol.

This appears to be a problem on my end and not with the code. It's a consequence of how I was moving things to deal with the sagenb symlink when I changed branches for testing. If I remember to create a new symlink each time I change branches then I don't seem to observe the problem.

strogdon commented 10 years ago
comment:49

There appears to be a general problem with the Chromium browser. When I click to make the 3D image live I get a dialog box with

JSmolCore.js: synchronous binary file transfer is required but not available

Then after clicking OK to remove the dialog box the 3D image disappears with no live jmol image. There is a JSmol icon at the lower right where the image should appear and right-clicking does produce the menu, but there is no image. The dialog box only appears once. Subsequent clicks to make other 3D images live produce no live jmols - the JSmol icon being all that's present.

gutow commented 10 years ago
comment:50

This is a general problem with all Webkit browsers operating on localhost. This is because they will not allow any connections to network servers. Since webkit browsers cannot handle binary files in javascript, JSmol sends it to a server to convert to base64 encoded ascii. For testing I've been using the server that Bob Hanson has set up for the Jmol community. Ideally, we should include something in the notebook that can handle these .php requests. When I set up real servers I change the address of the php call and use the Apache that I proxy my Sage server behind. I simply do not test locally in Webkit browsers. I do all local testing in Firefox and then set up a beta server on the network to double check Webkit browsers and when I'm feeling like a masochist IE (I'm so fed up with IE, I usually just ignore it).

Replying to @strogdon:

There appears to be a general problem with the Chromium browser. When I click to make the 3D image live I get a dialog box with

JSmolCore.js: synchronous binary file transfer is required but not available

Then after clicking OK to remove the dialog box the 3D image disappears with no live jmol image. There is a JSmol icon at the lower right where the image should appear and right-clicking does produce the menu, but there is no image. The dialog box only appears once. Subsequent clicks to make other 3D images live produce no live jmols - the JSmol icon being all that's present.

kcrisman commented 10 years ago
comment:51

up with IE, I usually just ignore it).

Apparently even the US and UK governments now want us to ignore it.


Re: Webkit: But ... does that mean Chrome and Safari can't do this right? Or is the version/fork of WK that Chrome uses not susceptible? I just got this going, won't have time to actually test it tonight, but just asking.

gutow commented 10 years ago
comment:52

Replying to @kcrisman:

Re: Webkit: But ... does that mean Chrome and Safari can't do this right? Or is the version/fork of WK that Chrome uses not susceptible? I just got this going, won't have time to actually test it tonight, but just asking.

No, the webkit browsers work when things are set up on a real webserver. Then the javascript can send stuff to a different server for conversion. As I said, it would be nice to embed the conversion in the Notebook server, but since any realistic server will be proxied behind something like Apache that can handle the existing .php script it is probably better to just put that on the server and change the path for the .php script to point to the local Apache server and not the Jmol community server. Should an item be added to the administrative settings page of the notebook?

gutow commented 10 years ago
comment:53

The issue with the JSmol catching clicks for things below the active 3-D canvas has been fixed. This is an upstream bug, so I am trying to get it pushed through the upstream Jmol releases, rather than have to include a patch. Hopefully, this will only take a few days.

kcrisman commented 10 years ago
comment:54

Re: Webkit: But ... does that mean Chrome and Safari can't do this right? Or is the version/fork of WK that Chrome uses not susceptible? I just got this going, won't have time to actually test it tonight, but just asking.

No, the webkit browsers work when things are set up on a real webserver. Then the javascript can send stuff to a different server for conversion. As I said, it would be nice to embed the conversion in the Notebook server, but since any realistic server will be proxied behind something like Apache that can handle the existing .php script it is probably better to just put that on the server and change the path for the .php script to point to the local Apache server and not the Jmol community server. Should an item be added to the administrative settings page of the notebook?

What I meant was that many people (including myself) use the notebook locally on localhost. That is just a standard use case. I also use it remotely on a "real webserver", but a lot of times I'm just trying something and want to do it on my own computer. Are you saying that JSmol doesn't work in this case unless you are using Firefox? That would be pretty unfortunate, especially since Chrome has such domination in terms of browser share now.

That said, switching between this branch and the "usual" one has caused some horrible problem with my Sage (probably my own error somewhere) so I can't test this yet, even though I thought I had it set up last night :(

kcrisman commented 10 years ago
comment:55

There are certain situations, and I haven't been able to isolate the sequence of things, where I'm unable to evaluate a cell - both with the mouse and from the keyboard. At these times I'm also unable to rename the worksheet.

Does this problem only occur when using interacts? I found an interact that has controls below where the applet is drawn and am seeing some funny things about who gets the click. I've also seen an issue with interacts not moving out of the way to show the evaluate button. That is probably a css issue that is separate from Jmol/JSmol.

This issue from my end is not associated with using interacts. I haven't isolated the exact sequence to reproduce it. But I have seen it on two occasions. Now I'm testing on top of the develop branch. So there could be some irregularity in switching to my testing branch that includes the newer jmol.

This appears to be a problem on my end and not with the code. It's a consequence of how I was moving things to deal with the sagenb symlink when I changed branches for testing. If I remember to create a new symlink each time I change branches then I don't seem to observe the problem.

I am now having the same problem you are, and presumably for the same reason (I had to recompile Sage). I did recreate the symlink, though, and so I'm not sure why this isn't working right. How exactly did you fix this, strogdon?


Other comments:


I definitely am in the right version of sagenb - switched back and forth a couple times. The evaluate button is gone and shift-enter does not work properly in the latest version of yours. Weirdly, it did work before, so I assume something in the most recent one broke it? But it presumably works for you, so I wonder what I did wrong... again, presumably similar to what strogdon did wrong before, but I'm stumped.

strogdon commented 10 years ago
comment:56

Replying to @kcrisman:

There are certain situations, and I haven't been able to isolate the sequence of things, where I'm unable to evaluate a cell - both with the mouse and from the keyboard. At these times I'm also unable to rename the worksheet.

Does this problem only occur when using interacts? I found an interact that has controls below where the applet is drawn and am seeing some funny things about who gets the click. I've also seen an issue with interacts not moving out of the way to show the evaluate button. That is probably a css issue that is separate from Jmol/JSmol.

This issue from my end is not associated with using interacts. I haven't isolated the exact sequence to reproduce it. But I have seen it on two occasions. Now I'm testing on top of the develop branch. So there could be some irregularity in switching to my testing branch that includes the newer jmol.

This appears to be a problem on my end and not with the code. It's a consequence of how I was moving things to deal with the sagenb symlink when I changed branches for testing. If I remember to create a new symlink each time I change branches then I don't seem to observe the problem.

I am now having the same problem you are, and presumably for the same reason (I had to recompile Sage). I did recreate the symlink, though, and so I'm not sure why this isn't working right. How exactly did you fix this, strogdon?

Well, it could have been coincidental. The last time I checked things were OK. When I change to my sagenb testing branch I have to remove and recreate the sagenb symlink and then type make to make sure the new jmol is used. It seemed also that the notebook caches things which occasionally gave aberrant behavior? Closing and restarting the notebook seemed to fix that. Switching back to the develop branch never seemed to be a problem. And yes, I did something that forced a make distclean && make - though I can't remember what it was.

strogdon commented 10 years ago
comment:57

I'm trying to recall what had given me issues when testing this ticket that prompted a rebuilding of Sage. It was perhaps that I was testing on top of the develop branch and not on top of the master. Doing

./sage -dev checkout --ticket 16003

may have been the problem, although I'm not sure. Anyway, to test on top of the develop branch I now do the following and as long as I recreate the sagenb symlink I haven't had a problem testing and then switching back to the develop branch:

This creates testingbranch, changes to that branch and adds ticket #16003 on top of it, i.e. git log gives:

commit 55a76eb8ca5199d0db37a4a55267396be503ad2e
Merge: 2001f33 a89ac4b
Author: Steven Trogdon 
Date:   Thu Apr 24 19:46:43 2014 -0500

    Merge branch 'u/gutow/ticket/16003' of trac.sagemath.org:sage into jmol_javascript

commit 2001f33f54528f942ec7ff63eddeba890a9ba274
Author: Volker Braun <vbraun.name@gmail.com>
Date:   Wed Apr 23 00:03:12 2014 +0200

    Updated Sage version to 6.2.rc0

Then after (re)creating the sagenb symlink and typing make, I'm ready to test after the make completes.

kcrisman commented 10 years ago
comment:60

See also #12212 comment:54 .

kcrisman commented 10 years ago
comment:61

The issue with the JSmol catching clicks for things below the active 3-D canvas has been fixed. This is an upstream bug, so I am trying to get it pushed through the upstream Jmol releases, rather than have to include a patch. Hopefully, this will only take a few days.

Given #16003 comment:24, it seems like Jmol has had some changes since then - is that fix in there as well? Then maybe we can take care of #12212 and these two in one fell swoop.

But first I'm going to look at https://github.com/sagemath/sagenb/pull/204, even if that means slightly updating the commits here. Making things easier for development is good.

kcrisman commented 10 years ago
comment:62

The issue with the JSmol catching clicks for things below the active 3-D canvas has been fixed. This is an upstream bug, so I am trying to get it pushed through the upstream Jmol releases, rather than have to include a patch. Hopefully, this will only take a few days.

Given #16003 comment:24, it seems like Jmol has had some changes since then - is that fix in there as well? Then maybe we can take care of #12212 and these two in one fell swoop.

But first I'm going to look at https://github.com/sagemath/sagenb/pull/204, even if that means slightly updating the commits here. Making things easier for development is good.

This will need slight rebase due to that, indeed.

More to the point, though, I would like to see this get in Sage, but there is just too much to look at all at once. I recommend splitting into the following pieces.

Otherwise I think there are just too many moving parts to do this without breaking something important somewhere...

But I am "commit"ted to doing what I can on this - which should be a fair amount in the next few weeks, if Jonathan or others can help me identify what needs to happen to put this into practice.

kcrisman commented 10 years ago
comment:63

I recommend splitting into the following pieces.

Updated:

Whatever is needed in terms of reorganization so that #16003 (possibly with an even more updated jmol) can get in, since it breaks such plots in the notebook.

Update jquery in notebook and whatever changes need to happen with that.

Enable/switch to js from java plots.

kcrisman commented 10 years ago
comment:64

Re: Webkit: But ... does that mean Chrome and Safari can't do this right? Or is

No, the webkit browsers work when things are set up on a real webserver. Then the

What I meant was that many people (including myself) use the notebook locally on localhost. That is just a standard use case. I also use it remotely on a "real webserver", but a lot of times I'm just trying something and want to do it on my own computer. Are you saying that JSmol doesn't work in this case unless you are using Firefox? That would be pretty unfortunate, especially since Chrome has such domination in terms of browser share now.

Yeah, I can confirm that at least the initial two commits have the following behavior on localhost (the way MOST users will interact with the notebook in their personal installations):

kcrisman commented 10 years ago
comment:65

Update: I was able to make some progress with restoring the "usual" add new cell behavior without using the new icon things, thanks to Jonathan's hunting down the e.shiftKey business. I think adding icons is good but needs to be part of a different thing - just getting this all working is a big enough job without thinking about how they should fit into the scheme, what icons are 'obvious enough' (this is the problem with the default Jsmol activation icon).

But I do have to say that even though there aren't as many options for the Jsmols because of the removal of the widgets, maybe one doesn't need to have both right away. They "feel" like Jmols. So maybe we just go straight to JS because even if it's a little slower than the Java, it isn't that bad for simple plots and Java was pretty slow for the complex ones also - and this actually works.


Another thing I can't figure out is why finding the right place to right-click to get the menus (in this case default) is like finding a place to take blood on someone at the hospital with really thin veins. It's possible commit c3659b35 will help with this.

kcrisman commented 10 years ago

Upstream: Reported upstream. Developers acknowledge bug.

kcrisman commented 10 years ago
comment:66

Okay, actual status - on Mac:

I have put an updated version of this at https://github.com/kcrisman/sagenb/tree/jsmol though the only substantive difference with Jonathan's branch are:

Hopefully I kept as many of his commits as possible as well. Now that I know that any click on a Jsmol will activate it, that's not even that bad to necessarily need the message - I thought one had to click precisely on the little mysterious icon, which would indeed be confusing.

So needs testing by someone other than me again - but Jonathan would be a great tester now! strogdon or chapoton or Andrey or someone perhaps can do so... though this is probably the worst time of year for it!

Finally, from the Jmol wiki:

Reading binary files in some browsers and saving images and Jmol states in all browsers do require a server-side PHP script.

Not being able to save either is a bummer. I'm going to look into this php file thingie a little bit.

kcrisman commented 10 years ago
comment:67

Finally, from the Jmol wiki:

Reading binary files in some browsers and saving images and Jmol states in all browsers do require a server-side PHP script.

Not being able to save either is a bummer. I'm going to look into this php file thingie a little bit.

This is so not my area of expertise... I think we'd have to assume someone has php on their box to do this, and I don't think we need to add another upstream dependency to Sage! Macs would come with this built in, though, maybe most Linux boxes as well?

Anyway, see here for how to get twisted to do this - well a very bare-bones thing, and see also possibility of this problem.

vbraun commented 9 years ago
comment:68

To serve the jsmol files (and thus work with the chrome sandbox forbidding direct filesystem access) you just have to add

    self.add_static_path('/java/jsmol', os.path.join(os.environ["SAGE_ROOT"],"local","share","jsmol"))

to flask_version/base.py in the notebook right under the corresponding jmol line. Files will then be at http://localhost/java/jsmol/

Saving files back from the browser requires a simple http POST handler, see http://flask.pocoo.org/docs/0.10/patterns/fileuploads/ for an example.

kcrisman commented 9 years ago
comment:69

Oh, that would be nice.

vbraun commented 9 years ago

Description changed:

--- 
+++ 
@@ -6,26 +6,11 @@

 One added feature is a "load 3-D live" check box that can be used to make a worksheet load 3-D plots live when the worksheet is opened.  For worksheets with a single interact or only 1-2 plots this should be OK.

-*This requires installation of an updated Jmol.spkg.  See ticket #16003.
-
-Sorry for the github commit, but I could not get a notebook branch working in Sage. 
-* https://github.com/gutow/sagenb/commit/c730aa4cf563c51e7f1f8ca92899bf515d365030
-* https://github.com/gutow/sagenb/commit/7ce561653aa3ffbb28eb36f487be381227018958
-* https://github.com/gutow/sagenb/commit/0242d2f495e4be79090e4aae83b4dade1d9a0f26
-* https://github.com/gutow/sagenb/commit/7aacbfa3957f237edbea448d492f7c2b7d34cec2
-* https://github.com/gutow/sagenb/commit/62a3775979c93b09def7487f9c4599554098b5c6
-* https://github.com/gutow/sagenb/commit/c3659b35e3595605cbb01289f1279195cf0b8653
-* https://github.com/gutow/sagenb/commit/2e4fd33d6ad88485b9c80e508917ccc976878561
+This requires installation of an updated Jmol.spkg.  See ticket #16003.
+Will require a new sagenb release: [INSERT HERE]

 How to test:
-1. Clone the git repository https://github.com/gutow/sagenb to anywhere convenient on your system.
-2. Do the following to make sage use the new repository.
+1. Switch Sage to #16003 and run `sage -f jmol` to install the new jmol.
+2. Clone the git repository https://github.com/vbraun/sagenb.git to anywhere convenient on your system.
+3. From within the sagenb repository run `sage -python setup.py install`

-```
-$cd SAGE_ROOT/local/lib/python/site-packages/sagenb-0.10.8.2-py2.7.egg
-$mv sagenb sagenb_old
-$ln -s <path to the sagenb directory inside your new repository> sagenb 
-```
-
-In my case the symlink looks like 
-`ln -s ~/git/sagenb/sagenb sagenb`
vbraun commented 9 years ago

Changed author from gutow to Jonathan Gutow, Volker Braun

vbraun commented 9 years ago
comment:70

Github pull request: https://github.com/sagemath/sagenb/pull/241

vbraun commented 9 years ago

Description changed:

--- 
+++ 
@@ -6,11 +6,10 @@

 One added feature is a "load 3-D live" check box that can be used to make a worksheet load 3-D plots live when the worksheet is opened.  For worksheets with a single interact or only 1-2 plots this should be OK.

-This requires installation of an updated Jmol.spkg.  See ticket #16003.
+This requires installation of an updated Jmol.spkg.  See ticket #17020.
 Will require a new sagenb release: [INSERT HERE]

 How to test:
-1. Switch Sage to #16003 and run `sage -f jmol` to install the new jmol.
+1. Switch Sage to #17020 and run `sage -f jmol` to install the new jmol.
 2. Clone the git repository https://github.com/vbraun/sagenb.git to anywhere convenient on your system.
 3. From within the sagenb repository run `sage -python setup.py install`
-
vbraun commented 9 years ago

Changed dependencies from #16003 to #17020

vbraun commented 9 years ago

Description changed:

--- 
+++ 
@@ -11,5 +11,5 @@

 How to test:
 1. Switch Sage to #17020 and run `sage -f jmol` to install the new jmol.
-2. Clone the git repository https://github.com/vbraun/sagenb.git to anywhere convenient on your system.
+2. Clone the `new_jmol` branch from the PR to anywhere convenient on your system: `git clone https://github.com/vbraun/sagenb.git -b new_jmol`
 3. From within the sagenb repository run `sage -python setup.py install`
strogdon commented 9 years ago
comment:73

I haven't tested extensively but things seem to now work here with firefox and chromium using oracle plugin; although it is slower that the old jmol. But that's to be expected.

strogdon commented 9 years ago
comment:74

With Chromium when I click to make a 3-D image live I see lots of, I suppose chatter, in the terminal from which the notebook is spawned

[HTTPChannel,1,127.0.0.1] --------------------------------------------------------------------------------
[HTTPChannel,1,127.0.0.1] DEBUG in worksheet [/64bitdev/storage/sage-git_develop/sage/local/lib/python2.7/site-packages/sagenb-0.10.8.3-py2.7.egg/sagenb/flask_version/worksheet.py:673]:
[HTTPChannel,1,127.0.0.1] JSmol call:  getRawDataFromDatabase
[HTTPChannel,1,127.0.0.1] --------------------------------------------------------------------------------
[HTTPChannel,1,127.0.0.1] --------------------------------------------------------------------------------
[HTTPChannel,1,127.0.0.1] DEBUG in worksheet [/64bitdev/storage/sage-git_develop/sage/local/lib/python2.7/site-packages/sagenb-0.10.8.3-py2.7.egg/sagenb/flask_version/worksheet.py:674]:
[HTTPChannel,1,127.0.0.1] JSmol query: http://localhost:8080/home/admin/28/cells/12/sage0-size400.jmol
[HTTPChannel,1,127.0.0.1] --------------------------------------------------------------------------------
[HTTPChannel,1,127.0.0.1] --------------------------------------------------------------------------------
[HTTPChannel,1,127.0.0.1] DEBUG in worksheet [/64bitdev/storage/sage-git_develop/sage/local/lib/python2.7/site-packages/sagenb-0.10.8.3-py2.7.egg/sagenb/flask_version/worksheet.py:673]:
[HTTPChannel,1,127.0.0.1] JSmol call:  getRawDataFromDatabase
[HTTPChannel,1,127.0.0.1] --------------------------------------------------------------------------------
[HTTPChannel,1,127.0.0.1] --------------------------------------------------------------------------------
[HTTPChannel,1,127.0.0.1] DEBUG in worksheet [/64bitdev/storage/sage-git_develop/sage/local/lib/python2.7/site-packages/sagenb-0.10.8.3-py2.7.egg/sagenb/flask_version/worksheet.py:674]:
[HTTPChannel,1,127.0.0.1] JSmol query: http://localhost:8080/home/admin/28/cells/12/sage0-size400-391049111.jmol.zip
[HTTPChannel,1,127.0.0.1] --------------------------------------------------------------------------------
[HTTPChannel,1,127.0.0.1] --------------------------------------------------------------------------------
[HTTPChannel,1,127.0.0.1] DEBUG in worksheet [/64bitdev/storage/sage-git_develop/sage/local/lib/python2.7/site-packages/sagenb-0.10.8.3-py2.7.egg/sagenb/flask_version/worksheet.py:673]:
[HTTPChannel,1,127.0.0.1] JSmol call:  getRawDataFromDatabase
[HTTPChannel,1,127.0.0.1] --------------------------------------------------------------------------------
[HTTPChannel,1,127.0.0.1] --------------------------------------------------------------------------------
[HTTPChannel,1,127.0.0.1] DEBUG in worksheet [/64bitdev/storage/sage-git_develop/sage/local/lib/python2.7/site-packages/sagenb-0.10.8.3-py2.7.egg/sagenb/flask_version/worksheet.py:674]:
[HTTPChannel,1,127.0.0.1] JSmol query: http://localhost:8080/home/admin/28/cells/12/sage0-size400-391049111.jmol.zip
[HTTPChannel,1,127.0.0.1] --------------------------------------------------------------------------------

that comes from these lines in flask_version/worksheet.py

    current_app.logger.debug('JSmol call:  %s', call)
    current_app.logger.debug('JSmol query: %s', query)
vbraun commented 9 years ago
comment:75

I'm intentionally logging the calls as DEBUG since its quite possible that jsmol might choke on the interaction with the jsmol base64 relay. I don't know who enabled DEBUG-level logging by default, but that certainly wasn't me.

gutow commented 9 years ago

Description changed:

--- 
+++ 
@@ -10,6 +10,8 @@
 Will require a new sagenb release: [INSERT HERE]

 How to test:
-1. Switch Sage to #17020 and run `sage -f jmol` to install the new jmol.
-2. Clone the `new_jmol` branch from the PR to anywhere convenient on your system: `git clone https://github.com/vbraun/sagenb.git -b new_jmol`
-3. From within the sagenb repository run `sage -python setup.py install`
+1. Switch Sage to #17020
+2. Download the repackaged Jmol from the link provide in #17020 and save the package in the "upstream" directory of your sage install.
+1.run `sage -f jmol` to install the new jmol.
+1. Clone the `new_jmol` branch from the PR to anywhere convenient on your system: `git clone https://github.com/vbraun/sagenb.git -b new_jmol`
+2. From within the sagenb repository run `sage -python setup.py install`
gutow commented 9 years ago

Description changed:

--- 
+++ 
@@ -12,6 +12,6 @@
 How to test:
 1. Switch Sage to #17020
 2. Download the repackaged Jmol from the link provide in #17020 and save the package in the "upstream" directory of your sage install.
-1.run `sage -f jmol` to install the new jmol.
-1. Clone the `new_jmol` branch from the PR to anywhere convenient on your system: `git clone https://github.com/vbraun/sagenb.git -b new_jmol`
-2. From within the sagenb repository run `sage -python setup.py install`
+3. run `sage -f jmol` to install the new jmol.
+4. Clone the `new_jmol` branch from the PR to anywhere convenient on your system: `git clone https://github.com/vbraun/sagenb.git -b new_jmol`
+5. From within the sagenb repository run `sage -python setup.py install`
kcrisman commented 9 years ago
comment:78

Currently traveling with a heavy workload, but this sounds great and I will test it next week.

gutow commented 9 years ago

Attachment: 0001-Allow-JSmol-Jmol-drag-resizing-fix-custom-menu.patch.gz

patch to fix custom menu and resizing of 3-D display

gutow commented 9 years ago

patch to allow user to choose Java instead of javascript for 3-D viewing

gutow commented 9 years ago
comment:79

Attachment: 0001-Add-option-to-use-java-for-3D.patch.gz

Because I cannot push to Volker's repository at https://github.com/vbraun/sagenb.git and have not created a public clone repository of that I am attaching two patches that fix the broken custom right-click menu, applet resizing and allows the user to choose to use Java instead of javascript for 3-D viewing. See above.

With the present version of JSmol/Jmol java applets always launch live. I have pushed a patch upstream that should show up soon that will allow java applets to behave the same as the javascript version. We should not wait for the upstream fix as it is minor.

I also think we should still fix things so that the right-click hint is text above the live applet.

I think we are basically ready to go on this ticket and #17020. We need a reviewer.

gutow commented 9 years ago

Description changed:

--- 
+++ 
@@ -2,7 +2,7 @@

 Jmol is cross compiled to java and javascript.  Because so many browser/OS combinations now actively try to avoid using java applets, it is necessary to have a pure javascript alternative.  This solution provides all the functionality of Jmol, but as expected since javascript is interpreted rather than bytecode ("~3/4" of the way to compiled) the performance when interacting with the plot is slower.  

-This first implementation removes the user tools that have appeared to the right of the 3-D plot as they need to be rewritten as well.  In this first implementation it is not possible to choose to use the java applet instead. 
+This first implementation removes the user tools that have appeared to the right of the 3-D plot as they need to be rewritten as well.

 One added feature is a "load 3-D live" check box that can be used to make a worksheet load 3-D plots live when the worksheet is opened.  For worksheets with a single interact or only 1-2 plots this should be OK.
kcrisman commented 9 years ago
comment:82

With the present version of JSmol/Jmol java applets always launch live. I have pushed a patch upstream that should show up soon that will allow java applets to behave the same as the javascript version. We should not wait for the upstream fix as it is minor.

Perhaps you can open a new ticket for that when it comes out.

I also think we should still fix things so that the right-click hint is text above the live applet.

On this ticket?

I think we are basically ready to go on this ticket and #17020. We need a reviewer.

I will try my best to work on this the remainder of this week!

gutow commented 9 years ago

Attachment: 0001-text-hint-to-use-right-click-menu-on-live-3-D-applet.patch.gz

Here is a simple patch the makes puts up a text hing to use the right click menu when the applet is live.

gutow commented 9 years ago
comment:83

Boy my typing was broken above. The patch provides a text hint to use the right-click menu when the applet is live to get options. We could open another ticket for that, but it is a two line patch so I think we can include it here. Try it.

gutow commented 9 years ago
comment:84

Replying to @kcrisman:

With the present version of JSmol/Jmol java applets always launch live. I have pushed a patch upstream that should show up soon that will allow java applets to behave the same as the javascript version. We should not wait for the upstream fix as it is minor.

Perhaps you can open a new ticket for that when it comes out.

I think that is the right approach.

gutow commented 9 years ago

Description changed:

--- 
+++ 
@@ -14,4 +14,5 @@
 2. Download the repackaged Jmol from the link provide in #17020 and save the package in the "upstream" directory of your sage install.
 3. run `sage -f jmol` to install the new jmol.
 4. Clone the `new_jmol` branch from the PR to anywhere convenient on your system: `git clone https://github.com/vbraun/sagenb.git -b new_jmol`
-5. From within the sagenb repository run `sage -python setup.py install`
+5. Apply the three attached patches to this new sagenb repository.
+6. From within the sagenb repository run `sage -python setup.py install`
vbraun commented 9 years ago
comment:86

I've given you access to https://github.com/vbraun/sagenb.git, can you push your patches there?

gutow commented 9 years ago
comment:87

Replying to @vbraun:

I've given you access to https://github.com/vbraun/sagenb.git, can you push your patches there?

I will try to do it this evening (~15 hrs from now).

kcrisman commented 9 years ago
comment:88

The patches look fine (still need to test, trying to do that before lunch!). A few comments/questions:

kcrisman commented 9 years ago
comment:89

Testing - more impressions, now from the main stuff.

Please do check out what I did to keep behavior as close to the legacy as possible. Hopefully it will be pretty easy for one of you to just import 'correct' behavior. It would have been easier to have not touched that stuff at all, but I know that ship has sailed. Also, if we need to move discussion to github that is fine, I'm putting it here because I know everyone is reading this :)

kcrisman commented 9 years ago
comment:90
  • The new cell bar, when it is below a text area, does not have the icons.

Other things noticed.

/Users/.../sage/local/lib/python2.7/site-packages/IPy\
thon/core/formatters.py:239: FormatterWarning: Exception in text/plain
formatter: should never launch viewer in embedded mode
  FormatterWarning,
None

and no plot. However, if I evaluate an interact cell, then all is well! (Edit: maybe this is residual from the whole base64 thing?)

kcrisman commented 9 years ago
comment:91

Also, don't forget to fix the thing inadvertently introduced in sagenb/data/sage/js/master.js

 $(document)
.on('click','.introspection, .docstring, .click-message, #worksheet_cell_list', function (e) {

needs to have the commas removed, more precisely it should look like

        $(document)
            .on('click','#worksheet_cell_list .introspection .docstring .click-message', function (e) {

or thereabouts.

Edit: perhaps this explains Volker's commit https://github.com/vbraun/sagenb/commit/062a76a622b9ff788843548c8fd1e8cc2ce6a4e5

kcrisman commented 9 years ago
comment:92

The formatter warning is due to https://github.com/ipython/ipython/pull/4745/ but I don't know how that interacts with getting the jsmols to show up. Conceivably related is https://github.com/ipython/ipython/issues/5369/ with its fix https://github.com/ipython/ipython/pull/5452

Edit: the problem is with the default of showing. Compare:

var('y')
show(plot3d(x^2+y^2,(x,-1,1),(y,-1,1)))

which works, and

var('y')
plot3d(x^2+y^2,(x,-1,1),(y,-1,1))

which doesn't. So something is going wrong in that default.

Edit 2: Haha, the problem in fact is even with TWO dimensional plots! So something is going wrong with

gfx = GraphicsFile(filename, mime_type=’image/png’)
gfx.launch_viewer()

and/or the "display hook", whatever that is, or something else in .show().

kcrisman commented 9 years ago
comment:93

The evaluate button not showing up appears to be related to the wrong css rule being chosen at https://github.com/sagemath/sagenb/blob/master/sass/src/main.scss#L865 - it should be eval_button_active but isn't. I can't figure this out yet; even when I change to make the button show up in the web inspector, I still can't get it to evaluate.