Opened 8 years ago

Last modified 7 years ago

#16004 closed enhancement

Update notebook to utilize pure javascript JSmol for default live 3-D — at Version 70

Reported by: gutow Owned by: gutow
Priority: major Milestone: sage-6.4
Component: notebook Keywords: Jmol 3D 3-D
Cc: kcrisman, novoselt, strogdon, jason, chapoton Merged in:
Authors: Jonathan Gutow, Volker Braun Reviewers:
Report Upstream: Reported upstream. Developers acknowledge bug. Work issues:
Branch: Commit:
Dependencies: #16003 Stopgaps:

Status badges

Description (last modified by vbraun)

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. In this first implementation it is not possible to choose to use the java applet instead.

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. 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.
  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

Change History (70)

comment:1 Changed 8 years ago by gutow

  • Component changed from PLEASE CHANGE to notebook
  • Description modified (diff)

comment:2 Changed 8 years ago by gutow

  • Owner changed from (none) to gutow

comment:3 Changed 8 years ago by gutow

  • Description modified (diff)

comment:4 Changed 8 years ago by gutow

  • Description modified (diff)

comment:5 Changed 8 years ago by gutow

  • Description modified (diff)
  • Status changed from new to needs_review

comment:6 Changed 8 years ago by kcrisman

  • Dependencies changed from 16003 to #16003

comment:7 Changed 8 years ago by kcrisman

  • Cc kcrisman novoselt strogdon added; krisman nosvelt strongdon removed

comment:8 Changed 8 years ago by kcrisman

  • Description modified (diff)

comment:9 follow-up: Changed 8 years ago by gutow

I'm not sure it has to do with this or something broken in my jquery.form.min.js installation, but I can no longer rename worksheets. Does anybody else seeing this or have an idea how this could have anything to do with the changes in this ticket?

comment:10 in reply to: ↑ 9 Changed 8 years ago by gutow

Replying to gutow:

I'm not sure it has to do with this or something broken in my jquery.form.min.js installation, but I can no longer rename worksheets. Does anybody else seeing this or have an idea how this could have anything to do with the changes in this ticket?

I think I've found it. This may be painful. The newer jquery seems to be killing stuff in jquery-ui-1.8.11.custom.js. I will look for a version that is compatible with the newer jquery.

comment:11 Changed 8 years ago by gutow

jquery-ui is definitely out-of-date. The 1.8.11 release is from 2011. Does anybody know what selections need to be made to get the theme for the notebook to look right? I think to get everything working will require updating to the latest 1.10.4.

comment:12 Changed 8 years ago by novoselt

  • Cc jason added

First of all, thanks for all your work on this, Jonathan!

And perhaps Jason can provide some insight in jquery problems?

comment:13 Changed 8 years ago by jason

See my message to sage-devel: https://groups.google.com/d/msg/sage-devel/8zS6qofxxwk/K5LcLsCWBeMJ for the configuration we use in the cell server with jquery-ui 1.10.something.

comment:15 follow-up: Changed 8 years ago by gutow

  • Description modified (diff)

comment:16 in reply to: ↑ 15 Changed 8 years ago by gutow

Replying to gutow: With Jason's directions for building the theme and a little tweaking, I believe I have everything working again along with the javascript 3-D. As a bonus we now how little icons to click on for adding compute and rich-text cells, so forgetful people like me do not have to remember which key-click combinations to use. The real reason for the icons is that I could not get the key combinations to work:)

Last edited 8 years ago by gutow (previous) (diff)

comment:17 follow-up: Changed 8 years ago by gutow

  • Status changed from needs_review to needs_work

Some jquery-ui image paths broken (probably issue of symlinks)...

comment:18 follow-up: Changed 8 years ago by kcrisman

Hey, just a quick question as I hopefully will be able to get testing this soon - can the 'load 3-D live" checkbox work just as well with jmol as with jsmol? Also, I presume it will be evident once I finally get it going, but how does one get the Jmol instead of jsmol (say, locally, so that things are snappier)?

comment:19 Changed 8 years ago by kcrisman

  • Description modified (diff)

comment:20 in reply to: ↑ 17 Changed 8 years ago by kcrisman

