MCPcopy Index your code
hub / github.com/python/cpython / ApplyKeybindings

Method ApplyKeybindings

Lib/idlelib/editor.py:864–902  ·  view source on GitHub ↗

Apply the virtual, configurable keybindings. Also update hotkeys to current keyset.

(self)

Source from the content-addressed store, hash-verified

862 self.text.event_delete(event, *keylist)
863
864 def ApplyKeybindings(self):
865 """Apply the virtual, configurable keybindings.
866
867 Also update hotkeys to current keyset.
868 """
869 # Called from configdialog.activate_config_changes.
870 self.mainmenu.default_keydefs = keydefs = idleConf.GetCurrentKeySet()
871 self.apply_bindings()
872 for extensionName in self.get_standard_extension_names():
873 xkeydefs = idleConf.GetExtensionBindings(extensionName)
874 if xkeydefs:
875 self.apply_bindings(xkeydefs)
876
877 # Update menu accelerators.
878 menuEventDict = {}
879 for menu in self.mainmenu.menudefs:
880 menuEventDict[menu[0]] = {}
881 for item in menu[1]:
882 if item:
883 menuEventDict[menu[0]][prepstr(item[0])[1]] = item[1]
884 for menubarItem in self.menudict:
885 menu = self.menudict[menubarItem]
886 end = menu.index(END)
887 if end is None:
888 # Skip empty menus
889 continue
890 end += 1
891 for index in range(0, end):
892 if menu.type(index) == 'command':
893 accel = menu.entrycget(index, 'accelerator')
894 if accel:
895 itemName = menu.entrycget(index, 'label')
896 event = ''
897 if menubarItem in menuEventDict:
898 if itemName in menuEventDict[menubarItem]:
899 event = menuEventDict[menubarItem][itemName]
900 if event:
901 accel = get_accelerator(keydefs, event)
902 menu.entryconfig(index, accelerator=accel)
903
904 def set_notabs_indentwidth(self):
905 "Update the indentwidth if changed and not using tabs in this window"

Callers 1

Calls 9

apply_bindingsMethod · 0.95
prepstrFunction · 0.85
get_acceleratorFunction · 0.85
GetCurrentKeySetMethod · 0.80
GetExtensionBindingsMethod · 0.80
entrycgetMethod · 0.80
indexMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected