NOTE: Bug fix for receive.py
# BEGIN receive.py
from pymol import cmd
from time import sleep
import os
filename = "view.txt"
while not sleep(0.2):
if os.path.exists(filename):
try:
cmd.set_view(eval(open(filename,'r').read()))
os.unlink(filename)
except: # if the file isn't yet complete
pass
# END receive.py
Cheers,
Warren
--
Warren L. DeLano, Ph.D.
Principal Scientist
. DeLano Scientific LLC
. 400 Oyster Point Blvd., Suite 213
. South San Francisco, CA 94080 USA
. Biz:(650)-872-0942 Tech:(650)-872-0834
. Fax:(650)-872-0273 Cell:(650)-346-1154
. mailto:[email protected]
> -----Original Message-----
> From: Warren DeLano
> Sent: Friday, January 06, 2006 2:54 PM
> To: 'Michael George Lerner'; [email protected]
> Subject: RE: [PyMOL] Can I use the mouse to control multiple windows?
>
> Michael,
>
> Of course -- use ansynchrous Python threads to automate the
> process. For example:
>
> pymol test.pdb -l send.py &
> pymol test.pdb -l receive.py
>
> with the scripts below. Note use of the lowercase "L" option
> to launch PyMOL Python scripts in their own asynchronous thread.
>
> Cheers,
> Warren
>
> # BEGIN send.py
>
> from pymol import cmd
> from time import sleep
> import os
>
> last_view = cmd.get_view()
>
> filename = "view.txt"
>
> while not sleep(0.2):
> cur_view = cmd.get_view()
> if last_view != cur_view:
> if not os.path.exists(filename):
> open(filename,'w').write(str(cur_view))
> last_view = cur_view
>
> # END send.py
>
> # BEGIN receive.py
>
> from pymol import cmd
> from time import sleep
> import os
>
> filename = "view.txt"
>
> while not sleep(0.2):
> if os.path.exists(filename):
> try:
> cmd.set_view(eval(open(filename,'r').read()))
> os.unlink(filename)
> except: # if the file isn't yet complete
> pass
>
> # END receive.py
>
>
> Cheers,
> Warren
>
>
> --
> Warren L. DeLano, Ph.D.
> Principal Scientist
>
> . DeLano Scientific LLC
> . 400 Oyster Point Blvd., Suite 213
> . South San Francisco, CA 94080 USA
> . Biz:(650)-872-0942 Tech:(650)-872-0834
> . Fax:(650)-872-0273 Cell:(650)-346-1154
> . mailto:[email protected]
>
>
> > -----Original Message-----
> > From: [email protected]
> > [mailto:[email protected]] On Behalf
> Of Michael
> > George Lerner
> > Sent: Friday, January 06, 2006 1:56 PM
> > To: [email protected]
> > Subject: [PyMOL] Can I use the mouse to control multiple windows?
> >
> >
> > Longshot, but ..
> >
> > I'm looking at a structure under two different sets of
> conditions, so
> > I have two PyMOL windows open. I'm constantly get_view and
> > set_view[*] to synchronize the two windows. Is there some
> way to set
> > things up so that I can drag things around in one window
> and have the
> > scene in the other window automatically follow along?
> >
> > Thanks,
> >
> > -michael
> >
> > [*] actually, I'm a bit lazier than that .. I now have this
> run via my
> > .pymolrc:
> >
> > VIEW_FILENAME = '/tmp/currentview.txt'
> > def gv():
> > '''write current view to a file (default
> /tmp/currentview.txt)'''
> > # '...%s...'%VIEW_FILENAME doesn't end up as gv.__doc__
> > f = file(VIEW_FILENAME,'w')
> > f.write(str(cmd.get_view()))
> > f.close()
> > def sv():
> > '''read current view from a file (default
> > /tmp/currentview.txt)'''
> > # '...%s...'%VIEW_FILENAME doesn't end up as sv.__doc__
> > f = file(VIEW_FILENAME)
> > cmd.set_view(f.read())
> > f.close()
> > cmd.extend('gv',gv)
> > cmd.extend('sv',sv)
> >
> >
> > so I can type 'gv' in one window and 'sv' in the other.
> >
> > --
> > www.umich.edu/~mlerner | _ |Michael Lerner
> > This isn't a democracy;| ASCII ribbon campaign ( ) | Michigan
> > it's a cheer-ocracy. | - against HTML email X | Biophysics
> > -Torrence, Bring It On| / \ | mler...@umich
> >
> >
> > -------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc. Do you grep
> through log
> > files for problems? Stop! Download the new AJAX search
> engine that
> > makes searching your log files as easy as surfing the web.
> DOWNLOAD
> > SPLUNK!
> > http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> > _______________________________________________
> > PyMOL-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/pymol-users
> >
> >
> >
> >