From: Warren D. <wa...@de...> - 2006-01-06 22:56:26
|
NOTE: Bug fix for receive.py=20 # 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(eval(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: Warren DeLano=20 > Sent: Friday, January 06, 2006 2:54 PM > To: 'Michael George Lerner'; pym...@li... > Subject: RE: [PyMOL] Can I use the mouse to control multiple windows? >=20 > Michael, >=20 > Of course -- use ansynchrous Python threads to automate the=20 > process. For example: >=20 > pymol test.pdb -l send.py & > pymol test.pdb -l receive.py >=20 > with the scripts below. Note use of the lowercase "L" option=20 > to launch PyMOL Python scripts in their own asynchronous thread. >=20 > Cheers, > Warren >=20 > # BEGIN send.py >=20 > from pymol import cmd > from time import sleep > import os >=20 > last_view =3D cmd.get_view() >=20 > filename =3D "view.txt" >=20 > 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 >=20 > # END send.py >=20 > # BEGIN receive.py >=20 > from pymol import cmd > from time import sleep > import os >=20 > filename =3D "view.txt" >=20 > 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 > =20 > # END receive.py >=20 >=20 > Cheers, > Warren >=20 >=20 > -- > Warren L. DeLano, Ph.D. =20 > Principal Scientist >=20 > . 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 >=20 > > -----Original Message----- > > From: pym...@li... > > [mailto:pym...@li...] On Behalf=20 > Of Michael=20 > > 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=20 > > I have two PyMOL windows open. I'm constantly get_view and=20 > > set_view[*] to synchronize the two windows. Is there some=20 > way to set=20 > > things up so that I can drag things around in one window=20 > and have the=20 > > scene in the other window automatically follow along? > >=20 > > Thanks, > >=20 > > -michael > >=20 > > [*] actually, I'm a bit lazier than that .. I now have this=20 > run via my > > .pymolrc: > >=20 > > VIEW_FILENAME =3D '/tmp/currentview.txt' > > def gv(): > > '''write current view to a file (default=20 > /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=20 > > files for problems? Stop! Download the new AJAX search=20 > engine that=20 > > makes searching your log files as easy as surfing the web.=20 > DOWNLOAD=20 > > 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 |