Re: [Jmol-users] communication between frames/windows

2015-09-01 Thread Angel Herráez
One of the problems with frames seems to be the timing when the Jmol 
global object and the particular JSmol object are created in each frame.
For example, when using commands like Jmol.jmolButton in the text frame it 
fails to create the button because the JSmol object in the other frame is not 
yet there. Reloading the text frame once I can see the JSmol panel makes 
the button show up, but it is not operative, for whatever reason.

Some testing
http://biomodel.uah.es/angel/frames/frameset1.htm
suggests that you can only use Jmol.script, which is triggered by the user 
and so the JSmol object has had time to be generated.

Finally, I found a workaround by redefining the old jmolButton function, so it 
will insert an  that will run a Jmol.script command
See the url above for hints



--
___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] communication between frames/windows

2015-09-01 Thread Angel Herráez




(sorry for possible duplicates; my outgoing mail server is having a bad time today)




Hi Eran

Others seem to hae succeeded with this, but I had to give up trying to use frames in 
my pages when I updated them to JSmol. I guess it depends on the complexity of the 
code in the controls, and maybe their layout.

In any case, you'd need to provide an example page if we are to research this. I'll be 
glad to have a look.


  




WPM$7ZX5.PM$
Description: Mail message body
--
___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] Jmol array to Javascript?

2015-09-01 Thread Eric Martz

Thanks, Bob,

OK, part of my problem is probably asynchrony.

In Javascript, I am doing

  jmolScript('altlocpivot = {altloc!=""}.altloc.all.pivot;' +
  'altlocpivotkeys = altlocpivot.keys;');

then

  altLocKeys = Jmol.evaluateVar(jmolApplet0, "altlocpivotkeys");
  alert(altLocKeys.length +" "+typeof(altLocKeys)+"\n"+altLocKeys);

The first time I load the browser, the alert reports a zero length string.
But if I click the alert again, I get the length 3 array.

Is there some way, from Javascript, to force the Jmol variables to be 
defined before the Jmol.evaluateVar() takes place?




On 9/1/15 7:10 PM, Robert Hanson wrote:

x = Jmol.evaluateVar(jmolApplet0, "altlocpivotkeys")


On Tue, Sep 1, 2015 at 5:58 PM, Eric Martz > wrote:


I have not been able to figure out how to get an array from Jmol
applet into a Javascript array. For example, in the Jmol applet, I
create a Jmol array:

(Jmol applet contains 1bsz)
(Jmol applet output in red)

altlocpivot = {altloc!=""}.altloc.all.pivot;
altlocpivotkeys = altlocpivot.keys;
print altlocpivotkeys.type
array
print altlocpivotkeys
  A
  B
  C

Now I want to get altlocpivotkeys into Javascript as an array.
Perhaps something like

x = getPropertyAsArray(jmolApplet0, "variableInfo altlocpivotkeys")

(But Jmol says "getProperty ERROR". I think that I haven't been
able to guess the syntax to specify the variable name. There is no
example in the documentation.)

With success, I am expecting the result in Javascript to be the
equivalent of
x = ["A", "B", "C"];
so that
x.length is 3
x[1] is "B"

Any help welcome.
Thanks, Eric


--

___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/jmol-users




--
Robert M. Hanson
Larson-Anderson Professor of Chemistry
Chair, Department of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr


If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900



--


___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


--
___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] Jmol -- testing requested (move)

2015-09-01 Thread Robert Hanson
It's a bug. The MOVE command does do different things than the MOVETO
command; the idea is that for general work MOVETO is more capable, but the
effects are definitely different.

On Tue, Sep 1, 2015 at 8:36 AM, Rolf Huehne  wrote:

