From: Warren D. <wa...@de...> - 2006-01-06 22:52:26
|
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 =3D cmd.get_view() filename =3D "view.txt" while not sleep(0.2): cur_view =3D cmd.get_view() if last_view !=3D cur_view: if not os.path.exists(filename): open(filename,'w').write(str(cur_view)) last_view =3D cur_view # END send.py # BEGIN receive.py from pymol import cmd from time import sleep import os filename =3D "view.txt" while not sleep(0.2): if os.path.exists(filename): try: cmd.set_view(open(filename,'r').read()) os.unlink(filename) except: # if the file isn't yet complete pass =20 # END receive.py Cheers, Warren -- Warren L. DeLano, Ph.D. =20 Principal Scientist . DeLano Scientific LLC =20 . 400 Oyster Point Blvd., Suite 213 =20 . South San Francisco, CA 94080 USA =20 . Biz:(650)-872-0942 Tech:(650)-872-0834 =20 . Fax:(650)-872-0273 Cell:(650)-346-1154 . mailto:wa...@de... =20 =20 > -----Original Message----- > From: pym...@li...=20 > [mailto:pym...@li...] On Behalf Of=20 > Michael George Lerner > Sent: Friday, January 06, 2006 1:56 PM > To: pym...@li... > Subject: [PyMOL] Can I use the mouse to control multiple windows? >=20 >=20 > Longshot, but .. >=20 > I'm looking at a structure under two different sets of=20 > conditions, so I have two PyMOL windows open. I'm constantly=20 > get_view and set_view[*] to synchronize the two windows. Is=20 > there some way to set things up so that I can drag things=20 > around in one window and have the scene in the other window=20 > automatically follow along? >=20 > Thanks, >=20 > -michael >=20 > [*] actually, I'm a bit lazier than that .. I now have this run via my > .pymolrc: >=20 > VIEW_FILENAME =3D '/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 =3D file(VIEW_FILENAME,'w') > f.write(str(cmd.get_view())) > f.close() > def sv(): > '''read current view from a file (default=20 > /tmp/currentview.txt)''' > # '...%s...'%VIEW_FILENAME doesn't end up as sv.__doc__ > f =3D file(VIEW_FILENAME) > cmd.set_view(f.read()) > f.close() > cmd.extend('gv',gv) > cmd.extend('sv',sv) >=20 >=20 > so I can type 'gv' in one window and 'sv' in the other. >=20 > -- > 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| / \ | mlerner@umich >=20 >=20 > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep=20 > through log files for problems? Stop! Download the new AJAX=20 > search engine that makes searching your log files as easy as=20 > surfing the web. DOWNLOAD SPLUNK! > http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick > _______________________________________________ > PyMOL-users mailing list > PyM...@li... > https://lists.sourceforge.net/lists/listinfo/pymol-users >=20 >=20 >=20 >=20 |