For those with who are trying this out and are frustrated by the lack of key-bindings.

The key-binding system is better now because you can specify the use of the control key as well as the shift key modifier and you can over-ride the built-in key-bindings -  there is one central repository rather than 3 independent ones.

Here is the key_bindings.py script that I've been using for several months - it contains some debugging and some test menu item and some user key bindings. Hopefully you will find it a useful template to get you going while coot default built-ins are put into place (some of them are already: G for blob navigation, Ctrl-G for model navigation, 1,2,3,4 for clipping adjustment).

Paul


########################################################################

To unsubscribe from the COOT list, click the following link:
https://www.jiscmail.ac.uk/cgi-bin/WA-JISC.exe?SUBED1=COOT&A=1

This message was issued to members of www.jiscmail.ac.uk/COOT, a mailing list 
hosted by www.jiscmail.ac.uk, terms & conditions are available at 
https://www.jiscmail.ac.uk/policyandsecurity/
import coot
import gi
gi.require_version('Gtk', '3.0') 
from gi.repository import Gtk
# thank you ebassi!
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
import coot_gui_api
import coot_utils
import fitting
import random

import extensions

def make_store_for_map_molecule_combobox():
   mol_store = Gtk.ListStore(int, str)
   for imol in coot_utils.molecule_number_list():
      if coot.is_valid_map_molecule(imol) == 1:
         label_str = coot.molecule_name(imol)
         m_label_str = str(imol) + ' ' + label_str
         mol_store.append([imol, m_label_str])
   return mol_store

def fill_combobox_with_mol_options(combobox, filter_function):
   mols_ls = []
   name_store = Gtk.ListStore(int, str)
   for imol in coot_utils.molecule_number_list():
      if filter_function(imol):
         label_str = molecule_name(imol)
         m_label_str = str(imol) + ' ' + label_str
         name_store.append([imol, m_label_str])
         
   return mols_ls


# def fill_option_menu_with_mol_options(menu, filter_function):

#     mol_ls = []
   
#     for mol_no in coot_utils.molecule_number_list():
#         if filter_function(mol_no):
#            label_str = molecule_name(mol_no)
#            if (isinstance(label_str,(str,))):
#               mlabel_str = str(mol_no) + " " + label_str
#               menu.append_text(mlabel_str)
#               menu.set_active(0)
#               mol_ls.append(mol_no)
#            else:
#               print("OOps molecule name for molecule %s is %s" %(mol_no_ls,label_str))
#     return mol_ls

