Laura,

Presents are simply miniature Python programs bound to menu items.  To
create your own while avoiding changes to "menu.py" which is overwritten
during upgrades, you can wrap and replace the 'presets' function in the
"menu" module at runtime.  

# file: add_preset.py
# "run add_preset.py" to load
# or use ".pymolrc.py" (unix) "pymolrc.py" (win32)

from pymol import preset
from pymol import menu

def new_preset(sele):
   from pymol import cmd
   cmd.hide("everything",sele)
   cmd.color("cyan",sele)
   cmd.show("sticks",sele)

preset.new_preset = new_preset

if not globals().has_key("old_presets"):
    
    old_presets = menu.presets

    def my_presets(s):
        return old_presets(s) + [[0,'',''],
            [1, 'new_preset', 'preset.new_preset("'+s+'")']]

    menu.presets = my_preset

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:war...@delsci.com      
 

> -----Original Message-----
> From: pymol-users-ad...@lists.sourceforge.net 
> [mailto:pymol-users-ad...@lists.sourceforge.net] On Behalf Of 
> Laura Grell
> Sent: Friday, June 10, 2005 11:34 AM
> To: pymol-users@lists.sourceforge.net
> Subject: [PyMOL] Preset Views
> 
> I really like the preset views that Pymol offers in the 
> Actions menu of the internal GUI. I was wondering if there 
> was a way to produce more preset views and add them to the menu??
> 
> Thanks
> Laura
> 
> _________________________________________________________________
> FREE pop-up blocking with the new MSN Toolbar - get it now! 
> http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: NEC IT Guy Games.  How far 
> can you shotput a projector? How fast can you ride your desk 
> chair down the office luge track?
> If you want to score the big prize, get to know the little guy.  
> Play to win an NEC 61" plasma display: 
> http://www.necitguy.com/?r=20 
> _______________________________________________
> PyMOL-users mailing list
> PyMOL-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pymol-users
> 



Reply via email to