Some jquery-ui image paths broken (probably issue of symlinks)...

Is this fixed in https://github.com/gutow/sagenb/commit/7aacbfa3957f237edbea448d492f7c2b7d34cec2 ?

comment:21 Changed 8 years ago by kcrisman

I think that creating a new branch inside sagenb is now not possible with the new layout (not directly git-related). One has to even figure out where sagenb lives... annoying. So to test this one really needs a new sagenb spkg to download, or create one. Harrumph.

comment:22 Changed 8 years ago by strogdon

Unless I've missed something it would seem that a new sagenb spkg is needed. The problem is the upstream sagenb-0.10.8.2 tarball is a tarball of tarballs. And it is the sagenb sub-tarball that has to be modified. Now I was able to generate patches that could be applied directly to the local/lib/python2.7/site-packages/sagenb-0.10.8.2-py2.7.egg folder by cloning https://github.com/gutow/sagenb. It seems that there are a couple more commits needed than listed above. But generating these patches is a lot of work! I'm able to see the icons and to turn on 3-D which is very, very slow. However, I see no way to evaluate an individual cell.

comment:23 Changed 8 years ago by kcrisman

Actually, ppurka has a good solution for this at this sage-devel thread. At least I assume it works - I can't check right this second.

$ cd ~/sagenb/sagenb
$ rm flask_version
$ mv ../flask_version .
$ cd ~/sage/local/lib/python/site-packages/sagenb-0.10.8.2-py2.7.egg
$ mv sagenb{,-0.10.8.2}
$ ln -s ~/sagenb/sagenb .

comment:24 Changed 8 years ago by gutow

  • Description modified (diff)

I'm updating the instructions above to include a fix that leaves the sagenb egg unchanged and allows you to work with multiple notebook development repositories.

To answer another question above the very latest commit to the repository does include the path fixes for jquery-ui images.

comment:25 Changed 8 years ago by gutow

  • Description modified (diff)

comment:26 in reply to: ↑ 18 ; follow-up: Changed 8 years ago by gutow

At this point I have not got the option to run the java applet working cleanly. I can do it by manually screwing with things, but I am still working on it. I have not figured out how to modify the templates so that it will not use java applets without the user specifically requesting it. Because of how evil certain browsers/OS combinations have got about using java applets, we do not want that to ever be the default, even though it is better.

Replying to kcrisman:

Hey, just a quick question as I hopefully will be able to get testing this soon - can the 'load 3-D live" checkbox work just as well with jmol as with jsmol? Also, I presume it will be evident once I finally get it going, but how does one get the Jmol instead of jsmol (say, locally, so that things are snappier)?

comment:27 in reply to: ↑ 26 Changed 8 years ago by kcrisman

Replying to gutow:

At this point I have not got the option to run the java applet working cleanly. I can do it by manually screwing with things, but I am still working on it. I have not figured out how to modify the templates so that it will not use java applets without the user specifically requesting it. Because of how evil certain browsers/OS combinations have got about using java applets, we do not want that to ever be the default, even though it is better.