def sharpen_blur_map_gui():

    def on_ok_button_clicked(button, combobox, check_button_for_resample, check_button_for_refinement_map, entry_for_blur, entry_for_resample, window):
        tree_iter = combobox.get_active_iter()
        if tree_iter is not None:
            model = combobox.get_model()
            it = model[tree_iter]
            imol_map = it[0]
            state_1 = check_button_for_resample.get_active()
            state_2 = check_button_for_refinement_map.get_active()
            print("state_1", state_1)
            print("state_2", state_2)
            imol_new = -1
            t1 = entry_for_blur.get_text()
            blur_factor = float(t1)
            if state_1:
                t2 = entry_for_resample.get_text()
                resample_factor = float(t2)
                imol_new = coot.sharpen_blur_map_with_resampling(imol_map, blur_factor, resample_factor)
            else:
                imol_new = coot.sharpen_blur_map(imol_map, blur_factor)
            if state_2:
                print("set_imol_refinement_map() with ", imol_new)
                set_imol_refinement_map(imol_new)
                
        window.destroy()

    def on_mol_combobox_changed(combobox):
        # this function is not useful. For this dialog, we want to do things when
        # the "OK" button is pressed
        tree_iter = combobox.get_active_iter()
        if tree_iter is not None:
            model = combobox.get_model()
            it = model[tree_iter]
            print("Selected: imol=%s" % it)

    def on_check_button_toggled(check_button, entry_2, label_2):
        print("toggled", check_button)
        if check_button.get_active():
            entry_2.set_sensitive(True)
            label_2.set_sensitive(True)
        else:
            entry_2.set_sensitive(False)
            label_2.set_sensitive(False)

    chooser_label = "Map for Sharpen/Blur"
    entry_hint_text_1 =  "Sharpen/Blur:"

    # window = Gtk.Window(Gtk.WINDOW_TOPLEVEL)
    window = Gtk.Window()
    entry_hint_text_2 = "Factor:"
    default_entry_1_text = "20"
    default_entry_2_text = "1.3"

    label = Gtk.Label(chooser_label)
    vbox = Gtk.VBox(False, 2)
    hbox_for_sharpen  = Gtk.HBox(False, 0)
    hbox_for_resample = Gtk.HBox(False, 0)
    entry_1 = Gtk.Entry();
    entry_2 = Gtk.Entry();
    entry_label_1 = Gtk.Label(entry_hint_text_1)
    entry_label_2 = Gtk.Label(entry_hint_text_2)
    hbox_buttons = Gtk.HBox(True, 2)
    # combobox = Gtk.combo_box_new_text()
    ok_button    = Gtk.Button(" Make Map ")
    cancel_button = Gtk.Button(" Cancel ")
    h_sep = Gtk.HSeparator()
    # map_mol_list = fill_option_menu_with_map_mol_options(combobox)
    # map_mol_list = fill_option_menu_with_map_mol_options(combobox)
    combobox_items = make_store_for_map_molecule_combobox()
    combobox = Gtk.ComboBox.new_with_model(combobox_items)
    renderer_text = Gtk.CellRendererText()
    if len(combobox_items) > 0:
        combobox.set_active(0)
    combobox.set_entry_text_column(1)
    combobox.pack_start(renderer_text, True)
    combobox.add_attribute(renderer_text, "text", 1)
    
    combobox.connect("changed", on_mol_combobox_changed)
    check_button_for_resample = Gtk.CheckButton("Resample")
    check_button_for_refinement_map = Gtk.CheckButton("Make the new map the Refinement Map")

    window.set_title("Coot: Sharpen/Blur Map")
    window.set_default_size(400, 100)
    window.add(vbox)

    vbox.pack_start(label,    False, False, 2)
    vbox.pack_start(combobox, False, False, 2)
    vbox.pack_start(hbox_for_sharpen,  False, False, 2)
    vbox.pack_start(hbox_for_resample, False, False, 2)
    vbox.pack_start(check_button_for_refinement_map, False, False, 2)
    vbox.pack_start(h_sep, False, False, 2)
    vbox.pack_start(hbox_buttons, False, False, 2)

    hbox_for_sharpen.pack_start(entry_label_1, False, False, 2)
    hbox_for_sharpen.pack_start(entry_1, False, False, 2)
    hbox_for_resample.pack_start(check_button_for_resample,  False, False, 2)
    hbox_for_resample.pack_start(entry_label_2, False, False, 2)
    hbox_for_resample.pack_start(entry_2, False, False, 2)
    hbox_buttons.pack_start(ok_button, False, False, 6)
    hbox_buttons.pack_start(cancel_button, False, False, 6)
    entry_1.set_size_request(52, -1)
    entry_2.set_size_request(52, -1)
    entry_1.set_text(default_entry_1_text)
    entry_2.set_text(default_entry_2_text)

    check_button_for_refinement_map.set_active(True)
    entry_label_2.set_sensitive(False)
    entry_2.set_sensitive(False)

    cancel_button.connect("clicked", lambda button: window.destroy())
    # ok_button.connect("clicked", on_ok_button_clicked, combobox, map_mol_list,
    # entry_1, entry_2, check_button, check_button_for_refinement_map, window)

    ok_button.connect("clicked", on_ok_button_clicked, combobox, check_button_for_resample, check_button_for_refinement_map, entry_1, entry_2, window)

    check_button_for_resample.connect("toggled", on_check_button_toggled, entry_2, entry_label_2)
                                                  

    window.show_all()


def add_module_cryo_em_gui():

    def make_masked_maps_using_active_atom():
        active_atom = coot.active_residue_py()
        print("active_atom:", active_atom)
        if active_atom:
            imol = active_atom[0]
            coot.make_masked_maps_split_by_chain(imol, coot.imol_refinement_map())
        
    if coot_gui_api.main_menubar():
        main_menubar = coot_gui_api.main_menubar()
        menu = coot_menubar_menu("myCryo-EM")

        add_simple_coot_menu_menuitem(menu, "Sharpen/Blur...",
                                      lambda widget: sharpen_blur_map_gui())

        # use a function here that extracts the active molecule
        add_simple_coot_menu_menuitem(menu,
                                      "Maps masked by chain",
                                      lambda widget: make_masked_maps_using_active_atom())


