Skip to content

Instantly share code, notes, and snippets.

@sahutd
Created June 12, 2014 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sahutd/474031c15ee0154ef4bc to your computer and use it in GitHub Desktop.
Save sahutd/474031c15ee0154ef4bc to your computer and use it in GitHub Desktop.
diff -r 25fd9aeeff91 Lib/idlelib/EditorWindow.py
--- a/Lib/idlelib/EditorWindow.py Thu Jun 12 01:03:08 2014 -0400
+++ b/Lib/idlelib/EditorWindow.py Thu Jun 12 19:28:54 2014 +0530
@@ -1052,6 +1052,7 @@
self.extensions = {}
def load_standard_extensions(self):
+ self.activeKeys = idleConf.GetCurrentKeySet()
for name in self.get_standard_extension_names():
try:
self.load_extension(name)
@@ -1072,7 +1073,7 @@
print("\nFailed to import extension: ", name)
raise
cls = getattr(mod, name)
- keydefs = idleConf.GetExtensionBindings(name)
+ keydefs = idleConf.GetExtensionBindings(name, activeKeys=self.activeKeys)
if hasattr(cls, "menudefs"):
self.fill_menus(cls.menudefs, keydefs)
ins = cls(self)
diff -r 25fd9aeeff91 Lib/idlelib/configHandler.py
--- a/Lib/idlelib/configHandler.py Thu Jun 12 01:03:08 2014 -0400
+++ b/Lib/idlelib/configHandler.py Thu Jun 12 19:28:54 2014 +0530
@@ -458,14 +458,15 @@
extName=extn
return extName
- def GetExtensionKeys(self,extensionName):
+ def GetExtensionKeys(self,extensionName, activeKeys=None):
"""
returns a dictionary of the configurable keybindings for a particular
extension,as they exist in the dictionary returned by GetCurrentKeySet;
that is, where previously used bindings are disabled.
"""
keysName=extensionName+'_cfgBindings'
- activeKeys=self.GetCurrentKeySet()
+ if not activeKeys:
+ activeKeys=self.GetCurrentKeySet()
extKeys={}
if self.defaultCfg['extensions'].has_section(keysName):
eventNames=self.defaultCfg['extensions'].GetOptionList(keysName)
@@ -492,7 +493,7 @@
extKeys[event]=binding
return extKeys
- def GetExtensionBindings(self,extensionName):
+ def GetExtensionBindings(self,extensionName, activeKeys=None):
"""
Returns a dictionary of all the event bindings for a particular
extension. The configurable keybindings are returned as they exist in
@@ -500,7 +501,7 @@
keybindings are disabled.
"""
bindsName=extensionName+'_bindings'
- extBinds=self.GetExtensionKeys(extensionName)
+ extBinds=self.GetExtensionKeys(extensionName, activeKeys=activeKeys)
#add the non-configurable bindings
if self.defaultCfg['extensions'].has_section(bindsName):
eventNames=self.defaultCfg['extensions'].GetOptionList(bindsName)
ncalls tottime percall cumtime percall filename:lineno(function)
874 0.013 0.000 0.101 0.000 configHandler.py:41(Get)
178 0.003 0.000 0.032 0.000 configHandler.py:226(GetOption)
98 0.001 0.000 0.017 0.000 configHandler.py:516(GetKeyBinding)
26 0.008 0.000 0.097 0.004 configHandler.py:324(GetThemeDict)
26 0.001 0.000 0.098 0.004 configHandler.py:297(GetHighlight)
25 0.000 0.000 0.007 0.000 configHandler.py:55(GetOptionList)
18 0.001 0.000 0.007 0.000 configHandler.py:479(__GetRawExtensionKeys)
8 0.000 0.000 0.005 0.001 configHandler.py:34(__init__)
8 0.000 0.000 0.075 0.009 configHandler.py:64(Load)
6 0.000 0.000 0.001 0.000 configHandler.py:280(GetSectionList)
6 0.000 0.000 0.001 0.000 configHandler.py:433(RemoveKeyBindNames)
6 0.000 0.000 0.004 0.001 configHandler.py:496(GetExtensionBindings)
6 0.000 0.000 0.002 0.000 configHandler.py:461(GetExtensionKeys)
3 0.000 0.000 0.009 0.003 configHandler.py:400(GetExtensions)
2 0.000 0.000 0.001 0.000 configHandler.py:195(GetUserCfgDir)
2 0.000 0.000 0.001 0.000 configHandler.py:647(GetExtraHelpSourceList)
2 0.001 0.000 0.032 0.016 configHandler.py:544(GetKeySet)
2 0.000 0.000 0.001 0.000 configHandler.py:388(CurrentTheme)
2 0.000 0.000 0.000 0.000 configHandler.py:394(CurrentKeys)
2 0.000 0.000 0.032 0.016 configHandler.py:527(GetCurrentKeySet)
2 0.001 0.000 0.018 0.009 configHandler.py:570(GetCoreKeys)
1 0.000 0.000 0.000 0.000 configHandler.py:30(IdleConfParser)
1 0.000 0.000 0.075 0.075 configHandler.py:689(LoadCfgFiles)
1 0.000 0.000 0.006 0.006 configHandler.py:174(CreateConfigHandlers)
1 0.000 0.000 0.000 0.000 configHandler.py:27(InvalidFgBg)
1 0.000 0.000 0.125 0.125 configHandler.py:19(<module>)
1 0.000 0.000 0.081 0.081 configHandler.py:166(__init__)
1 0.000 0.000 0.000 0.000 configHandler.py:25(InvalidConfigType)
1 0.000 0.000 0.000 0.000 configHandler.py:28(InvalidTheme)
1 0.000 0.000 0.000 0.000 configHandler.py:26(InvalidConfigSet)
1 0.000 0.000 0.000 0.000 configHandler.py:152(IdleConf)
1 0.000 0.000 0.001 0.001 configHandler.py:679(GetAllExtraHelpSourcesList)
1 0.000 0.000 0.000 0.000 configHandler.py:70(IdleUserConfParser)
ncalls tottime percall cumtime percall filename:lineno(function)
1209 0.018 0.000 0.139 0.000 configHandler.py:41(Get)
513 0.009 0.000 0.083 0.000 configHandler.py:226(GetOption)
343 0.004 0.000 0.058 0.000 configHandler.py:515(GetKeyBinding)
63 0.002 0.000 0.025 0.000 configHandler.py:478(__GetRawExtensionKeys)
60 0.001 0.000 0.016 0.000 configHandler.py:55(GetOptionList)
26 0.001 0.000 0.101 0.004 configHandler.py:297(GetHighlight)
26 0.008 0.000 0.100 0.004 configHandler.py:324(GetThemeDict)
16 0.001 0.000 0.002 0.000 configHandler.py:433(RemoveKeyBindNames)
16 0.000 0.000 0.002 0.000 configHandler.py:280(GetSectionList)
8 0.000 0.000 0.005 0.001 configHandler.py:34(__init__)
8 0.001 0.000 0.018 0.002 configHandler.py:400(GetExtensions)
8 0.000 0.000 0.072 0.009 configHandler.py:64(Load)
7 0.003 0.000 0.061 0.009 configHandler.py:569(GetCoreKeys)
7 0.002 0.000 0.104 0.015 configHandler.py:543(GetKeySet)
7 0.000 0.000 0.002 0.000 configHandler.py:394(CurrentKeys)
7 0.000 0.000 0.105 0.015 configHandler.py:526(GetCurrentKeySet)
6 0.000 0.000 0.092 0.015 configHandler.py:461(GetExtensionKeys)
6 0.001 0.000 0.094 0.016 configHandler.py:495(GetExtensionBindings)
2 0.000 0.000 0.001 0.000 configHandler.py:646(GetExtraHelpSourceList)
2 0.000 0.000 0.001 0.000 configHandler.py:388(CurrentTheme)
2 0.000 0.000 0.001 0.000 configHandler.py:195(GetUserCfgDir)
1 0.000 0.000 0.001 0.001 configHandler.py:678(GetAllExtraHelpSourcesList)
1 0.000 0.000 0.006 0.006 configHandler.py:174(CreateConfigHandlers)
1 0.000 0.000 0.000 0.000 configHandler.py:25(InvalidConfigType)
1 0.000 0.000 0.073 0.073 configHandler.py:688(LoadCfgFiles)
1 0.000 0.000 0.000 0.000 configHandler.py:27(InvalidFgBg)
1 0.000 0.000 0.124 0.124 configHandler.py:19(<module>)
1 0.000 0.000 0.000 0.000 configHandler.py:70(IdleUserConfParser)
1 0.000 0.000 0.000 0.000 configHandler.py:26(InvalidConfigSet)
1 0.000 0.000 0.000 0.000 configHandler.py:30(IdleConfParser)
1 0.000 0.000 0.000 0.000 configHandler.py:28(InvalidTheme)
1 0.000 0.000 0.000 0.000 configHandler.py:152(IdleConf)
1 0.000 0.000 0.078 0.078 configHandler.py:166(__init__)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment