Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#16004 closed enhancement (fixed)

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

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: Steven Trogdon, Karl-Dieter Crisman, Jonathan Gutow
Report Upstream: Reported upstream. Developers acknowledge bug. Work issues:
Branch: a4c94cd (Commits, GitHub, GitLab) Commit:
Dependencies: #17020 Stopgaps:

Status badges

Description (last modified by kcrisman)

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.

Attachments (3)

0001-Allow-JSmol-Jmol-drag-resizing-fix-custom-menu.patch (2.9 KB) - added by gutow 7 years ago.
patch to fix custom menu and resizing of 3-D display
0001-Add-option-to-use-java-for-3D.patch (3.0 KB) - added by gutow 7 years ago.
patch to allow user to choose Java instead of javascript for 3-D viewing
0001-text-hint-to-use-right-click-menu-on-live-3-D-applet.patch (1.2 KB) - added by gutow 7 years ago.
Here is a simple patch the makes puts up a text hing to use the right click menu when the applet is live.

Download all attachments as: .zip

Change History (155)

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 7 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 7 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 7 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 7 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 7 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 7 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 7 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 7 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 7 years ago by kcrisman (previous) (diff)

comment:56 in reply to: ↑ 55 Changed 7 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 7 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 7 years ago by strogdon (previous) (diff)

comment:58 Changed 7 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)

comment:71 Changed 7 years ago by vbraun

  • Dependencies changed from #16003 to #17020
  • Description modified (diff)

comment:72 Changed 7 years ago by vbraun

  • Description modified (diff)

comment:73 Changed 7 years ago by strogdon

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.

comment:74 Changed 7 years ago by strogdon

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)

comment:75 Changed 7 years ago by vbraun

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.

comment:76 Changed 7 years ago by gutow

  • Description modified (diff)

comment:77 Changed 7 years ago by gutow

  • Description modified (diff)

comment:78 Changed 7 years ago by kcrisman

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

Changed 7 years ago by gutow

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

Changed 7 years ago by gutow

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

comment:79 follow-up: Changed 7 years ago by gutow

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.

comment:80 Changed 7 years ago by gutow

  • Status changed from needs_work to needs_review

comment:81 Changed 7 years ago by gutow

  • Description modified (diff)

comment:82 in reply to: ↑ 79 ; follow-up: Changed 7 years ago by 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 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!

Changed 7 years ago by gutow

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

comment:83 Changed 7 years ago by gutow

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.

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

comment:84 in reply to: ↑ 82 Changed 7 years ago by gutow

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.

comment:85 Changed 7 years ago by gutow

  • Description modified (diff)

comment:86 follow-up: Changed 7 years ago by vbraun

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

comment:87 in reply to: ↑ 86 Changed 7 years ago by gutow

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

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

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

  • I don't like how you reorganized base.html, because it's harder to read the properties of the elements now.
  • I like your catch of the gettext for Typeset, assuming that is indeed translated in the localizations (it's not in message.pot, but that's probably ok).
  • You also removed a &nbsp; near there as well, and didn't put one in for the Java enabling. Maybe that should stay.
  • onchange="3D_use_java_check(this.checked);" looks nice, except there is no such function in sagenb/data/sage/js/notebook_lib.js , unlike for pretty_print_check and live_3D_check. Does it need to be added there? If not and things still work, then that line should be removed.

comment:89 follow-ups: Changed 7 years ago by kcrisman

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

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

comment:90 in reply to: ↑ 89 Changed 7 years ago by kcrisman

  • The new cell bar, when it is below a text area, does not have the icons.
  • There isn't the "evaluate" box any more either! Edit: for reasons I cannot search out now, it does appear in Chrome and FF. ???
  • Shift-Enter does not appear to work to evaluate cells. So... how does one evaluate a cell? (This is old-Safari-specific, apparently, but not great.)

All this needs to be fixed.

Other things noticed.

  • Resizing works, though it's kind of hard to "let go" of the resizing.
  • Hard to tell whether I'm using Java other than the click box. I do eventually get messages about allowing applets but don't know if it's happening.
  • In Firefox and Chrome I managed to get a cell to evaluate, but then got the immensely cryptic
    /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?)
  • In FF, right-clicking for the menu doesn't work, though it did in Safari. It does work in FF for the Java applet, not the js one.
Last edited 7 years ago by kcrisman (previous) (diff)

comment:91 Changed 7 years ago by kcrisman

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

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

comment:92 Changed 7 years ago by kcrisman

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

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

comment:93 Changed 7 years ago by kcrisman

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.

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

comment:94 follow-up: Changed 7 years ago by vbraun