Well, for instance, could one just hack into Sage itself... after all, one would want to be able to set viewer= whatever, including both jsmol and jmol. What happens with viewer='jmol' with your branch? (I'm trying to set it up but this is an incredibly busy week on campus for me, so I'm not sure how much progress I'll make.) At the least, one would want to just be able to add this to plots to get the Java.

In fact,

sage: from sage.plot.plot3d.base import SHOW_DEFAULTS
sage: SHOW_DEFAULTS['viewer'] = 'jmol'

should be possible then. But I don't know whether that would tie in with your changes thus far.

Last edited 8 years ago by kcrisman (previous) (diff)

comment:28 Changed 8 years ago by gutow

  • Description modified (diff)
  • Status changed from needs_work to needs_review

All seems to work on my test server. I need some reviewers testers now.

comment:29 Changed 8 years ago by kcrisman

  • Description modified (diff)

comment:30 Changed 8 years ago by kcrisman

I think it should be

$ln -s <path to the sagenb directory inside your new repository> sagenb 

not

$ln -s sagenb <path to the sagenb directory inside your new repository> 

am I right?

comment:31 follow-up: Changed 8 years ago by kcrisman

  • Description modified (diff)

Okay, I got it working. Preliminary thoughts:

  • Snappier than advertised. But SO SLOW with lots of points; a sparse vector field or basic plot is not so horrible. Of course, so was the Java version...
  • The load 3d live button is precisely what the doctor ordered.
  • Is it possible that inside interacts the load 3d live button doesn't work (that is, interacts are always live?) Or is it possible that you can only turn that button on, but not off (counter the expectation when clicking it)? I observed some unusual behavior, but maybe it was just something dumb I did.
  • How do you turn a plot "off" if there are too many open? (Or is that not a problem like it was with the sleeping Java applets?)
  • I see no way to get the things I used to with right-click (like stereo glasses, color, axes, whatever). Does jsmol just not have that?
  • The icon for activating the plot is ... not obvious. I still really find the auto-disable piece annoying, and I know that some people have just hacked that away, though I also know I won't convince you otherwise ;-)
  • Please remove the icons for new cells. They are cute, and probably an improvement in some ways, but it should really be orthogonal to this issue. There's enough moving parts to think about as it is. Especially since the blue bars have been the way to make new cells for many years! That's a pretty big change.
  • I figure out what strogdon is talking about. Try activating a jsmol, and then move it around a bit, and then try clicking in a cell *without* clicking alllll the way on the right to "lose focus" from the jsmol. (This is a problem anyway, of having to go all the way to the right to scroll - not limited to jsmol, though, threejs in the cell server has this problem as well.) You won't be able to, at least often not; you have to somehow get off focus and there is some timing delay.
  • I also haven't tried all the zillions of options out there for 3d plots to see if it still obeys them all, but presumably if it's pretty similar to jmol it will do fine.
  • Does it require WebGL turned on? I think not, but I'm not sure.

Hope this helps! Actually, it's fairly comparable to the current setup, so probably we could get it in sooner rather than later. Especially if you have any thoughts on the "viewer" thing - to me, this would be by far the easiest way to switch back and forth between functionality.

Once this has been tested enough and the "right" commits used, I think that you can just do a pull request to sagenb on github with your branch for this. Yay! Thanks for what is clearly very good hard work.

Last edited 8 years ago by kcrisman (previous) (diff)

comment:32 in reply to: ↑ 31 ; follow-up: Changed 8 years ago by gutow

Replying to kcrisman:

Okay, I got it working. Preliminary thoughts:

  • Snappier than advertised. But SO SLOW with lots of points; a sparse vector field or basic plot is not so horrible. Of course, so was the Java version...
  • The load 3d live button is precisely what the doctor ordered.

Thought this is what people were asking for.

  • Is it possible that inside interacts the load 3d live button doesn't work (that is, interacts are always live?) Or is it possible that you can only turn that button on, but not off (counter the expectation when clicking it)? I observed some unusual behavior, but maybe it was just something dumb I did.

I believe I wrote the code so that if that box is checked all Jmol/JSmols will load live. If it is not checked they should not load live. I am not aware of anything interacts do that should force a live load.

  • How do you turn a plot "off" if there are too many open? (Or is that not a problem like it was with the sleeping Java applets?)

Turning them off is presently not possible. For the javascript version (JSmol) I do not think it will matter as long as you do not have the ones you are not interacting with doing things that require continuous computations like spinning or running an animation (something Jmol/JSmol can do, but Sage presently does not generate the input for).

  • I see no way to get the things I used to with right-click (like stereo glasses, color, axes, whatever). Does jsmol just not have that?

Right-click still brings up a menu. For the time being I've left the default Jmol menu as it provides access to some file writing features. You were not able to get it? I'll look into that.

  • The icon for activating the plot is ... not obvious. I still really find the auto-disable piece annoying, and I know that some people have just hacked that away, though I also know I won't convince you otherwise ;-)

It is just the default image (a standard stock "play" icon) stored in the JSmol tree. If we can come up with something better it can be replaced.

  • Please remove the icons for new cells. They are cute, and probably an improvement in some ways, but it should really be orthogonal to this issue. There's enough moving parts to think about as it is. Especially since the blue bars have been the way to make new cells for many years! That's a pretty big change.

I agree that it would be nice to separate this "big" change in the interface out. Unfortunately, I really could not get the old key+click actions to work with the new jquery that is required to support JSmol. Unless somebody else can make it work without breaking JSmol these icons are going to be part of this change. I'm open to suggestions on exactly how things should look, but built it using the standard jquery-ui tools that are part of sagenb.

  • I figure out what strogdon is talking about. Try activating a jsmol, and then move it around a bit, and then try clicking in a cell *without* clicking alllll the way on the right to "lose focus" from the jsmol. (This is a problem anyway, of having to go all the way to the right to scroll - not limited to jsmol, though, threejs in the cell server has this problem as well.) You won't be able to, at least often not; you have to somehow get off focus and there is some timing delay.

I'll play with this. Haven't noticed it, at least not anymore than most GUI based software.

  • I also haven't tried all the zillions of options out there for 3d plots to see if it still obeys them all, but presumably if it's pretty similar to jmol it will do fine.

If it worked in Jmol it works in JSmol as JSmol is just just cross compiled to javascript. There have been some minor oddities, but the demands of the X-ray crystallography users are much more severe than what is usually being done here. I think Bob Hanson and the others working on the conversion between Java and Javascript have found most of problems by now. The chemistry community has been replacing java applet only versions with this for 9-12 months now.

  • Does it require WebGL turned on? I think not, but I'm not sure.

I have set it up to use HTML5 only. WebGL support exists, but has problems with transparency and other such things.

Hope this helps! Actually, it's fairly comparable to the current setup, so probably we could get it in sooner rather than later. Especially if you have any thoughts on the "viewer" thing - to me, this would be by far the easiest way to switch back and forth between functionality.

I'll keep working on this. I think if I can get it working cleanly in the GUI, it will be easy to couple it to the viewer option.

Once this has been tested enough and the "right" commits used, I think that you can just do a pull request to sagenb on github with your branch for this. Yay! Thanks for what is clearly very good hard work.

comment:33 in reply to: ↑ 32 ; follow-up: Changed 8 years ago by kcrisman

  • The load 3d live button is precisely what the doctor ordered.

Thought this is what people were asking for.

Yes, absolutely!

  • I see no way to get the things I used to with right-click (like stereo glasses, color, axes, whatever). Does jsmol just not have that?

Right-click still brings up a menu. For the time being I've left the default Jmol menu as it provides access to some file writing features. You were not able to get it? I'll look into that.

Yeah. This is on Safari 5, granted, but still... actually, it doesn't work on FF either. I don't know why, other right-clicking seems to be working fine on this computer still.

  • The icon for activating the plot is ... not obvious. I still really find the auto-disable piece annoying, and I know that some people have just hacked that away, though I also know I won't convince you otherwise ;-)

It is just the default image (a standard stock "play" icon) stored in the JSmol tree. If we can come up with something better it can be replaced.

I think that a word of some kind would be helpful. The image doesn't say much to me, while your previous "live image" or whatever made it very clear. Not everyone will mouse over that icon.

  • Please remove the icons for new cells. They are cute, and probably an improvement in some ways, but it should really be orthogonal to this issue. There's enough moving parts to think about as it is. Especially since the blue bars have been the way to make new cells for many years! That's a pretty big change.

I agree that it would be nice to separate this "big" change in the interface out. Unfortunately, I really could not get the old key+click actions to work with the new jquery that is required to support JSmol. Unless somebody else can make it work without breaking JSmol these icons are going to be part of this change. I'm open to suggestions on exactly how things should look, but built it using the standard jquery-ui tools that are part of sagenb.

Huh, that is weird. When I start actually reviewing the code changes I'll try to think about that.

Hope this helps! Actually, it's fairly comparable to the current setup, so probably we could get it in sooner rather than later. Especially if you have any thoughts on the "viewer" thing - to me, this would be by far the easiest way to switch back and forth between functionality.

I'll keep working on this. I think if I can get it working cleanly in the GUI, it will be easy to couple it to the viewer option.

That would be very good, providing all available options.

comment:34 in reply to: ↑ 33 ; follow-up: Changed 8 years ago by gutow

  • Status changed from needs_review to needs_work

Replying to kcrisman:

  • I see no way to get the things I used to with right-click (like stereo glasses, color, axes, whatever). Does jsmol just not have that?

Right-click still brings up a menu. For the time being I've left the default Jmol menu as it provides access to some file writing features. You were not able to get it? I'll look into that.

Found the problem, but it's going to be a toughy...relates to the load order of the various js files. It appears a function in jquery clobbers a JSmol function or vice-versa if we switch the load order of the two. I can either get the right-click JSmol menu working or dialogs in Sagenb. I'm consulting with the Jmol/JSmol community on this.

  • The icon for activating the plot is ... not obvious. I still really find the auto-disable piece annoying, and I know that some people have just hacked that away, though I also know I won't convince you otherwise ;-)

It is just the default image (a standard stock "play" icon) stored in the JSmol tree. If we can come up with something better it can be replaced.

I think that a word of some kind would be helpful. The image doesn't say much to me, while your previous "live image" or whatever made it very clear. Not everyone will mouse over that icon.

Actually, I think the text pops up if you mouse over the whole image. But I see your point. The idea was to make it "youtube-like".

comment:35 in reply to: ↑ 34 ; follow-up: Changed 8 years ago by kcrisman

  • I see no way to get the things I used to with right-click (like stereo glasses, color, axes, whatever). Does jsmol just not have that?

Right-click still brings up a menu. For the time being I've left the default Jmol menu as it provides access to some file writing features. You were not able to get it? I'll look into that.

Found the problem, but it's going to be a toughy...relates to the load order of the various js files. It appears a function in jquery clobbers a JSmol function or vice-versa if we switch the load order of the two. I can either get the right-click JSmol menu working or dialogs in Sagenb. I'm consulting with the Jmol/JSmol community on this.

Hmm, so the functions happen to be named the same thing?


Okay, I think that if we can fix the following in one way or another, and it otherwise it seems to handle things well, we can probably move to this:

  • Fix the clobbered function you mention above.
  • Fix or somehow make the icon here more obvious:

    Actually, I think the text pops up if you mouse over the whole image. But I see your point. The idea was to make it "youtube-like".

  • Find some resolution to the new versus old ways to get new cells, ideally using the old clicking syntax (else a major change in interface).
  • Getting viewer to work with this so we can provide jmol or jsmol.

I know dealing with these is a lot harder than it seems to me, so hopefully we can find something good. I'm going to also look into the shift-click thing for a minute in the hopes I get lucky...

Random request: In this commit it would be helpful to know which of this truly huge commit is just adding the new jquery, and what is something for Sage. There are occasional changes I couldn't figure out if they were not important or if they were quite important, and it is kind of a bomb, by necessity. So any hints on what to focus on there would be very helpful.

comment:36 in reply to: ↑ 35 Changed 8 years ago by kcrisman

  • Find some resolution to the new versus old ways to get new cells, ideally using the old clicking syntax (else a major change in

So it seems that this was just some custom thing written way back when.

Currently this stuff is in sagenb/data/jquery/plugins/extendedclick. In fact, it seems to still be there after the update as well, and it's still loaded in base.html. So maybe we can just update it for the new jquery after all...

In fact, Jason has a github repo for this! At the time he updated for a new jquery too. I did try editing things back in Safari's Firebug equivalent, but any clicking at all - even in the compute cells - yielded

TypeError: 'undefined' is not an object (evaluating 'introspect[id].before_replacing_word')

from line 23 of master.js. Not sure if this is related. Anyway, I would be very surprised if one couldn't fix this but I couldn't get the web inspector to allow me to change any of the js files, very annoying.

Or, we could perhaps use this jquery plugin or this javascript thing instead? This link seems less robust but could work too...

Last edited 8 years ago by kcrisman (previous) (diff)

comment:37 Changed 8 years ago by gutow

Random request: In ​this commit it would be helpful to know which of this truly huge commit is just adding the new jquery, and what is something for Sage. There are occasional changes I couldn't figure out if they were not important or if they were quite important, and it is kind of a bomb, by necessity. So any hints on what to focus on there would be very helpful.


I couldn't seem to update the commit message without redoing the commit. So here's the answer. That commit is just replacing all the old jquery and jquery-ui files. Nothing Sage related. I wonder if we should start handling things like that as upstream packages? A ticket in itself?

Still testing, but believe I have solved the dialog/JSmol popup conflict. There is an alternative JSmol package to avoid these kinds of problems...

Still no luck on getting the cntl-click stuff to work. I suspect it simply will require a careful rewrite of the old code. I'm not convinced that is a good use of anybody's time as we have a functional (and for novices more usable) alternative.

comment:38 Changed 8 years ago by novoselt

Just to clarify - the problems are only with the mouse use for cells, keyboard commands like Ctrl+Enter, Alt+Enter etc. are still functional, correct?

comment:39 Changed 8 years ago by kcrisman

Still no luck on getting the cntl-click stuff to work. I suspect it simply will require a careful rewrite of the old code. I'm not convinced that is a good use of anybody's time as we have a functional (and for novices more usable) alternative.

But it's backwards-incompatible, and requires rewriting of the help pages, and so forth. (The page that is linked to "Help" in the notebook.)

Just to clarify - the problems are only with the mouse use for cells, keyboard commands like Ctrl+Enter, Alt+Enter etc. are still functional, correct?

Yes, they appear to. But I don't think there is a way to get a text cell without the mouse - or is there? Also, sometimes one might not want to evaluate the current cell before inserting a new cell - and how would one get a new cell at the top of the page? Things to consider.

comment:40 Changed 8 years ago by gutow

  • Description modified (diff)

OK. I think I've fixed the following with the latest commit:

  • Restored legacy click and shift-click behavior for adding cells to worksheets. This no longer uses the old code but is modern jquery. I have not taken out the old code because I believe it is used for keyboard key combinations as well. Can somebody double check me on this. If I'm wrong we can take it out.
  • Fixed the conflict between the dialog boxes and the Jmol/JSmol popup menu.

Still to do:

  • Change icons/wording so making JSmol live is more obvious.
  • See if I can fix defaults to use wire images during rotation for faster response.
  • Should I add back the link to help for the 3D viewer?

Can anybody explain in more detail what the strange behavior with the "load live" checkbox was? Karl-Dieter, Thanks for spotting this.

comment:41 follow-ups: Changed 8 years ago by 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. When renaming the worksheet does work the Rename worksheet dialog box is partially "covered" by any graphics image in the worksheet. And by moving the dialog box around (this requires a little work) it can be made to disappear "behind" a graphics image leaving the worksheet in a "frozen" state.

comment:42 in reply to: ↑ 41 Changed 8 years ago by 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.

I am not seeing this. I'm going to need more help reproducing this.

When renaming the worksheet does work the Rename worksheet dialog box is partially "covered" by any graphics image in the worksheet. And by moving the dialog box around (this requires a little work) it can be made to disappear "behind" a graphics image leaving the worksheet in a "frozen" state.

Thanks. Got it. Had a problem with z-index settings. I will include this fix in my next commit.

comment:43 Changed 8 years ago by kcrisman

I was planning to get to this yesterday but other things intervened. So not having tried the latest commits (and it sounds like others are still coming), I think that only the icons/wording change is 100% necessary, as the js was faster with normal plot_points than I thought (still not horrible but okay), though that was not exhaustive testing.

However, if you have any way to attack the "viewer" issue to allow jmols that would be really useful.

comment:44 in reply to: ↑ 41 ; follow-up: Changed 8 years ago by 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.

comment:45 Changed 8 years ago by gutow

Note to testers. You may want to update the Jmol installation spkg #16003, because I have updated to the latest stable Jmol/JSmol and updated the popup menu to include file and image save/download from within the active 3-D view.

comment:46 Changed 8 years ago by gutow

  • Description modified (diff)

Latest commit includes fixes to hidden rename dialog, some click on image to activate instructions and some speed improvements.

There is definitely a problem with interacts that have controls below the active 3-D image. I am presently stumped as to what is going on. Any clues from what people are seeing would be welcome.

comment:47 in reply to: ↑ 44 ; follow-up: Changed 8 years ago by 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.

Last edited 8 years ago by strogdon (previous) (diff)

comment:48 in reply to: ↑ 47 ; follow-up: Changed 8 years ago by strogdon

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.

comment:49 follow-up: Changed 8 years ago by 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.

comment:50 in reply to: ↑ 49 ; follow-up: Changed 8 years ago by gutow

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.

comment:51 in reply to: ↑ 50 ; follow-up: Changed 8 years ago by kcrisman

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.

comment:52 in reply to: ↑ 51 ; follow-up: Changed 8 years ago by gutow

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?

comment:53 follow-up: Changed 8 years ago by gutow

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.

comment:54 in reply to: ↑ 52 ; follow-up: Changed 8 years ago by 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?

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 :(

comment:55 in reply to: ↑ 48 ; follow-up: Changed 8 years ago by 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?


Other comments:

  • Bar for new cells occurs TWICE between cells now - once with your little icons, and once above that. (Though that may be an artifact of something else I did.)
  • Bar color seems to have changed, and of course it's thicker.

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.

Last edited 8 years ago by kcrisman (previous) (diff)

comment:56 in reply to: ↑ 55 Changed 8 years ago by strogdon

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.

comment:57 Changed 8 years ago by strogdon

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:

  • git branch testingbranch
  • git checkout testingbranch
  • git fetch trac u/gutow/ticket/16003
  • git merge FETCH_HEAD

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.

Last edited 8 years ago by strogdon (previous) (diff)

comment:58 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:59 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:60 Changed 7 years ago by kcrisman

comment:61 in reply to: ↑ 53 ; follow-up: Changed 7 years ago by kcrisman

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 comment:24:ticket:16003, 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.

comment:62 in reply to: ↑ 61 ; follow-up: Changed 7 years ago by kcrisman

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 comment:24:ticket:16003, 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.

  • 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. It seems like https://github.com/gutow/sagenb/commit/c730aa4cf563c51e7f1f8ca92899bf515d365030 is probably most of what is needed for that - is that correct? I don't believe this commit "commits" us to javascript quite yet. (Probably we don't even need to remove a lot of those scripts either, we could just not use them...)
  • Update jquery in notebook and whatever changes need to happen with that. Several of the commits here are definitely cherry-pickable for that, I think. (This can include the live-3d checkbox, very useful.)
  • Enable/switch to js from java plots.

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.

comment:63 in reply to: ↑ 62 Changed 7 years ago by kcrisman

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.

  • It turned out I needed everything from the first two commits except the stuff specifically about the live 3d checkbox. But jmols work again with all of that. I think they are even js jmols...
  • Second (or third), live 3d checkbox.

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

  • Still needed.

Enable/switch to js from java plots.

  • Or more precisely, enable possibility of both by preference. This may end up being hard.

comment:64 in reply to: ↑ 54 Changed 7 years ago by kcrisman

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):

  • Safari 5 (old) seems to work fine
  • FF 31 seems to be ok
  • Chrome 34ish has the behavior strogdon reported.

This would be really tragic because I think we're really close here. I don't want to tell people "just don't use Chrome" since it has a large market share and has a much better reputation for compliance with standards than the also-large IE.

comment:65 Changed 7 years ago by kcrisman

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.

comment:66 follow-up: Changed 7 years ago by kcrisman

  • Cc chapoton added
  • Report Upstream changed from N/A to Reported upstream. Developers acknowledge bug.

Okay, actual status - on Mac:

  • Safari works fine. (But don't have Safari > 5 on this machine.)
  • FF works nice, but the popup menu just won't appear. (Might be a mistake I made.)
  • Chrome won't show, but the popup menu does appear.

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:

  • Fixed very small bug introduced for viewing documentation
  • Commented out widget code rather than deleted it
  • Did not add new icons etc.

so one can still use either branch for testing, and I can easily make a pull request once it's set.

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.

comment:67 in reply to: ↑ 66 Changed 7 years ago by kcrisman

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.

comment:68 Changed 7 years ago by vbraun

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.

comment:69 Changed 7 years ago by kcrisman

Oh, that would be nice.

comment:70 Changed 7 years ago by vbraun

  • Authors changed from gutow to Jonathan Gutow, Volker Braun
  • Description modified (diff)
Note: See TracTickets for help on using tickets.