def toolbar_label_list():
   try:
      import coot_gui_api
   except:
      return []

   coot_main_toolbar = coot_gui_api.main_toolbar()
   coot_main_hbox    = coot_gui_api.main_hbox()
   button_label_ls = []
   return []

   # ignore this bit for now
   try:
       for toolbar_child in coot_main_toolbar.get_children():
          ls = []
          try:
              label = toolbar_child.get_label()
              ls.append(label)
              ls.append(toolbar_child)
              button_label_ls.append(ls)
          except:
              # some toolitems we have from GTK2 cannot be accessed here
              # so we pass it and dont add it to the list.
              # nothing we can do about it. Probably good as we dont want to
              # play with the GTK2 toolitems only with the PYGTK ones.
              #
              # try if it has a name instead, e.g. toolitem
            try:
                label = toolbar_child.get_name()
                ls.append(label)
                ls.append(toolbar_child)
                button_label_ls.append(ls)
            except:
               pass
   except AttributeError as e:
      # this doesn't make sense until we have wired up the gui in the gtkbuilder mode.
      pass

   return button_label_ls

def coot_toolbar_button(button_label, cb_function,
                        icon_name=False, tooltip=False,
                        toggle_button=False, use_button=False):

   try:
      import coot_gui_api
   except:
      print("""WARNING:: could not import coot_gui_api module, so we cannot make toolbar_buttons""")
      return False

   coot_main_toolbar = coot_gui_api.main_toolbar()

   if coot_main_toolbar == None:
      print("ERROR:: in coot_toolbar_button() coot_main_toolbar is null")
      return False

   # main body
   #
   found_button = False
   for f in toolbar_label_list():
      if button_label in f:
         found_button = f[1]
   if found_button:
      # here we only try to add a new icon, we cannot overwrite the
      # callback function!
      toolbutton = found_button
   else:
      if toggle_button:
         toolbutton = Gtk.ToggleToolButton()
         toolbutton.set_label(button_label)
      else:
         toolbutton = Gtk.ToolButton(icon_widget=None, label=button_label)
      coot_main_toolbar.insert(toolbutton, -1)       # insert at the end
      toolbutton.set_is_important(True)              # to display the text,
                                                     # otherwise only icon
      # tooltips?
      if tooltip:
            toolbutton.set_tooltip_text(tooltip)
            # coot_tooltips.set_tip(toolbutton, tooltip)

      def cb_wrapper(widget, callback_function):
         if (type(callback_function) is bytes):
            # old style with string as function
            eval(callback_function)
         else:
            # have function as callable and maybe extra args (all in one list)
            args = []
            function = callback_function
            if (type(callback_function) is list):
               function = callback_function[0]
               args = callback_function[1:]
            # pass the widget/button as well? Maybe the cb function can
            # make use of it
            if use_button:
               args.append(widget)
            if callable(function):
               function(*args)
            else:
               print("ERROR:: cannot evaluate or call function", function)
      #toolbutton.connect("clicked", lambda w: eval(cb_function))
      toolbutton.connect("clicked", cb_wrapper, cb_function)
      toolbutton.show()

   if (icon_name):
      # try to add a stock item
      try:
         toolbutton.set_stock_id(icon_name)
      except:
         # try to add a icon widget
         try:
            toolbutton.set_icon_widget(icon_name)
         except:
            print("INFO:: icon name/widget given but could not add the icon")

   return toolbutton
#
def map_molecule_list():

    map_list = []
    for i in range(coot.graphics_n_molecules()):
       if coot.is_valid_map_molecule(i):
          map_list.append(i)
    return map_list

def auto_fit_rotamer_active_residue():

    active_atom = coot.active_residue_py()

    if not active_atom:
       print("No active atom")
    else:
       imol       = active_atom[0]
       chain_id   = active_atom[1]
       res_no     = active_atom[2]
       ins_code   = active_atom[3]
       atom_name  = active_atom[4]
       alt_conf   = active_atom[5]

       print("active-atom:", active_atom)
       imol_map = coot.imol_refinement_map()
       replacement_state = coot.refinement_immediate_replacement_state()
       if imol_map == -1:
          coot.info_dialog("Oops.  Must Select Map to fit to!")
       else:
          coot.auto_fit_best_rotamer(res_no, alt_conf, ins_code, chain_id, imol, imol_map, 1, 0.1)

