Apply the virtual, configurable keybindings. Also update hotkeys to current keyset.
(self)
| 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" |
no test coverage detected