> On 08/25/2015 04:28 PM, Robert Hanson wrote:
> > OK, let's try again, please. I really appreciate all this testing. Rolf,
> I
> > am especially interested in if this fixes your JenaLib startup problem.
> >
> The 'move' command doesn't do anything if the time is set to zero, e.g.:
>move 180 0 0 0 0 0 0 0 0;
>
> This used to work in version 11.8.8, which we are still using for the
> automatic image generation for the 'JenaLib'. This behaviour might have
> been introduced already in version 12.x. At least I remember that we
> never upgraded the Jmol version in conjunction with the 'Jena3D Viewer'
> because the images created with newer versions were different. And since
> upgrading wasn't really necessary until now I never took the time to
> really investigate it.
>
> Even if the time is set to 0.1 seconds, the images from version 11.8.8
> and 14.3.16_2015.08.25 (both with 'set perspectivemodel 11;') don't look
> identical.
>
> The scripting documentation says that 'move' has been superseded by
> 'moveto', but I couldn't figure out how to achieve relative rotations
> (like 'move' does them) with 'moveto'. I could only get absolute
> rotations with it.
> Even if it might be possible, the 'move' command seems to be much less
> complicated to use for 'relative' movements than 'moveto'. So I would
> rather not regard it as "superseded" by it.
>
> Regards,
> Rolf
>
> --
>
> Rolf Huehne
> Postdoc
>
> Leibniz Institute for Age Research - Fritz Lipmann Institute (FLI)
> Beutenbergstrasse 11
> 07745 Jena, Germany
>
> Phone:   +49 3641 65 6205
> Fax: +49 3641 65 6210
> E-Mail:  rhue...@fli-leibniz.de
> Website: http://www.fli-leibniz.de
>
>Scientific Director: Prof. Dr. K. Lenhard Rudolph
> Head of Administration: Dr. Daniele Barthel
> Chairman of Board of Trustees: Dennys Klein
>
> VAT No: DE 153 925 464
> Register of Associations: No. 230296, Amtsgericht Jena
> Tax Number: 162/141/08228
>
>
>
> --
> ___
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>



-- 
Robert M. Hanson
Larson-Anderson Professor of Chemistry
Chair, Department of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr


If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
--
___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] Jmol array to Javascript?

2015-09-01 Thread Robert Hanson
x = Jmol.evaluateVar(jmolApplet0, "altlocpivotkeys")


On Tue, Sep 1, 2015 at 5:58 PM, Eric Martz 
wrote:

> I have not been able to figure out how to get an array from Jmol applet
> into a Javascript array. For example, in the Jmol applet, I create a Jmol
> array:
>
> (Jmol applet contains 1bsz)
> (Jmol applet output in red)
>
> altlocpivot = {altloc!=""}.altloc.all.pivot;
> altlocpivotkeys = altlocpivot.keys;
> print altlocpivotkeys.type
>   array
> print altlocpivotkeys
>   A
>   B
>   C
>
> Now I want to get altlocpivotkeys into Javascript as an array.
> Perhaps something like
>
> x = getPropertyAsArray(jmolApplet0, "variableInfo altlocpivotkeys")
>
> (But Jmol says "getProperty ERROR". I think that I haven't been able to
> guess the syntax to specify the variable name. There is no example in the
> documentation.)
>
> With success, I am expecting the result in Javascript to be the equivalent
> of
> x = ["A", "B", "C"];
> so that
> x.length is 3
> x[1] is "B"
>
> Any help welcome.
> Thanks, Eric
>
>
> --
>
> ___
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>


-- 
Robert M. Hanson
Larson-Anderson Professor of Chemistry
Chair, Department of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr


If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
--
___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


[Jmol-users] Jmol array to Javascript?

2015-09-01 Thread Eric Martz
I have not been able to figure out how to get an array from Jmol applet 
into a Javascript array. For example, in the Jmol applet, I create a 
Jmol array:


(Jmol applet contains 1bsz)
(Jmol applet output in red)

altlocpivot = {altloc!=""}.altloc.all.pivot;
altlocpivotkeys = altlocpivot.keys;
print altlocpivotkeys.type
array
print altlocpivotkeys
  A
  B
  C

Now I want to get altlocpivotkeys into Javascript as an array.
Perhaps something like

x = getPropertyAsArray(jmolApplet0, "variableInfo altlocpivotkeys")

(But Jmol says "getProperty ERROR". I think that I haven't been able to 
guess the syntax to specify the variable name. There is no example in 
the documentation.)


With success, I am expecting the result in Javascript to be the 
equivalent of

x = ["A", "B", "C"];
so that
x.length is 3
x[1] is "B"

Any help welcome.
Thanks, Eric
--
___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] Frame, Window, Tab Communication Independent of the DOM

2015-09-01 Thread Robert Hanson
That's very cool, Otis. Thanks for the intro to local storage. I especially
like the idea of the event notices.

Bob
​
--
___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] communication between frames/windows

2015-09-01 Thread CheMagic
Hi Eran,

I was thinking about an iframe in a page, but it sounds like you may be talking 
about an older frameset approach. Is this a case where there is a top frameset 
html page with other frames being set in this frameset page?  If so, can you 
send a link to the top frameset page that is being used. The javascript to 
"talk" between such frames is doable, but a bit more convoluted than "talking" 
to an iframe.

This frameset hierarchy can be very frustrating and unpredictable, particularly 
with file path references. Angel has some experience with this frustration, and 
I believe he has abandoned this frameset approach. I've worked with it in the 
past, and I may be able to make a suggestion if I see the frameset, assuming 
that's what you are working with.

