[Python-3000-checkins] r60753 - python/branches/py3k/Lib/idlelib/configDialog.py python/branches/py3k/Lib/idlelib/configHandler.py
kurt.kaiser
python-3000-checkins at python.org
Tue Feb 12 22:34:12 CET 2008
Author: kurt.kaiser
Date: Tue Feb 12 22:34:12 2008
New Revision: 60753
Modified:
python/branches/py3k/Lib/idlelib/configDialog.py
python/branches/py3k/Lib/idlelib/configHandler.py
Log:
Convert some custom sort comparison functions to equivalent key functions.
Modified: python/branches/py3k/Lib/idlelib/configDialog.py
==============================================================================
--- python/branches/py3k/Lib/idlelib/configDialog.py (original)
+++ python/branches/py3k/Lib/idlelib/configDialog.py Tue Feb 12 22:34:12 2008
@@ -980,16 +980,11 @@
self.SetThemeType()
##load theme element option menu
themeNames = list(self.themeElements.keys())
- themeNames.sort(self.__ThemeNameIndexCompare)
+ themeNames.sort(key=lambda x: self.themeElements[x][1])
self.optMenuHighlightTarget.SetMenu(themeNames,themeNames[0])
self.PaintThemeSample()
self.SetHighlightTarget()
- def __ThemeNameIndexCompare(self,a,b):
- if self.themeElements[a][1]<self.themeElements[b][1]: return -1
- elif self.themeElements[a][1]==self.themeElements[b][1]: return 0
- else: return 1
-
def LoadKeyCfg(self):
##current keys type radiobutton
self.keysAreBuiltin.set(idleConf.GetOption('main','Keys','default',
Modified: python/branches/py3k/Lib/idlelib/configHandler.py
==============================================================================
--- python/branches/py3k/Lib/idlelib/configHandler.py (original)
+++ python/branches/py3k/Lib/idlelib/configHandler.py Tue Feb 12 22:34:12 2008
@@ -642,17 +642,9 @@
helpPath=value[1].strip()
if menuItem and helpPath: #neither are empty strings
helpSources.append( (menuItem,helpPath,option) )
- helpSources.sort(self.__helpsort)
+ helpSources.sort(key=lambda x: x[2])
return helpSources
- def __helpsort(self, h1, h2):
- if int(h1[2]) < int(h2[2]):
- return -1
- elif int(h1[2]) > int(h2[2]):
- return 1
- else:
- return 0
-
def GetAllExtraHelpSourcesList(self):
"""
Returns a list of tuples containing the details of all additional help
More information about the Python-3000-checkins
mailing list