Thank you Thomas

I've updated the scripts following your recommendation.
I wasn't aware of the auto-completion methods. It's great.

Cheers

2011/7/14 Thomas Holder <speleo3@users.sourceforge.net>
nice :)

The toggle() function can be much simplified:

def toggle(setting):
   setting_value = cmd.get(setting)
   if cmd.toggle_dict.get(setting_value, 0):
       cmd.unset(setting)
   else:
       cmd.set(setting)

And you can add auto-completion for the setting name:

cmd.auto_arg[1].update({
   'set_toggle'         : cmd.auto_arg[0]['set'],
})

Cheers,
 Thomas


On 07/14/2011 02:10 PM, Joseph André wrote:
Hi PyMOLers,

I was tired of always typing the same commands to change *grid_mode* or
*seq_view*... I know it is possible to use set_key to define action but
I want a key to enable/disable some settings. I wrote a small script
that binds a key to a setting accepting 0/1 or on/off value.

http://pymolwiki.org/index.php/Set_toggle

It works as is but I'll add other features such as help, check that key
is not already bound, check whether setting is known.

Comments and suggestions are welcome.

Thanks

--
Joseph ANDRE

--
Thomas Holder
MPI for Developmental Biology



--
Joseph ANDRE
------------------------------------
11 Rue de Valence
75005 Paris - FRANCE

33(0)6 75 04 64 00