Otis

Sent from my iPad

> On Sep 1, 2015, at 7:10 AM, Dr. Eyal Eran  
> wrote:
> 
> I know this issue was discussed before but I still not able to resolve it. I 
> want to be able to influence on a model in a window or frame with control 
> elements on a different window/frame and I found this thread for example:​
> 
> sourceforge.net/p/jmol/mailman/message/33692410
> 
> with a detailed syntax suggestion of Otis, but this does not work for me 
> either. So far I could not find any way to use control elements like buttons 
> to act on a model in a different frame/window. I know div elements can 
> replace frames, but I have also old Jmol sites in which the control elements 
> are in a separate child window.
> Thanks,
> Eran​
>  
> Eyal Eran, PhD
> Head of bioinformatics unit
> Cancer Research Center
> Sheba Medical Center
> Tel: 03-5308148
> Fax: 03-5305942
> eran.e...@sheba.health.gov.il
> http://www.sheba-cancer.org.il/eran
>  
>  
>   
> --
> ___
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users
--
___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] Jmol -- testing requested (move)

2015-09-01 Thread Rolf Huehne
On 08/25/2015 04:28 PM, Robert Hanson wrote:
> OK, let's try again, please. I really appreciate all this testing. Rolf, I
> am especially interested in if this fixes your JenaLib startup problem.
>
The 'move' command doesn't do anything if the time is set to zero, e.g.:
   move 180 0 0 0 0 0 0 0 0;

This used to work in version 11.8.8, which we are still using for the 
automatic image generation for the 'JenaLib'. This behaviour might have 
been introduced already in version 12.x. At least I remember that we 
never upgraded the Jmol version in conjunction with the 'Jena3D Viewer' 
because the images created with newer versions were different. And since 
upgrading wasn't really necessary until now I never took the time to 
really investigate it.

Even if the time is set to 0.1 seconds, the images from version 11.8.8 
and 14.3.16_2015.08.25 (both with 'set perspectivemodel 11;') don't look 
identical.

The scripting documentation says that 'move' has been superseded by 
'moveto', but I couldn't figure out how to achieve relative rotations 
(like 'move' does them) with 'moveto'. I could only get absolute 
rotations with it.
Even if it might be possible, the 'move' command seems to be much less 
complicated to use for 'relative' movements than 'moveto'. So I would 
rather not regard it as "superseded" by it.

Regards,
Rolf

-- 

Rolf Huehne
Postdoc

Leibniz Institute for Age Research - Fritz Lipmann Institute (FLI)
Beutenbergstrasse 11
07745 Jena, Germany

Phone:   +49 3641 65 6205
Fax: +49 3641 65 6210
E-Mail:  rhue...@fli-leibniz.de
Website: http://www.fli-leibniz.de

   Scientific Director: Prof. Dr. K. Lenhard Rudolph
Head of Administration: Dr. Daniele Barthel
Chairman of Board of Trustees: Dennys Klein

VAT No: DE 153 925 464
Register of Associations: No. 230296, Amtsgericht Jena
Tax Number: 162/141/08228


--
___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] Jmol -- testing requested (move)

2015-09-01 Thread Rolf Huehne
On 09/01/2015 03:36 PM, Rolf Huehne wrote:
> On 08/25/2015 04:28 PM, Robert Hanson wrote:
>> OK, let's try again, please. I really appreciate all this testing. Rolf, I
>> am especially interested in if this fixes your JenaLib startup problem.
>>
> The 'move' command doesn't do anything if the time is set to zero, e.g.:
> move 180 0 0 0 0 0 0 0 0;
>
> This used to work in version 11.8.8, which we are still using for the
> automatic image generation for the 'JenaLib'. This behaviour might have
> been introduced already in version 12.x. At least I remember that we
> never upgraded the Jmol version in conjunction with the 'Jena3D Viewer'
> because the images created with newer versions were different. And since
> upgrading wasn't really necessary until now I never took the time to
> really investigate it.
>
> Even if the time is set to 0.1 seconds, the images from version 11.8.8
> and 14.3.16_2015.08.25 (both with 'set perspectivemodel 11;') don't look
> identical.
>
'0.1' seconds seems to be still too short. If '1.0' is used instead (for 
each of several 'move' commands with PDB entry 1H3E), the images look 
identical in both versions.
So it looks as if the other parameters aren't adjusted to the time so 
that the endpoint isn't always reached as it would be expected.

Regards,
Rolf
-- 

Rolf Huehne
Postdoc

Leibniz Institute for Age Research - Fritz Lipmann Institute (FLI)
Beutenbergstrasse 11
07745 Jena, Germany