def just_one_or_next_map():

    def next_map(current_map_number, map_number_list):
        try:
            current_idx = map_number_list.index(current_map_number)
        except:
            current_idx = -1
        l = len(map_number_list)
        if current_idx > -1:
            next_index = 0 if current_idx + 1 == l else current_idx + 1
            return map_number_list[next_index]
        return map_number_list[0]

    map_list = map_molecule_list()
    current_displayed_maps = [imol for imol in map_list if coot.map_is_displayed(imol) == 1]
    n_displayed = len(current_displayed_maps)

    # if nothing is displayed, display the first map in map-list
    # if one map is displayed, display the next map in map-list
    # if more than one map is displayed, display only the last map
    # in the current-displayed-maps

    if n_displayed == 0:
        if len(map_list) > 0:
            coot_utils.undisplay_all_maps_except(map_list[0])
    elif n_displayed == 1:
        if len(map_list) > 1:
            coot_utils.undisplay_all_maps_except(next_map(current_displayed_maps[0],
                                                          map_list))
    else:
        coot_utils.undisplay_all_maps_except(current_displayed_maps[-1])


coot_toolbar_button("Sphere Refine", fitting.sphere_refine,
                    icon_name="refine-1.svg",
                    tooltip="RSR around active residue")

def step_scrollable_map_number():
    maps = map_molecule_list()
    current = coot.scroll_wheel_map()
    if maps:
        l = maps.index(current)
        if (l == len(maps) - 1):
            new_map = maps[0]
        else:
            new_map = maps[l+1]
        coot.set_scroll_wheel_map(new_map)

def run_the_test_function():
   # coot.test_function_py("blue-eyelashes-1.glb", 0)
   # coot.test_function_py("../../../gltf-sample-models/glTF-Sample-Models/2.0/Corset/glTF-Binary/Corset.glb", 0)
   # coot.test_function_py("glTF-Sample-Models-2.0/Box/glTF-Binary/Box.glb", 0)
   # coot.test_function_py("just-one-box.glb", 0)
   # coot.test_function_py("zelda.glb", 0)
   # coot.test_function_py("blue-eyelashes-1.glb", 0)
   # coot.test_function_py("augmented-box-2.glb", 0)
   # coot.test_function_py("3-planes.glb", 0)
   # coot.test_function_py("crow-2.glb", 0)
   # coot.test_function_py("zelda-2.glb", 0)
   coot.test_function_py("crow-7.glb", 0)
   # coot.test_function_py("japanese-box.glb", 0)
   
# Ctrl-R should not be rocking - it's too valuable
# 
# coot.add_key_binding_gtk3_py(114, 1, coot.reload_shaders, "Reload Shaders")

coot.add_key_binding_gtk3_py(106, 0, auto_fit_rotamer_active_residue, "Autofit rotamer active residue")

# Just one or next map, "X"
coot.add_key_binding_gtk3_py(88, 0, just_one_or_next_map, "Just One or Next Map")

# Change scroll map "V"
coot.add_key_binding_gtk3_py(86, 0, step_scrollable_map_number, "Step Scrollable Map Number")

# Shift T
coot.add_key_binding_gtk3_py(84, 0, run_the_test_function, "Run the test function")

def sphere_refine_fn():
    fitting.sphere_refine(4.5)

def refine_this_residue():
   long_residues_refine(0)

def triple_refine_residues():
   long_residues_refine(1)

coot.add_key_binding_gtk3_py(114, 0, refine_this_residue,    "Refine This Residue")
coot.add_key_binding_gtk3_py(116, 0, triple_refine_residues, "Triple Refine Residues")
coot.add_key_binding_gtk3_py( 82, 0, sphere_refine_fn,       "Sphere Refine")

# this is the version that's on charybdis
def long_residues_refine(n_residues=3):
    active_atom = coot.closest_atom_simple_py() # active_atom returns the CA if it can
    if not active_atom:
       print("No active atom")
    else:
       imol       = active_atom[0]
       chain_id   = active_atom[1]
       res_no     = active_atom[2]
       ins_code   = active_atom[3]
       atom_name  = active_atom[4]
       alt_conf   = active_atom[5]
       specs = []
       print("############################ n_residues {} ".format(n_residues))
       try:
           for ires in range(res_no-n_residues, res_no+n_residues+1):
               # test if the residue exists by looking for a residue name
               rn = coot.residue_name(imol, chain_id, ires, ins_code)
               print("residue name {} for {} {} {} {}".format(rn, imol, chain_id, ires, ins_code))
               if rn:
                   specs.append([chain_id, ires, ins_code])
           coot.refine_residues_py(imol, specs)
       except TypeError as e:
               print(e)