Calling GraphicsFile.launch_viewer is only for commandline use.

comment:95 in reply to: ↑ 94 Changed 7 years ago by kcrisman

Calling GraphicsFile.launch_viewer is only for commandline use.

I believe you, but at any rate something is going wrong. Do you get things to show up without show(...)?

comment:96 follow-up: Changed 7 years ago by vbraun

Yes, can reproduce. Its fallout from the IPython notebook, will fix it at #17170

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

Yes, can reproduce. Its fallout from the IPython notebook, will fix it at #17170

As suspected, thanks. The other big thing is then figuring out what the heck is going wrong with my Safari - it is an older one that github doesn't like, true, but our javascript hasn't changed that much! The other things hopefully can be fixed fairly easily for the new cell logic.

comment:98 in reply to: ↑ 97 Changed 7 years ago by kcrisman

As suspected, thanks. The other big thing is then figuring out what the heck is going wrong with my Safari - it is an older one that github doesn't like, true, but our javascript hasn't changed that much!

I must be going crazy, because now it is working again. ???

comment:99 in reply to: ↑ 89 Changed 7 years ago by kcrisman

Now all of a sudden this is working after all, which makes sense because https://github.com/vbraun/sagenb/commit/f9760a8635a63511731e340046711b1a7288de1c is there.

  • The new cell bar, when it is above a text area, does not have the icons. In such cases, it also does not work.

I think this is probably due to not having changed sagenb/data/sage/html/notebook/text_cell.html in the relevant commits https://github.com/vbraun/sagenb/commit/8fe8371b93112d29a4096307d5807d736c41e415 and https://github.com/vbraun/sagenb/commit/2757d2c6b488feeae2a3f97fffdd09f7ffe5ef01 Naturally, one would also have to do the thing to fix shift-click in that spot as well.

comment:100 Changed 7 years ago by gutow

  • Description modified (diff)

comment:101 Changed 7 years ago by gutow

I pushed my three patches to the repository, so those should no longer need to be manually installed. I am looking into Karl-Dieter's problems. I hadn't doubled checked the back compatible stuff.

comment:102 follow-up: Changed 7 years ago by gutow

Testing in my version, which is now synced to Volker's repository:

  1. shift-click works everywhere in FF and chromium (linux chrome)
  2. cntrl-click works everywhere in FF and chromium
  3. clicking on the two new cell icons works everywhere in FF and chromium
  4. right-click JSmol popup works in FF and chromium
  5. right-click Jmol popup works in FF, cannot test chromium as it does not support java plugin anymore.
  6. The evaluate button always shows up for me. Occasionally, I have seen issues with interacts covering the evaluate button, but it reappears after clicking around. I have not been able to reproduce it reliably.

Although I have a lot of Macs, I do not think I have an old enough safari to reproduce the "old" problems on. For the above items I am not seeing problems so am unable to do anything to fix them. Please verify which ones are still problems.

comment:103 in reply to: ↑ 88 Changed 7 years ago by gutow

Replying to kcrisman:

  • onchange="3D_use_java_check(this.checked);" looks nice, except there is no such function in sagenb/data/sage/js/notebook_lib.js , unlike for pretty_print_check and live_3D_check. Does it need to be added there? If not and things still work, then that line should be removed.

The function is now in jmol_lib.js. I did not put it in the notebook_lib.js because this function does not need to talk to the server. Since the choice to use java needs to be decided in realtime by the user because of how browser and computer dependent it is, the setting is not a sticky.

comment:104 in reply to: ↑ 102 Changed 7 years ago by kcrisman

Testing in my version, which is now synced to Volker's repository:

Thanks for this!

Although I have a lot of Macs, I do not think I have an old enough safari to reproduce the "old" problems on. For the above items I am not seeing problems so am unable to do anything to fix them. Please verify which ones are still problems.

Can you confirm that the things that work above for you on FF/Chromium also work for some version >= 6 of Safari? I think that is what you are saying.

comment:105 follow-ups: Changed 7 years ago by kcrisman

Let me try to summarize what probably still remains, assuming I also have luck with the most up-to-date repo when I can get to this Mondayish. These are obviously fairly minor compared to the display hook thing (thanks for fixing that so quickly!), but they worked in my branch.

  • &nbsp; removal
  • hardcoded Jmol version is still 14.0.13
  • The new cell bar, when it is above a text area, does not work and has no icons. It should also have the custom ctrl/shift-click code from other patches added to it.
  • The new cell bar is not quite at the right indentation level (div?) at the very end of the worksheet
  • Color of new cell bar should go back.
  • The js in comment:91 should be fixed so that it only applies to the pop out introspection. You can check this by clicking the "pop to own window" and it won't do what it is supposed to.

