Coot: Difference between revisions

1,478 bytes added ,  17 March 2009
Line 223: Line 223:


[[bernhards_key_bindings_for_coot.py]]
[[bernhards_key_bindings_for_coot.py]]
===Example 2: More key bindings (inspired by the Coot BB)===
For (re-)colouring maps blue:
# bluefy last map
def blue_map_func1():
    ls = map_molecule_list()
    ls.reverse()
    for map_mol in ls:
        if (not map_is_difference_map(map_mol)):
            set_map_colour(map_mol, 0.1, 0.5, 0.68)
            graphics_draw()
            break
   
add_key_binding("Blueify the Latest 2FoFc Map", "b",
                lambda: blue_map_func1())
# bluefy all 2FoFc maps
def blue_map_func2():
    for map_mol in map_molecule_list():
        if (not map_is_difference_map(map_mol)):
            set_map_colour(map_mol, 0.1, 0.5, 0.68)
            graphics_draw()
   
add_key_binding("Blueify all 2FoFc Maps", "B",
                lambda: blue_map_func2())
To (re-)colour coordinate molecules yellow:
# yellowify last coordinate molecule
# Note: this may overwrite the 'usual' short-cut of 'y' to add a terminal residue
def yellow_coords_func1():
    ls = model_molecule_list()
    if (len(ls) > 0):
        set_molecule_bonds_colour_map_rotation(ls[-1], 20)
        graphics_draw()
add_key_binding("Yellowify last coordinates", "y",
                lambda: yellow_coords_func1())
# yellowify all coordinate molecules
add_key_binding("Yellowify all coordinates", "Y",
                lambda: (map(lambda imol: set_molecule_bonds_colour_map_rotation(imol, 20),
                            model_molecule_list()),
                        graphics_draw()))


==Python to Scheme and return==
==Python to Scheme and return==
28

edits