def chain_refine_active_chain():
    active_atom = coot.closest_atom_simple_py() # active_atom returns the CA if it can
    if not active_atom:
       print("No active atom")
    else:
       imol       = active_atom[0]
       chain_id   = active_atom[1]
       res_no     = active_atom[2]
       ins_code   = active_atom[3]
       atom_name  = active_atom[4]
       alt_conf   = active_atom[5]
       specs = []
       try:
          coot.refine_residues_py(imol, coot_utils.residues_in_chain(imol, chain_id))
       except TypeError as e:
               print(e)

def all_atom_refine():
    active_atom = coot.closest_atom_simple_py() # active_atom returns the CA if it can
    if not active_atom:
       print("No active atom")
    else:
       imol       = active_atom[0]
       chain_id   = active_atom[1]
       res_no     = active_atom[2]
       ins_code   = active_atom[3]
       atom_name  = active_atom[4]
       alt_conf   = active_atom[5]
       specs = []
       try:
          coot.refine_residues_py(imol, coot_utils.all_residues(imol))
       except TypeError as e:
               print(e)

def use_perspective():
   current_state = coot.use_perspective_projection_state()
   if current_state == 0:
      coot.set_use_perspective_projection(1)
   else:
      coot.set_use_perspective_projection(0)

# this is a toggle      
def use_ambient_occlusion():
   current_state = coot.use_ambient_occlusion_state();
   if current_state == 0:
      coot.set_use_ambient_occlusion(1)
   else:
      coot.set_use_ambient_occlusion(0)

# this is a toggle      
def toggle_depth_blur():
   current_state = coot.use_depth_blur_state();
   if current_state == 0:
      coot.set_use_depth_blur(1)
   else:
      coot.set_use_depth_blur(0)

# this is a toggle      
def use_fog():
   current_state = coot.use_fog_state();
   if current_state == 0:
      coot.set_use_fog(1)
   else:
      coot.set_use_fog(0)

# this is a toggle      
def use_outline():
   current_state = coot.use_outline_state();
   if current_state == 0:
      coot.set_use_outline(1)
   else:
      coot.set_use_outline(0)

# this is a toggle      
def draw_normals():
   current_state = coot.draw_normals_state();
   if current_state == 0:
      coot.set_draw_normals(1)
   else:
      coot.set_draw_normals(0)

def wrap_fullscreen():
   coot.fullscreen()
   coot.set_show_modelling_toolbar(0)

def wrap_unfullscreen():
   coot.unfullscreen()
   coot.set_show_modelling_toolbar(1)

# coot.set_show_modelling_toolbar(0)

# coot_toolbar_button("Map Shader", lambda: coot.reload_map_shader())
coot_toolbar_button("Perspective",  lambda : use_perspective(),        icon_name="gtk-zoom-in")
coot_toolbar_button("Fog",          lambda : use_fog(),                icon_name="gtk-zoom-in")
coot_toolbar_button("Long5",        lambda : long_residues_refine(5),  icon_name="gtk-zoom-in")
# coot_toolbar_button("Fullscreen",   lambda : wrap_fullscreen(),        icon_name="gtk-zoom-in")
# coot_toolbar_button("Unfullscreen", lambda : wrap_unfullscreen(),      icon_name="gtk-zoom-in")

# coot_toolbar_button("Outline",     lambda : use_outline(),            icon_name="gtk-zoom-in")
# coot_toolbar_button("Normals",     lambda : draw_normals(),           icon_name="gtk-zoom-in")
# coot_toolbar_button("Long30",      lambda : long_residues_refine(30), icon_name="gtk-zoom-in")

coot.add_key_binding_gtk3_py(69, 0, chain_refine_active_chain, "Chain Refine")

def front_clip_reduce():
    # c1 = coot.get_clipping_plane_front()
    # coot.set_clipping_front(c1 * 0.98)
    # c2 = coot.get_clipping_plane_front()
    # print("front clip was", c1, "c2", c2)
   coot.decrease_clipping_front()

def front_clip_increase():
    # c1 = coot.get_clipping_plane_front()
    # coot.set_clipping_front(c1 * 1.02)
    # c2 = coot.get_clipping_plane_front()
    # print("front clip was", c1, "now", c2)
   coot.increase_clipping_front()

def back_clip_increase():
    c = coot.get_clipping_plane_back()
    print("back clip was", c)
    coot.set_clipping_back(c * 1.05)

def back_clip_reduce():
    c = coot.get_clipping_plane_back()
    print("back clip was", c)
    coot.set_clipping_back(c * 0.95)