Phone:   +49 3641 65 6205
Fax: +49 3641 65 6210
E-Mail:  rhue...@fli-leibniz.de
Website: http://www.fli-leibniz.de

   Scientific Director: Prof. Dr. K. Lenhard Rudolph
Head of Administration: Dr. Daniele Barthel
Chairman of Board of Trustees: Dennys Klein

VAT No: DE 153 925 464
Register of Associations: No. 230296, Amtsgericht Jena
Tax Number: 162/141/08228


--
___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] communication between frames/windows

2015-09-01 Thread Angel Herráez




(sorry for possible duplicates; my outgoing mail server is having a bad time today)




Hi Eran

Others seem to hae succeeded with this, but I had to give up trying to use frames in 
my pages when I updated them to JSmol. I guess it depends on the complexity of the 
code in the controls, and maybe their layout.

In any case, you'd need to provide an example page if we are to research this. I'll be 
glad to have a look.


  



--
___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


[Jmol-users] Frame, Window, Tab Communication Independent of the DOM

2015-09-01 Thread Otis Rothenberger
New List Subject but related to Eran’s note...

The approach in this note is motivated by Eran’s questions, but it’s also 
motivated by a number of frame page communication issues that have come up as 
folks move older pages to JSmol.

It’s quick and dirty, but it works (No parent.top… or should it have been 
parent.top.top… or maybe just parent…).
I have not tried it on older frameset pages, but it should work.

The code is fairly simple:

if (window.addEventListener) { window.addEventListener("storage", talkToFriend, 
false); } // false ensures event bubbling - not capture
if (window.attachEvent) { window.attachEvent("storage", talkToFriend, false); } 
// keep i.e. happy - sigh
function talkToFriend(e) {
if (localStorage.getItem('talkToFriend')) {
var data = localStorage.getItem('talkToFriend');
localStorage.removeItem('talkToFriend’); // sending page will 
get this message, but above “if" will kill action. Classic example of eat this 
message!
Jmol.script(jmolApplet0, data);
}
return null;
}

If the above code is in two pages on the same browser (frames, tabs, or 
windows) then they can exchange JmolScript commands independent of the DOM. The 
command to make the change is:

localStorage.setItem('talkToFriend', 'select all:color red');   or   
localStorage.setItem('talkToFriend', 'load $aspirin'); or Etc.

You can try it here:

http://chemagic.com/molecules/VMKMINInotes.htm 


The model kit is in an iFrame. Both pages have the above code. If you go to the 
JS console of the browser - not the Jmol frame, then the containing page will 
be the sender. This page does not even know what Jmol is. It’s a slide show 
page, and it could even be in another tab or window. The DOMs of both pages are 
irrelevant to the dialog. In the console, enter:

localStorage.setItem('talkToFriend', 'select all:color red')

or any other Jmol script. Note that the sending page does not get the event. 
That’s by design. Note also that if the Jmol page were to send a script in this 
case there would be an error. There is no Jmol on the sending page. Tweaking 
the senders event function could prevent an inadvertent event error. For 
example, if the sender never has to listen, the the event function could simply 
return null;

I called this “talkToFriend” because it’s set up for 1 to 1 communication. With 
a little thought, multi frame/window Jmol synchronization should be possible. I 
have to think about this.

Otis

--
Otis Rothenberger
o...@chemagic.com
http://chemagic.com

--
___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


[Jmol-users] communication between frames/windows

2015-09-01 Thread Dr. Eyal Eran
I know this issue was discussed before but I still not able to resolve it. I 
want to be able to influence on a model in a window or frame with control 
elements on a different window/frame and I found this thread for example:​

sourceforge.net/p/jmol/mailman/message/33692410

with a detailed syntax suggestion of Otis, but this does not work for me 
either. So far I could not find any way to use control elements like buttons to 
act on a model in a different frame/window. I know div elements can replace 
frames, but I have also old Jmol sites in which the control elements are in a 
separate child window.
Thanks,
Eran​

Eyal Eran, PhD
Head of bioinformatics unit
Cancer Research Center
Sheba Medical Center
Tel: 03-5308148
Fax: 03-5305942
eran.e...@sheba.health.gov.il
http://www.sheba-cancer.org.il/eran


[https://services.sheba.co.il/icons/sig_r1_c1.png]
[https://services.sheba.co.il/icons/sig_r2_c1.png]   
[https://services.sheba.co.il/icons/sig_r2_c2.png]  
[https://services.sheba.co.il/icons/sig_r3_c4.png] 

[https://services.sheba.co.il/icons/sig_r3_c6.png]  
[https://services.sheba.co.il/icons/sig_r3_c7.png] 

--
___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users