By the way, what is ctrl-click supposed to do on a new cell bar? I must have forgotten this feature!

Version 0, edited 7 years ago by kcrisman (next)

comment:106 in reply to: ↑ 105 ; follow-up: Changed 7 years ago by gutow

Replying to kcrisman:

Let me try to summarize what probably still remains, assuming I also have luck with the most up-to-date repo when I can get to this Mondayish. These are obviously fairly minor compared to the display hook thing (thanks for fixing that so quickly!), but they worked in my branch.

  • &nbsp; removal (or rather, unremoval)

This is just for layout with the checkboxes. I didn't find having it missing making an obvious layout difference, but we can put it back in.

  • hardcoded Jmol version is still 14.0.13

I will have to dig into Jmol for this. It is supposed to pick up the version, which can be shown to be correct in the console by selecting the "State". This is an upstream bug, although I might be able to patch it here.

  • The new cell bar, when it is above a text area, does not work and has no icons. It should also have the custom ctrl/shift-click code from other patches added to it.

Now I understand. We need to add a new cell bar above new rich text boxes. I completely missed that.

  • The new cell bar is not quite at the right indentation level (div?) at the very end of the worksheet

hmmm, I'll look at that.

  • Color of new cell bar should go back.

Are you saying the highlighting doesn't disappear when you stop hovering over the new cell bar? That may be a browser bug. I will look at it again.

  • The js in comment:91 should be fixed so that it only applies to the pop out introspection. You can check this by clicking the "pop to own window" and it won't do what it is supposed to.

Not sure what the "pop to own window" is. I know we used to have a link for that, but it should be gone along with all the fancier controls, they still need rewriting.

By the way, what is ctrl-click supposed to do on a new cell bar? I must have forgotten this feature!

shift-click = new rich text cell cntrl-click = new calculation cell

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

  • The new cell bar, when it is above a text area, does not work and has no icons. It should also have the custom ctrl/shift-click code from other patches added to it.

Now I understand. We need to add a new cell bar above new rich text boxes. I completely missed that.

Ok. I should point out that there IS a new cell bar, but it doesn't have the icons and doesn't do anything if you click on it. Try a worksheet with some already-existing text cells and some computation cells, and you'll see what I mean when you hover in various places.

  • Color of new cell bar should go back.

Are you saying the highlighting doesn't disappear when you stop hovering over the new cell bar? That may be a browser bug. I will look at it again.

No, I mean that you changed the color of the bars for some reason. See my previous comments. If you look at my branch you can see I remove your mysterious change to cyan and put it back to the usual color.

  • The js in comment:91 should be fixed so that it only applies to the pop out introspection. You can check this by clicking the "pop to own window" and it won't do what it is supposed to.

Not sure what the "pop to own window" is. I know we used to have a link for that, but it should be gone along with all the fancier controls, they still need rewriting.

Nothing to do with jmol. If you do binomial? or something like that, you will see the "introspection" documentation; there should be a link to click to "pop out" that into a separate window, and there are a few subtle things about that that don't work if you don't change that. Look at the specific code I'm talking about - you changed it when you updated to modern jQuery, but unfortunately put in commas that didn't belong. Just take my code :-)

By the way, what is ctrl-click supposed to do on a new cell bar? I must have forgotten this feature!

shift-click = new rich text cell cntrl-click = new calculation cell

Huh. Doesn't also just plain old clicking (no other keys) make a new calculation cell? Or maybe I'm misunderstanding something here.

comment:108 in reply to: ↑ 107 ; follow-up: Changed 7 years ago by gutow

Replying to kcrisman:

Ok. I should point out that there IS a new cell bar, but it doesn't have the icons and doesn't do anything if you click on it.

Yep, it didn't do anything because it had the old non-jquery compatible code in it. I have a fix for that and will commit it before the end of the weekend. I can also tell you that the end of sheet new cell bar is indented differently because it is not part of the worksheet cell list. It has the same indentation as rich text cells. If it is really bothersome, I can place the icons over a little, but we do not want that cell to be part of the cell list.

While working on this I also realized there is no way to delete rich text cells. Any thoughts on whether that is something we want? If so, it should be its own ticket.

No, I mean that you changed the color of the bars for some reason. See my previous comments. If you look at my branch you can see I remove your mysterious change to cyan and put it back to the usual color.

hmm, I'm not sure why I changed it. Maybe I couldn't find the right color. We certainly can pull it from your branch.