def active_ligand_contact_dots():
   active_atom = coot.active_residue_py()
   if active_atom:
      imol       = active_atom[0]
      chain_id   = active_atom[1]
      res_no     = active_atom[2]
      ins_code   = active_atom[3]
      atom_name  = active_atom[4]
      alt_conf   = active_atom[5]
      spec = [chain_id, res_no, ins_code]
      coot.coot_contact_dots_for_ligand_py(imol, spec)

def active_all_atom_contact_dots():
   active_atom = coot.active_residue_py()
   if active_atom:
      imol       = active_atom[0]
      chain_id   = active_atom[1]
      res_no     = active_atom[2]
      ins_code   = active_atom[3]
      atom_name  = active_atom[4]
      alt_conf   = active_atom[5]
      spec = [chain_id, res_no, ins_code]
      coot.coot_all_atom_contact_dots(imol)

def clear_status_bar():
   coot.add_status_bar_text("")
      
# 1,2,3,4 are now built-ins already
# coot.add_key_binding_gtk3_py(49, 0, front_clip_reduce,   "User KB: Front Clip Reduce")
# coot.add_key_binding_gtk3_py(50, 0, front_clip_increase, "User KB: Front Clip Increase")
# coot.add_key_binding_gtk3_py(51, 0, back_clip_increase,  "Back  Clip Increase")
# coot.add_key_binding_gtk3_py(52, 0, back_clip_reduce,    "Back  Clip Reduce")
coot.add_key_binding_gtk3_py(53, 0, clear_status_bar,    "Clear Status Bar")

def add_simple_coot_menu_menuitem(menu, menu_item_label, activate_function):

    submenu = Gtk.Menu()
    sub_menuitem = Gtk.MenuItem(menu_item_label)
    menu.append(sub_menuitem)
    sub_menuitem.show()
    sub_menuitem.connect("activate", activate_function)

def activate_display_residue_distortions():
   active_atom = coot.active_residue_py()
   if active_atom:
      imol       = active_atom[0]
      chain_id   = active_atom[1]
      res_no     = active_atom[2]
      ins_code   = active_atom[3]
      atom_name  = active_atom[4]
      alt_conf   = active_atom[5]
      print("do this:", imol, chain_id, res_no, ins_code)
      coot.display_residue_distortions(imol, chain_id, res_no, ins_code)

def local_ribbons(colour_scheme):
   active_atom = coot.active_residue_py()
   if active_atom:
      imol       = active_atom[0]
      chain_id   = active_atom[1]
      res_no     = active_atom[2]
      ins_code   = active_atom[3]
      atom_name  = active_atom[4]
      alt_conf   = active_atom[5]
      coot.add_molecular_representation_py(imol, "//", colour_scheme, "Ribbon")

def set_bond_thickness_of_active_molecule(thickness):
   active_atom = coot.active_residue_py()
   if active_atom:
      imol       = active_atom[0]
      coot.set_bond_thickness(imol, thickness)
   pass

main_menubar = coot_gui_api.main_menubar()

menu_label = "Test"
menu = Gtk.Menu()
menuitem = Gtk.MenuItem(menu_label)
menuitem.set_submenu(menu)
main_menubar.append(menuitem)
menuitem.show()

