Changeset 391 for python/trunk/Lib/idlelib/configHandler.py
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Lib/idlelib/configHandler.py
r2 r391 21 21 import sys 22 22 import string 23 import macosxSupport23 from idlelib import macosxSupport 24 24 from ConfigParser import ConfigParser, NoOptionError, NoSectionError 25 25 … … 238 238 239 239 """ 240 if self.userCfg[configType].has_option(section,option): 241 return self.userCfg[configType].Get(section, option, 242 type=type, raw=raw) 243 elif self.defaultCfg[configType].has_option(section,option): 244 return self.defaultCfg[configType].Get(section, option, 245 type=type, raw=raw) 246 else: #returning default, print warning 247 if warn_on_default: 248 warning = ('\n Warning: configHandler.py - IdleConf.GetOption -\n' 249 ' problem retrieving configration option %r\n' 250 ' from section %r.\n' 251 ' returning default value: %r\n' % 252 (option, section, default)) 253 try: 254 sys.stderr.write(warning) 255 except IOError: 256 pass 257 return default 240 try: 241 if self.userCfg[configType].has_option(section,option): 242 return self.userCfg[configType].Get(section, option, 243 type=type, raw=raw) 244 except ValueError: 245 warning = ('\n Warning: configHandler.py - IdleConf.GetOption -\n' 246 ' invalid %r value for configuration option %r\n' 247 ' from section %r: %r\n' % 248 (type, option, section, 249 self.userCfg[configType].Get(section, option, 250 raw=raw))) 251 try: 252 sys.stderr.write(warning) 253 except IOError: 254 pass 255 try: 256 if self.defaultCfg[configType].has_option(section,option): 257 return self.defaultCfg[configType].Get(section, option, 258 type=type, raw=raw) 259 except ValueError: 260 pass 261 #returning default, print warning 262 if warn_on_default: 263 warning = ('\n Warning: configHandler.py - IdleConf.GetOption -\n' 264 ' problem retrieving configuration option %r\n' 265 ' from section %r.\n' 266 ' returning default value: %r\n' % 267 (option, section, default)) 268 try: 269 sys.stderr.write(warning) 270 except IOError: 271 pass 272 return default 258 273 259 274 def SetOption(self, configType, section, option, value): … … 596 611 '<<goto-line>>': ['<Alt-g>'], 597 612 '<<smart-backspace>>': ['<Key-BackSpace>'], 598 '<<newline-and-indent>>': ['<Key-Return> 613 '<<newline-and-indent>>': ['<Key-Return>', '<Key-KP_Enter>'], 599 614 '<<smart-indent>>': ['<Key-Tab>'], 600 615 '<<indent-region>>': ['<Control-Key-bracketright>'], … … 655 670 if menuItem and helpPath: #neither are empty strings 656 671 helpSources.append( (menuItem,helpPath,option) ) 657 helpSources.sort( self.__helpsort)672 helpSources.sort(key=lambda x: int(x[2])) 658 673 return helpSources 659 660 def __helpsort(self, h1, h2):661 if int(h1[2]) < int(h2[2]):662 return -1663 elif int(h1[2]) > int(h2[2]):664 return 1665 else:666 return 0667 674 668 675 def GetAllExtraHelpSourcesList(self):
Note:
See TracChangeset
for help on using the changeset viewer.