Nothing to do with jmol. If you do binomial? or something like that, you will see the "introspection" documentation; there should be a link to click to "pop out" that into a separate window, and there are a few subtle things about that that don't work if you don't change that. Look at the specific code I'm talking about - you changed it when you updated to modern jQuery, but unfortunately put in commas that didn't belong. Just take my code :-)

OK, I'm not sure why that comma is there either.

Huh. Doesn't also just plain old clicking (no other keys) make a new calculation cell? Or maybe I'm misunderstanding something here.

Looking at the code any click other than shift-click creates a new compute cell. This kind of confusion is why I like the little icons.:)

comment:109 Changed 7 years ago by gutow

Pushed following fixes to Volker's git repository: Reverted new cell div hover color to old color Added &nbsp; before text of display control checkboxes Made add cell work before above rich text cells Removed commas that were messing up jquery binding to certain items

Test and let me know what else you find...

comment:110 in reply to: ↑ 105 Changed 7 years ago by gutow

Replying to kcrisman:

  • hardcoded Jmol version is still 14.0.13

This is a bug in 14.2.4. It appears to be fixed in 14.2.7. We can make a new spkg. Doesn't look like the static image for java fix is in 14.2.7 yet, so we will have to wait on that.

comment:111 Changed 7 years ago by gutow

Pushed a commit to #17020 that should fix the version number issue in the popup menus, independent of Jmol/JSmol version.

comment:112 in reply to: ↑ 108 Changed 7 years ago by kcrisman

Yep, it didn't do anything because it had the old non-jquery compatible code in it. I have a fix for that and will commit it before the end of the weekend.

Great, I'll look at that today.

I can also tell you that the end of sheet new cell bar is indented differently because it is not part of the worksheet cell list. It has the same indentation as rich text cells. If it is really bothersome, I can place the icons over a little, but we do not want that cell to be part of the cell list.

Got it, that makes sense.

While working on this I also realized there is no way to delete rich text cells. Any thoughts on whether that is something we want? If so, it should be its own ticket.

Hmm, you can't delete them, it's true, but save+quit+open actually gets rid of such cells if they are empty, due to the way sagenb handles that internally, no worries.

Looks like you got the other stuff on my list (or explained it). I would personally not worry about waiting for the static image for java fix if the js version is the default...

comment:113 Changed 7 years ago by kcrisman

I'm going to continue discussion on the pull request since we are so close now.

comment:114 Changed 7 years ago by kcrisman

  • Description modified (diff)
  • Reviewers set to Steven Trogdon, Karl-Dieter Crisman, Jonathan Gutow

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

I think we really need more reviewers now at the pull request.

On a likely related note, I think the following is due to the changes here. Any ideas?

  • If you make a standard 2d plot like plot(1-x,(x,0,1)), evaluate, and then go back to that same cell and change it to something else like plot(1-x^2,(x,0,1)), the graphic changes. But:
  • Try doing a Jsmol, and then try changing *that* notebook cell and re-evaluating. If you don't have the "Load 3D Live" checkbox clicked, you'll think you changed it - but you didn't! As soon as you make it live, it's the exact same one as before. If you have the live checkbox clicked (this refers to #16004, for those who come new to this) then this is quite obvious.

If it helps, the filenames are definitely changing:

$ ls .sage/sage_notebook.sagenb/home/admin/264/cells/82
sage0-size500-155928955.jmol.zip	sage0-size500.jmol
$ ls .sage/sage_notebook.sagenb/home/admin/264/cells/82
sage0-size500-938371752.jmol.zip	sage0-size500.jmol
$ ls .sage/sage_notebook.sagenb/home/admin/264/cells/82
sage0-size500-522166844.jmol.zip	sage0-size500.jmol
$ ls .sage/sage_notebook.sagenb/home/admin/264/cells/82
sage0-size500-996347389.jmol.zip	sage0-size500.jmol

but I suspect that something is not being overwritten somewhere.

comment:116 Changed 7 years ago by gutow

No ideas on the above, since I do not see the problem in my build. I am running the latest commits, but am not sure from the discussions on the pull list if you have some other commits from different branches.

comment:117 in reply to: ↑ 115 Changed 7 years ago by gutow

Replying to kcrisman:

On a likely related note, I think the following is due to the changes here. Any ideas?

but I suspect that something is not being overwritten somewhere.

Is it possible you are running into overzealous caching? The change in file name should fix that. Is the file name changing in the html on your page? If not your browser is not updating the page.

comment:118 Changed 7 years ago by gutow

Ha! I just got it to happen...Now if I can only figure out what I did!

comment:119 follow-up: Changed 7 years ago by gutow

OK, I'm almost sure it is a caching issue. I think we are being bitten by something I've wanted to rewrite for a while. In addition to the data file, Sage writes a custom Jmol script to launch the display. I think we could avoid using it, but I've tried to change as little as possible to maintain backwards compatibility. Anyway, I don't think this is a new bug. The script is not given a unique name, so we are picking up the one from the cache. I will see if the simple fix of providing a unique name will work. Ultimately that script file should go and we should just make a ".jmol" file.

comment:120 in reply to: ↑ 119 Changed 7 years ago by kcrisman

OK, I'm almost sure it is a caching issue.

I just tried this as well and I think I agree with you. But it's completely pervasive for me, even interacts are now no longer working properly. I get it now consistently in Safari, FF, but not Chrome. At least, not on the js, though on the java it seems to still happen. (Clearing cache in Chrome is particularly annoying with the Java because it also logs me out of Sage as you have to clear plugins and cookies together, can't only clear plugins.)