menu_sub = Gtk.Menu()
menuitem_sub = Gtk.MenuItem("Other Tests")
menuitem_sub.set_submenu(menu_sub)
menu.append(menuitem_sub)
menuitem_sub.show()
add_simple_coot_menu_menuitem(menu_sub, "Screendump TGA", lambda widget : coot.screendump_tga("test.tga"))
add_simple_coot_menu_menuitem(menu_sub, "Display Residue Distortions", lambda widget : activate_display_residue_distortions())
add_simple_coot_menu_menuitem(menu_sub, "Ligand Contact Dots", lambda widget : active_ligand_contact_dots())
add_simple_coot_menu_menuitem(menu_sub, "All-Atom Contact Dots", lambda widget : active_all_atom_contact_dots())
add_simple_coot_menu_menuitem(menu_sub, "Chain Ribbons", lambda widget : local_ribbons("Chain"))
add_simple_coot_menu_menuitem(menu_sub, "Rainbow Ribbons", lambda widget : local_ribbons("colorRampChainsScheme"))
add_simple_coot_menu_menuitem(menu_sub, "Surface", lambda widget : coot.add_molecular_representation_py(0, "//", "Chain", "MolecularSurface"))
add_simple_coot_menu_menuitem(menu_sub, "bild", lambda widget : coot.import_bild('run_class001_angdist.bild'))
add_simple_coot_menu_menuitem(menu_sub, "bild-our", lambda widget : coot.import_bild('run_it005_half1_class001_angdist.bild'))
add_simple_coot_menu_menuitem(menu_sub, "Shiny 1", lambda widget : coot.set_map_shininess(1,  0.2))
add_simple_coot_menu_menuitem(menu_sub, "Shiny 2", lambda widget : coot.set_map_shininess(1,  0.5))
add_simple_coot_menu_menuitem(menu_sub, "Shiny 3", lambda widget : coot.set_map_shininess(1,  2.1))
add_simple_coot_menu_menuitem(menu_sub, "Shiny 4", lambda widget : coot.set_map_shininess(1,  9.1))
add_simple_coot_menu_menuitem(menu_sub, "Shiny 5", lambda widget : coot.set_map_shininess(1, 50.1))
add_simple_coot_menu_menuitem(menu_sub, "Shiny 6", lambda widget : coot.set_map_shininess(1, 220.1))
add_simple_coot_menu_menuitem(menu_sub, "Specular Strength 0.0", lambda widget : coot.set_map_specular_strength(1, 0.10))
add_simple_coot_menu_menuitem(menu_sub, "Specular Strength 0.1", lambda widget : coot.set_map_specular_strength(1, 0.1))
add_simple_coot_menu_menuitem(menu_sub, "Specular Strength 0.2", lambda widget : coot.set_map_specular_strength(1, 0.2))
add_simple_coot_menu_menuitem(menu_sub, "Specular Strength 0.5", lambda widget : coot.set_map_specular_strength(1, 0.5))
add_simple_coot_menu_menuitem(menu_sub, "Specular Strength 1.0", lambda widget : coot.set_map_specular_strength(1, 1.0))
add_simple_coot_menu_menuitem(menu_sub, "Specular Strength 2.0", lambda widget : coot.set_map_specular_strength(1, 2.0))
add_simple_coot_menu_menuitem(menu_sub, "Specular Strength 4.0", lambda widget : coot.set_map_specular_strength(1, 4.0))
add_simple_coot_menu_menuitem(menu_sub, "Bond width 3 ", lambda widget : set_bond_thickness_of_active_molecule(3))
add_simple_coot_menu_menuitem(menu_sub, "Bond width 4 ", lambda widget : set_bond_thickness_of_active_molecule(4))
add_simple_coot_menu_menuitem(menu_sub, "Bond width 5 ", lambda widget : set_bond_thickness_of_active_molecule(5))
add_simple_coot_menu_menuitem(menu_sub, "Bond width 6 ", lambda widget : set_bond_thickness_of_active_molecule(6))
add_simple_coot_menu_menuitem(menu_sub, "Bond width 7 ", lambda widget : set_bond_thickness_of_active_molecule(7))
add_simple_coot_menu_menuitem(menu_sub, "Bond width 8 ", lambda widget : set_bond_thickness_of_active_molecule(8))
add_simple_coot_menu_menuitem(menu_sub, "Bond width 9 ", lambda widget : set_bond_thickness_of_active_molecule(9))
add_simple_coot_menu_menuitem(menu_sub, "Bond width 10 ", lambda widget : set_bond_thickness_of_active_molecule(10))
add_simple_coot_menu_menuitem(menu_sub, "Bond width 11 ", lambda widget : set_bond_thickness_of_active_molecule(11))
add_simple_coot_menu_menuitem(menu_sub, "Bond width 12 ", lambda widget : set_bond_thickness_of_active_molecule(12))
add_simple_coot_menu_menuitem(menu_sub, "map shiny 1  10" , lambda widget : coot.set_map_material_specular(1, 1,  10))
add_simple_coot_menu_menuitem(menu_sub, "map shiny 1 200" , lambda widget : coot.set_map_material_specular(1, 1, 200))
add_simple_coot_menu_menuitem(menu_sub, "map shiny 0.1 10" , lambda widget : coot.set_map_material_specular(1, 0.1, 10))

# coot.set_default_bond_thickness(6)

def toggle_show_fps():
   state = coot.get_fps_flag()
   if state == 1:
      coot.set_show_fps(0)
   else:
      coot.set_show_fps(1)

def coot_menubar_menu(s):
   menu = Gtk.Menu()
   menuitem = Gtk.MenuItem(s)
   menuitem.set_submenu(menu)
   main_menubar = coot_gui_api.main_menubar()
   main_menubar.append(menuitem)
   menuitem.show()
   return menu

def pukka_puckers_test():
   coot_utils.pukka_puckers_qm(0)

def test_export_model():
   coot.export_molecule_as_gltf(0, "test-coot-model.glb")

def test_export_map():
   coot.export_molecule_as_gltf(1, "test-coot-map.glb")

add_module_cryo_em_gui()

add_simple_coot_menu_menuitem(menu,
                              "Framebuffer Scale 1",
                              lambda widget: coot.set_framebuffer_scale_factor(1))

add_simple_coot_menu_menuitem(menu,
                              "Framebuffer Scale 2",
                              lambda widget: coot.set_framebuffer_scale_factor(2))

add_simple_coot_menu_menuitem(menu,
                              "Toggle FPS", lambda widget: toggle_show_fps())

add_simple_coot_menu_menuitem(menu,"Show Toolbar", lambda widget: coot.set_show_modelling_toolbar(1))

add_simple_coot_menu_menuitem(menu,
                              "All-Atom Contact Dots",
                              lambda widget: active_molecule_contact_dots())

add_simple_coot_menu_menuitem(menu,
                              "Load Shaders",
                              lambda widget: coot.reload_shaders())

add_simple_coot_menu_menuitem(menu,
                              "Load Map Shaders",
                              lambda widget: coot.reload_map_shader())

add_simple_coot_menu_menuitem(menu,
                              "Effects Shader type 0",
                              lambda widget: coot.set_effects_shader_output_type(0))

add_simple_coot_menu_menuitem(menu,
                              "Effects Shader type 1",
                              lambda widget: coot.set_effects_shader_output_type(1))

add_simple_coot_menu_menuitem(menu,
                              "Effects Shader type 2",
                              lambda widget: coot.set_effects_shader_output_type(2))

add_simple_coot_menu_menuitem(menu,
                              "Effects Shader type 3",
                              lambda widget: coot.set_effects_shader_output_type(3))

add_simple_coot_menu_menuitem(menu,
                              "Use Fancy Lighting",
                              lambda widget: coot.set_use_fancy_lighting(1))

add_simple_coot_menu_menuitem(menu,
                              "Use Basic Lighting",
                              lambda widget: coot.set_use_fancy_lighting(0))

add_simple_coot_menu_menuitem(menu,
                              "Use Basic Lines for Model Molecules",
                              lambda widget: coot.set_use_simple_lines_for_model_molecules(1))

add_simple_coot_menu_menuitem(menu,
                              "Use Standard Model Molecule Representation",
                              lambda widget: coot.set_use_simple_lines_for_model_molecules(0))

add_simple_coot_menu_menuitem(menu,
                              "Reorienting Next Residue Mode",
                              lambda widget : coot.set_reorienting_next_residue_mode(1))

add_simple_coot_menu_menuitem(menu,
                              "Reorienting Next Residue Mode Off",
                              lambda widget : coot.set_reorienting_next_residue_mode(0))
   
add_simple_coot_menu_menuitem(menu,
                              "Add Map Cap",
                              lambda widget : coot.add_density_map_cap())

add_simple_coot_menu_menuitem(menu,
                              "Go To Origin",
                              lambda widget : coot.set_rotation_centre(0,0,0))

add_simple_coot_menu_menuitem(menu, "Pukka Puckers Test", lambda widget : pukka_puckers_test())

add_simple_coot_menu_menuitem(menu, "Load Test Models", lambda widget : coot.read_test_gltf_models())

add_simple_coot_menu_menuitem(menu, "Export model as glTF", lambda widget : test_export_model())

add_simple_coot_menu_menuitem(menu, "Export map as glTF", lambda widget : test_export_map())


# put this in its own menu?
for i in range(21):
   f = i/20
   if i == 0:
      f = 0.03
   label = "Background colour Grey " + str(f)
   add_simple_coot_menu_menuitem(menu, label, lambda widget,f1=f: coot.set_background_colour(f1,f1,f1))

coot.set_map_radius(18)
coot.set_dragged_refinement_steps_per_frame(2)

# coot.set_do_coot_probe_dots_during_refine(1)
# coot.set_contact_dots_density(0.8)

coot.set_show_intermediate_atoms_rota_markup(1)

coot.set_bond_smoothness_factor(2)


Reply via email to