Anyway, I don't think this is a new bug.

Perhaps, but I think I would have noticed this if it was common before. I can't get it to not happen in FF and Safari right now :(

The script is not given a unique name, so we are picking up the one from the cache. I will see if the simple fix of providing a unique name will work.

Well, that would be nice. Sometimes programming even does have nice solutions - let's hope. Thanks very much for looking into this.

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

More info. Clicking on the js console gives

FileManager opening 1 http://localhost:8080/home/admin/302/cells/1/sage0-size500.jmol
FileManager opening 3 http://localhost:8080/home/admin/302/cells/1/sage0-size500-184635879.jmol.zip|SCRIPT
FileManager opening 1 http://localhost:8080/home/admin/302/cells/1/sage0-size500-184635879.jmol.zip
The Resolver thinks Xyz
reading 10 atoms
ModelSet: haveSymmetry:false haveUnitcells:false haveFractionalCoord:false
1 model in this collection. Use getProperty "modelInfo" or getProperty "auxiliaryInfo" to inspect them.
Default Van der Waals type for model set to Babel
10 atoms created
ModelSet: autobonding; use autobond=false to not generate bonds automatically
no data
pmesh obj_729730 "obj_729730.pmesh";
reading isosurface data from http://localhost:8080/home/admin/302/cells/1/sage0-size500-184635879.jmol.zip|obj_729730.pmesh
FileManager opening 3 http://localhost:8080/home/admin/302/cells/1/sage0-size500-184635879.jmol.zip|obj_729730.pmesh
FileManager opening 1 http://localhost:8080/home/admin/302/cells/1/sage0-size500-184635879.jmol.zip

But

$ cd .sage/sage_notebook.sagenb/home/admin/302/cells/1
$ ls
sage0-size500-508165167.jmol.zip	sage0-size500.jmol

So the old 1846... isn't even in the directory! Is it in the .jmol file? What role does that file even play?


Another thing I'm noticing is that, in the past, I thought one could only discard changes since the last cell evaluation, which sort of automatically saved. But for some reason now "discard changes" seems to discard ALL changes since the last save. I can't see now how any of this could be responsible for that, but I am going to have to confirm that this is either prior behavior (which I don't buy) or unrelated (which I hope).

comment:122 in reply to: ↑ 121 Changed 7 years ago by kcrisman

Another thing I'm noticing is that, in the past, I thought one could only discard changes since the last cell evaluation, which sort of automatically saved. But for some reason now "discard changes" seems to discard ALL changes since the last save. I can't see now how any of this could be responsible for that, but I am going to have to confirm that this is either prior behavior (which I don't buy) or unrelated (which I hope).

Yikes, this is actual behavior. I mean, it's consistent, but scary without autosave... I don't know how I ever didn't notice this before. Save often!

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

Jonathan, try this.

  • sagenb/notebook/cell.py

    diff --git a/sagenb/notebook/cell.py b/sagenb/notebook/cell.py
    index 7c322c9..d0ce526 100755
    a b class Cell(Cell_generic): 
    23502350            <div id="loadJmol" style="display:none;">{id}</div>
    23512351            <div id="sage_jmol_size_{id}" style="display:none;">{size}</div>
    23522352            <div id="sage_jmol_img_{id}" style="display:none;">{image_name}.png?{timestamp}</div>
    2353             <div id="sage_jmol_script_{id}" style="display:none;">{filename}</div>
     2353            <div id="sage_jmol_script_{id}" style="display:none;">{filename}?{timestamp}</div>
    23542354            <div id="sage_jmol_server_url_{id}" style="display:none;">{callback}</div>
    23552355            <div id="sage_jmol_status_{id}" style="display:none;">notActivated</div>
    23562356        </div>

I think that the source of this is this commit where the ?time.time() was inadvertently removed in an otherwise-useful refactoring.

comment:124 in reply to: ↑ 123 Changed 7 years ago by kcrisman

Jonathan, try this.

Yeah, this simple change back to your original code intent reliably fixes the problem for me (undoing it causes the problem again).

Aagh! But it seems to break Chrome for some reason.

Error connecting to server: /home/admin/302/jsmol?call=getRawDataFromDatabase&database=_&query=http%3A%2F%2Flocalhost%3A8080%2Fhome%2Fadmin%2F302%2Fcells%2F1%2Fsage0-size500.jmol%3F1413900723.07&encoding=base64

and an error message logged

exceptions.IOError: [Errno 2] No such file or directory: u'/Users/.../.sage/sage_notebook.sagenb/home/admin/302/cells/1/sage0-size500.jmol1413900723.07

So maybe you are right and we have to actually change the name of the script as such. But I don't want to do that in the Sage library for 3d graphics any more, so I'll try to figure out if we can dynamically do it in the file cell.py.

comment:125 Changed 7 years ago by kcrisman

Okay, this much more hackish code does seem to work properly, including dealing with reloading pages with old files, etc.

  • sagenb/notebook/cell.py

    diff --git a/sagenb/notebook/cell.py b/sagenb/notebook/cell.py
    index 7c322c9..20ea9c1 100755
    a b class Cell(Cell_generic): 
    23332333        #
    23342334        # So we need to prepend the worksheet URL, in order
    23352335        # for the zip to be accessed correctly.
     2336        jmol_name = os.path.join(self.directory(), F)
    23362337        if self.worksheet().docbrowser():
    2337             jmol_name = os.path.join(self.directory(), F)
    23382338            with open(jmol_name, 'r') as f:
    23392339                jmol_script = f.read()
    23402340            jmol_script = jmol_script.replace(
    class Cell(Cell_generic): 
    23432343            with open(jmol_name, 'w') as f:
    23442344                f.write(jmol_script)
    23452345
     2346        F_time = F.replace('.jmol','-{}time.jmol'.format( time.time() ))
     2347        jmol_name_time = os.path.join(self.directory(), F_time)
     2348        shutil.copy2(jmol_name, jmol_name_time)
     2349
    23462350        image_name = os.path.join(self.url_to_self(),'.jmol_images',F)
    2347         script_name = os.path.join(self.url_to_self(), F)
     2351        script_name = os.path.join(self.url_to_self(), F_time)
    23482352        return textwrap.dedent("""
    23492353        <div id="sage_jmol_{id}" class="3DPlotDiv">
    23502354            <div id="loadJmol" style="display:none;">{id}</div>
    class Cell(Cell_generic): 
    24232427                pass # obj data
    24242428            elif F.endswith('.svg'):
    24252429                images.append('<embed src="%s" type="image/svg+xml" name="emap">' % url)
     2430            elif F.endswith('time.jmol'):
     2431                pass
    24262432            elif F.endswith('.jmol'):
    24272433                images.append(self._jmol_files_html(F))
    24282434                jmolimagebase = F

But I'd much rather hear that there is a way to make Chrome like the ? syntax for the script and not just the graphic.

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

Here is at least one piece of the problem, in the file sagenb/flask_version/worksheet.py:

filename = match.group('filename')
filename = secure_filename(filename) # never trust input

This removes the ? without the rest.

Interestingly, one reason this happens at all is because only Chrome goes through this URI

@worksheet_command('jsmol')
def worksheet_jsmol_data(worksheet):

as far as I can tell. I have no idea why the others don't.

Anyhow, maybe this updated version of the first diff would work.

  • sagenb/flask_version/worksheet.py

    diff --git a/sagenb/flask_version/worksheet.py b/sagenb/flask_version/worksheet.py
    index 40c3d54..fd0dcf2 100644
    a b def worksheet_jsmol_data(worksheet): 
    695695            return current_app.message(_('Invalid JSmol query: ' + query))
    696696        cell_id = match.group('cell_id')
    697697        filename = match.group('filename')
     698        filename = filename.rsplit('?',1)[0] # appended query is only for cache busting
    698699        filename = secure_filename(filename)   # never trust input
    699700        filename = os.path.join(worksheet.cells_directory(), cell_id, filename)
    700701        with open(filename, 'r') as f:
  • sagenb/notebook/cell.py

    diff --git a/sagenb/notebook/cell.py b/sagenb/notebook/cell.py
    index 7c322c9..d0ce526 100755
    a b class Cell(Cell_generic): 
    23502350            <div id="loadJmol" style="display:none;">{id}</div>
    23512351            <div id="sage_jmol_size_{id}" style="display:none;">{size}</div>
    23522352            <div id="sage_jmol_img_{id}" style="display:none;">{image_name}.png?{timestamp}</div>
    2353             <div id="sage_jmol_script_{id}" style="display:none;">{filename}</div>
     2353            <div id="sage_jmol_script_{id}" style="display:none;">{filename}?{timestamp}</div>
    23542354            <div id="sage_jmol_server_url_{id}" style="display:none;">{callback}</div>
    23552355            <div id="sage_jmol_status_{id}" style="display:none;">notActivated</div>
    23562356        </div>

Try one or all of these out.

comment:127 Changed 7 years ago by kcrisman

For positive review, I think here is what we still need.

Then I think we need to really push it into a new package for upstream so that it can be tested thoroughly. Depending on where Volker is in the release process, maybe the first beta of the next one, or in the current beta series.

comment:128 in reply to: ↑ 126 ; follow-up: Changed 7 years ago by gutow

(+1) This last patch works for me on FF/linux and is reasonably simple.

Anyhow, maybe this updated version of the first diff would work.

  • sagenb/flask_version/worksheet.py

    diff --git a/sagenb/flask_version/worksheet.py b/sagenb/flask_version/worksheet.py
    index 40c3d54..fd0dcf2 100644
    a b def worksheet_jsmol_data(worksheet): 
    695695            return current_app.message(_('Invalid JSmol query: ' + query))
    696696        cell_id = match.group('cell_id')
    697697        filename = match.group('filename')
     698        filename = filename.rsplit('?',1)[0] # appended query is only for cache busting
    698699        filename = secure_filename(filename)   # never trust input
    699700        filename = os.path.join(worksheet.cells_directory(), cell_id, filename)
    700701        with open(filename, 'r') as f:
  • sagenb/notebook/cell.py

    diff --git a/sagenb/notebook/cell.py b/sagenb/notebook/cell.py
    index 7c322c9..d0ce526 100755
    a b class Cell(Cell_generic): 
    23502350            <div id="loadJmol" style="display:none;">{id}</div>
    23512351            <div id="sage_jmol_size_{id}" style="display:none;">{size}</div>
    23522352            <div id="sage_jmol_img_{id}" style="display:none;">{image_name}.png?{timestamp}</div>
    2353             <div id="sage_jmol_script_{id}" style="display:none;">{filename}</div>
     2353            <div id="sage_jmol_script_{id}" style="display:none;">{filename}?{timestamp}</div>
    23542354            <div id="sage_jmol_server_url_{id}" style="display:none;">{callback}</div>
    23552355            <div id="sage_jmol_status_{id}" style="display:none;">notActivated</div>
    23562356        </div>

comment:129 in reply to: ↑ 128 Changed 7 years ago by kcrisman

(+1) This last patch works for me on FF/linux and is reasonably simple.

Okay, that is good. I'll try to push something along these lines tonight.

If you can take a look at the CSS change stuff and possibly merge that in, then we are quite close.

comment:130 Changed 7 years ago by kcrisman

I ended up making a mess of the commit history but merged both of these things in this morning. So shortly we should merge them to sagenb, and then try to make a package for this ticket - assuming #16911 gets in first, which it definitely should.

comment:131 Changed 7 years ago by gutow

OK, I'm now synced with the new_jmol repository and everything looks OK. Are we at the positive review stage? I think I checked carefully that all of Karl-Dieter's css changes went into both the scss and the css.

comment:132 Changed 7 years ago by kcrisman

Yeah, I can't think of anything else. All your browsers work nicely?

In that case, I will merge that WHOLE pull request, with all its ugly extra commits, and then ask ppurka if we can get a new sagenb package. (I haven't really checked into how to do that yet.) It would wait until after #16911 but then hopefully we can get a nice good period of testing in with whatever beta it gets merged into.

Thanks in advance for all your very good work on this; to ask a chemist to write tons of javascript and html for mathematics is a bit above the call of duty :)

comment:133 Changed 7 years ago by kcrisman

  • Status changed from needs_review to needs_work

Needs a package of course, so 'needs work'.

comment:134 Changed 7 years ago by kcrisman

  • Branch set to u/kcrisman/jsmolsagenb
  • Commit set to c5354abd32c0f396ab06a46a4141e77ce487eb8e

New commits:

c5354abUpgrade sagenb to version 0.11.0

comment:135 Changed 7 years ago by kcrisman

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

Ready to try out!

comment:136 Changed 7 years ago by vbraun

  • Branch changed from u/kcrisman/jsmolsagenb to u/vbraun/jsmolsagenb

comment:137 follow-up: Changed 7 years ago by vbraun

  • Commit changed from c5354abd32c0f396ab06a46a4141e77ce487eb8e to a4c94cd49e564f339ca64729cc579365aa945812

Fixed the obvious conflict with #16911


New commits:

2d3d3e9update sagenb developer guide with new dev instructions
fe9630cupdate sagenb version and checksum
b84d502Update checksums for sagenb 0.10.8.3
a4c94cdMerge #16911

comment:138 in reply to: ↑ 137 Changed 7 years ago by kcrisman

  • Description modified (diff)

Fixed the obvious conflict with #16911

Oh, duh. I'll also mention that in the instructions, why I didn't think about this who knows...

comment:139 follow-up: Changed 7 years ago by strogdon

Aside from the "annoying" DEBUG/JSmol stuff that's dumped to the spawning terminal when one clicks on a 3-D image from Chromium, this looks really slick. I don't know of all the corner cases to test but from what I see, it has my thumbs up!

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

Aside from the "annoying" DEBUG/JSmol stuff that's dumped to the spawning terminal when one clicks on a 3-D image from Chromium,

As Volker pointed out in comment:75, the level is not due to anyone here... though probably it could be removed. What is interesting is that it does verify that only Chrome/Chromium? actually use that branch, for reasons I cannot fathom.

this looks really slick. I don't know of all the corner cases to test but from what I see, it has my thumbs up!

Awesome!

(Does the worksheet revision history work properly for you now as well? You may need to hard remove some cache for that to work, depending.)

comment:141 in reply to: ↑ 140 ; follow-up: Changed 7 years ago by strogdon

Replying to kcrisman:

(Does the worksheet revision history work properly for you now as well? You may need to hard remove some cache for that to work, depending.)

Yes, this does work here. I hadn't noticed that feature.

comment:142 in reply to: ↑ 141 Changed 7 years ago by kcrisman

(Does the worksheet revision history work properly for you now as well? You may need to hard remove some cache for that to work, depending.)

Yes, this does work here. I hadn't noticed that feature.

Good. You hadn't noticed it because it has been broken for years - and for a very stupid reason, really almost a trivial one.

comment:143 Changed 7 years ago by kcrisman

  • Cc no voselt added; novoselt removed

Volker, Jonathan - what else do you think we need for positive review? I think we've had quite a bit of independent looking at it. Andrey has promised to test once it's in beta as well...

comment:144 Changed 7 years ago by kcrisman

  • Cc novoselt added; no voselt removed

Aargh, mangled Andrey's name... don't know how that happened.

comment:145 Changed 7 years ago by vbraun

looks good to me.

comment:146 Changed 7 years ago by kcrisman

  • Status changed from needs_review to positive_review

comment:147 Changed 7 years ago by kcrisman

Great!

Just a request to release manager to make sure there is enough time for people to find any surprises in this in testing - better an early beta than an rc, anyway, though naturally sooner is better.

comment:148 Changed 7 years ago by vbraun

  • Branch changed from u/vbraun/jsmolsagenb to a4c94cd49e564f339ca64729cc579365aa945812
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:149 follow-up: Changed 7 years ago by novoselt

  • Commit a4c94cd49e564f339ca64729cc579365aa945812 deleted

For me both JS and Java do not support transparency while spinning either manually or automatically (surfaces turn to completely opaque). Is this the expected behaviour now??? One of the major problems with three.js is its handling of transparency and jmol always was great in it.

comment:150 in reply to: ↑ 149 Changed 7 years ago by gutow

Replying to novoselt:

For me both JS and Java do not support transparency while spinning either manually or automatically (surfaces turn to completely opaque). Is this the expected behaviour now??? One of the major problems with three.js is its handling of transparency and jmol always was great in it.

This is an adjustable setting. Rotation speeds are much improved with transparency and some other display improvements off. Thus I set the default to get better responsiveness out of the javascript application. If you really need the transparency open the console and give the command "set platformspeed=10". That should maintain the transparency. It will probably be acceptable in Java (If people want it we could make that the java default), but unless computers get faster or javascript gets compiled the performance probably will be too slow in javascript for all but simple surfaces.

comment:151 Changed 7 years ago by gutow

Note: set platformspeed=7 maintains transparency without an awful hit to rotation speed and responsiveness in javascript. This is probably something we should open a separate ticket on as this is a minor adjustment and people will need to test on lots of machines to decide what is acceptable.

comment:152 Changed 7 years ago by kcrisman

Hmm, interesting points. Where is this platformspeed stuff documented? (I'd do a search for it but apparently Jmol's doc is often somewhat dated...) I think that maintaining transparency is a very important thing. This is now #17292.

Note: See TracTickets for help on using tickets.