Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Private Member Functions
idlelib.configHandler.IdleConf Class Reference

List of all members.

Public Member Functions

def __init__
def CreateConfigHandlers
def GetUserCfgDir
def GetOption
def SetOption
def GetSectionList
def GetHighlight
def GetThemeDict
def CurrentTheme
def CurrentKeys
def GetExtensions
def RemoveKeyBindNames
def GetExtnNameForEvent
def GetExtensionKeys
def GetExtensionBindings
def GetKeyBinding
def GetCurrentKeySet
def GetKeySet
def IsCoreBinding
def GetCoreKeys
def GetExtraHelpSourceList
def GetAllExtraHelpSourcesList
def LoadCfgFiles
def SaveUserCfgFiles

Public Attributes

 defaultCfg
 userCfg
 cfg

Private Member Functions

def __GetRawExtensionKeys

Detailed Description

holds config parsers for all idle config files:
default config files
    (idle install dir)/config-main.def
    (idle install dir)/config-extensions.def
    (idle install dir)/config-highlight.def
    (idle install dir)/config-keys.def
user config  files
    (user home dir)/.idlerc/config-main.cfg
    (user home dir)/.idlerc/config-extensions.cfg
    (user home dir)/.idlerc/config-highlight.cfg
    (user home dir)/.idlerc/config-keys.cfg

Definition at line 152 of file configHandler.py.


Constructor & Destructor Documentation

Definition at line 166 of file configHandler.py.

00166 
00167     def __init__(self):
00168         self.defaultCfg={}
00169         self.userCfg={}
00170         self.cfg={}
00171         self.CreateConfigHandlers()
00172         self.LoadCfgFiles()
00173         #self.LoadCfg()

Here is the caller graph for this function:


Member Function Documentation

def idlelib.configHandler.IdleConf.__GetRawExtensionKeys (   self,
  extensionName 
) [private]
returns a dictionary of the configurable keybindings for a particular
extension, as defined in the configuration files, or an empty dictionary
if no bindings are found

Definition at line 463 of file configHandler.py.

00463 
00464     def __GetRawExtensionKeys(self,extensionName):
00465         """
00466         returns a dictionary of the configurable keybindings for a particular
00467         extension, as defined in the configuration files, or an empty dictionary
00468         if no bindings are found
00469         """
00470         keysName=extensionName+'_cfgBindings'
00471         extKeys={}
00472         if self.defaultCfg['extensions'].has_section(keysName):
00473             eventNames=self.defaultCfg['extensions'].GetOptionList(keysName)
00474             for eventName in eventNames:
00475                 binding=self.GetOption('extensions',keysName,
00476                         eventName,default='').split()
00477                 event='<<'+eventName+'>>'
00478                 extKeys[event]=binding
00479         return extKeys

Here is the call graph for this function:

Here is the caller graph for this function:

set up a dictionary of config parsers for default and user
configurations respectively

Definition at line 174 of file configHandler.py.

00174 
00175     def CreateConfigHandlers(self):
00176         """
00177         set up a dictionary of config parsers for default and user
00178         configurations respectively
00179         """
00180         #build idle install path
00181         if __name__ != '__main__': # we were imported
00182             idleDir=os.path.dirname(__file__)
00183         else: # we were exec'ed (for testing only)
00184             idleDir=os.path.abspath(sys.path[0])
00185         userDir=self.GetUserCfgDir()
00186         configTypes=('main','extensions','highlight','keys')
00187         defCfgFiles={}
00188         usrCfgFiles={}
00189         for cfgType in configTypes: #build config file names
00190             defCfgFiles[cfgType]=os.path.join(idleDir,'config-'+cfgType+'.def')
00191             usrCfgFiles[cfgType]=os.path.join(userDir,'config-'+cfgType+'.cfg')
00192         for cfgType in configTypes: #create config parsers
00193             self.defaultCfg[cfgType]=IdleConfParser(defCfgFiles[cfgType])
00194             self.userCfg[cfgType]=IdleUserConfParser(usrCfgFiles[cfgType])

Here is the call graph for this function:

Returns the name of the currently active key set

Definition at line 379 of file configHandler.py.

00379 
00380     def CurrentKeys(self):
00381         """
00382         Returns the name of the currently active key set
00383         """
00384         return self.GetOption('main','Keys','name',default='')

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the name of the currently active theme

Definition at line 373 of file configHandler.py.

00373 
00374     def CurrentTheme(self):
00375         """
00376         Returns the name of the currently active theme
00377         """
00378         return self.GetOption('main','Theme','name',default='')

Here is the call graph for this function:

Returns a list of tuples containing the details of all additional help
sources configured, or an empty list if there are none. Tuples are of
the format returned by GetExtraHelpSourceList.

Definition at line 660 of file configHandler.py.

00660 
00661     def GetAllExtraHelpSourcesList(self):
00662         """
00663         Returns a list of tuples containing the details of all additional help
00664         sources configured, or an empty list if there are none. Tuples are of
00665         the format returned by GetExtraHelpSourceList.
00666         """
00667         allHelpSources=( self.GetExtraHelpSourceList('default')+
00668                 self.GetExtraHelpSourceList('user') )
00669         return allHelpSources

Here is the call graph for this function:

def idlelib.configHandler.IdleConf.GetCoreKeys (   self,
  keySetName = None 
)
returns the requested set of core keybindings, with fallbacks if
required.
Keybindings loaded from the config file(s) are loaded _over_ these
defaults, so if there is a problem getting any core binding there will
be an 'ultimate last resort fallback' to the CUA-ish bindings
defined here.

Definition at line 551 of file configHandler.py.

00551 
00552     def GetCoreKeys(self, keySetName=None):
00553         """
00554         returns the requested set of core keybindings, with fallbacks if
00555         required.
00556         Keybindings loaded from the config file(s) are loaded _over_ these
00557         defaults, so if there is a problem getting any core binding there will
00558         be an 'ultimate last resort fallback' to the CUA-ish bindings
00559         defined here.
00560         """
00561         keyBindings={
00562             '<<copy>>': ['<Control-c>', '<Control-C>'],
00563             '<<cut>>': ['<Control-x>', '<Control-X>'],
00564             '<<paste>>': ['<Control-v>', '<Control-V>'],
00565             '<<beginning-of-line>>': ['<Control-a>', '<Home>'],
00566             '<<center-insert>>': ['<Control-l>'],
00567             '<<close-all-windows>>': ['<Control-q>'],
00568             '<<close-window>>': ['<Alt-F4>'],
00569             '<<do-nothing>>': ['<Control-x>'],
00570             '<<end-of-file>>': ['<Control-d>'],
00571             '<<python-docs>>': ['<F1>'],
00572             '<<python-context-help>>': ['<Shift-F1>'],
00573             '<<history-next>>': ['<Alt-n>'],
00574             '<<history-previous>>': ['<Alt-p>'],
00575             '<<interrupt-execution>>': ['<Control-c>'],
00576             '<<view-restart>>': ['<F6>'],
00577             '<<restart-shell>>': ['<Control-F6>'],
00578             '<<open-class-browser>>': ['<Alt-c>'],
00579             '<<open-module>>': ['<Alt-m>'],
00580             '<<open-new-window>>': ['<Control-n>'],
00581             '<<open-window-from-file>>': ['<Control-o>'],
00582             '<<plain-newline-and-indent>>': ['<Control-j>'],
00583             '<<print-window>>': ['<Control-p>'],
00584             '<<redo>>': ['<Control-y>'],
00585             '<<remove-selection>>': ['<Escape>'],
00586             '<<save-copy-of-window-as-file>>': ['<Alt-Shift-S>'],
00587             '<<save-window-as-file>>': ['<Alt-s>'],
00588             '<<save-window>>': ['<Control-s>'],
00589             '<<select-all>>': ['<Alt-a>'],
00590             '<<toggle-auto-coloring>>': ['<Control-slash>'],
00591             '<<undo>>': ['<Control-z>'],
00592             '<<find-again>>': ['<Control-g>', '<F3>'],
00593             '<<find-in-files>>': ['<Alt-F3>'],
00594             '<<find-selection>>': ['<Control-F3>'],
00595             '<<find>>': ['<Control-f>'],
00596             '<<replace>>': ['<Control-h>'],
00597             '<<goto-line>>': ['<Alt-g>'],
00598             '<<smart-backspace>>': ['<Key-BackSpace>'],
00599             '<<newline-and-indent>>': ['<Key-Return> <Key-KP_Enter>'],
00600             '<<smart-indent>>': ['<Key-Tab>'],
00601             '<<indent-region>>': ['<Control-Key-bracketright>'],
00602             '<<dedent-region>>': ['<Control-Key-bracketleft>'],
00603             '<<comment-region>>': ['<Alt-Key-3>'],
00604             '<<uncomment-region>>': ['<Alt-Key-4>'],
00605             '<<tabify-region>>': ['<Alt-Key-5>'],
00606             '<<untabify-region>>': ['<Alt-Key-6>'],
00607             '<<toggle-tabs>>': ['<Alt-Key-t>'],
00608             '<<change-indentwidth>>': ['<Alt-Key-u>'],
00609             '<<del-word-left>>': ['<Control-Key-BackSpace>'],
00610             '<<del-word-right>>': ['<Control-Key-Delete>']
00611             }
00612         if keySetName:
00613             for event in keyBindings:
00614                 binding=self.GetKeyBinding(keySetName,event)
00615                 if binding:
00616                     keyBindings[event]=binding
00617                 else: #we are going to return a default, print warning
00618                     warning=('\n Warning: configHandler.py - IdleConf.GetCoreKeys'
00619                                ' -\n problem retrieving key binding for event %r'
00620                                '\n from key set %r.\n'
00621                                ' returning default value: %r\n' %
00622                                (event, keySetName, keyBindings[event]))
00623                     try:
00624                         sys.stderr.write(warning)
00625                     except IOError:
00626                         pass
00627         return keyBindings

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 511 of file configHandler.py.

00511 
00512     def GetCurrentKeySet(self):
00513         result = self.GetKeySet(self.CurrentKeys())
00514 
00515         if macosxSupport.runningAsOSXApp():
00516             # We're using AquaTk, replace all keybingings that use the
00517             # Alt key by ones that use the Option key because the former
00518             # don't work reliably.
00519             for k, v in result.items():
00520                 v2 = [ x.replace('<Alt-', '<Option-') for x in v ]
00521                 if v != v2:
00522                     result[k] = v2
00523 
00524         return result

Here is the call graph for this function:

Here is the caller graph for this function:

def idlelib.configHandler.IdleConf.GetExtensionBindings (   self,
  extensionName 
)
Returns a dictionary of all the event bindings for a particular
extension. The configurable keybindings are returned as they exist in
the dictionary returned by GetCurrentKeySet; that is, where re-used
keybindings are disabled.

Definition at line 480 of file configHandler.py.

00480 
00481     def GetExtensionBindings(self,extensionName):
00482         """
00483         Returns a dictionary of all the event bindings for a particular
00484         extension. The configurable keybindings are returned as they exist in
00485         the dictionary returned by GetCurrentKeySet; that is, where re-used
00486         keybindings are disabled.
00487         """
00488         bindsName=extensionName+'_bindings'
00489         extBinds=self.GetExtensionKeys(extensionName)
00490         #add the non-configurable bindings
00491         if self.defaultCfg['extensions'].has_section(bindsName):
00492             eventNames=self.defaultCfg['extensions'].GetOptionList(bindsName)
00493             for eventName in eventNames:
00494                 binding=self.GetOption('extensions',bindsName,
00495                         eventName,default='').split()
00496                 event='<<'+eventName+'>>'
00497                 extBinds[event]=binding
00498 
00499         return extBinds

Here is the call graph for this function:

def idlelib.configHandler.IdleConf.GetExtensionKeys (   self,
  extensionName 
)
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.

Definition at line 446 of file configHandler.py.

00446 
00447     def GetExtensionKeys(self,extensionName):
00448         """
00449         returns a dictionary of the configurable keybindings for a particular
00450         extension,as they exist in the dictionary returned by GetCurrentKeySet;
00451         that is, where previously used bindings are disabled.
00452         """
00453         keysName=extensionName+'_cfgBindings'
00454         activeKeys=self.GetCurrentKeySet()
00455         extKeys={}
00456         if self.defaultCfg['extensions'].has_section(keysName):
00457             eventNames=self.defaultCfg['extensions'].GetOptionList(keysName)
00458             for eventName in eventNames:
00459                 event='<<'+eventName+'>>'
00460                 binding=activeKeys[event]
00461                 extKeys[event]=binding
00462         return extKeys

Here is the call graph for this function:

Here is the caller graph for this function:

def idlelib.configHandler.IdleConf.GetExtensions (   self,
  active_only = True,
  editor_only = False,
  shell_only = False 
)
Gets a list of all idle extensions declared in the config files.
active_only - boolean, if true only return active (enabled) extensions

Definition at line 385 of file configHandler.py.

00385 
00386     def GetExtensions(self, active_only=True, editor_only=False, shell_only=False):
00387         """
00388         Gets a list of all idle extensions declared in the config files.
00389         active_only - boolean, if true only return active (enabled) extensions
00390         """
00391         extns=self.RemoveKeyBindNames(
00392                 self.GetSectionList('default','extensions'))
00393         userExtns=self.RemoveKeyBindNames(
00394                 self.GetSectionList('user','extensions'))
00395         for extn in userExtns:
00396             if extn not in extns: #user has added own extension
00397                 extns.append(extn)
00398         if active_only:
00399             activeExtns=[]
00400             for extn in extns:
00401                 if self.GetOption('extensions', extn, 'enable', default=True,
00402                                   type='bool'):
00403                     #the extension is enabled
00404                     if editor_only or shell_only:
00405                         if editor_only:
00406                             option = "enable_editor"
00407                         else:
00408                             option = "enable_shell"
00409                         if self.GetOption('extensions', extn,option,
00410                                           default=True, type='bool',
00411                                           warn_on_default=False):
00412                             activeExtns.append(extn)
00413                     else:
00414                         activeExtns.append(extn)
00415             return activeExtns
00416         else:
00417             return extns

Here is the call graph for this function:

Here is the caller graph for this function:

def idlelib.configHandler.IdleConf.GetExtnNameForEvent (   self,
  virtualEvent 
)
Returns the name of the extension that virtualEvent is bound in, or
None if not bound in any extension.
virtualEvent - string, name of the virtual event to test for, without
       the enclosing '<< >>'

Definition at line 431 of file configHandler.py.

00431 
00432     def GetExtnNameForEvent(self,virtualEvent):
00433         """
00434         Returns the name of the extension that virtualEvent is bound in, or
00435         None if not bound in any extension.
00436         virtualEvent - string, name of the virtual event to test for, without
00437                        the enclosing '<< >>'
00438         """
00439         extName=None
00440         vEvent='<<'+virtualEvent+'>>'
00441         for extn in self.GetExtensions(active_only=0):
00442             for event in self.GetExtensionKeys(extn):
00443                 if event == vEvent:
00444                     extName=extn
00445         return extName

Here is the call graph for this function:

Fetch list of extra help sources from a given configSet.

Valid configSets are 'user' or 'default'.  Return a list of tuples of
the form (menu_item , path_to_help_file , option), or return the empty
list.  'option' is the sequence number of the help resource.  'option'
values determine the position of the menu items on the Help menu,
therefore the returned list must be sorted by 'option'.

Definition at line 628 of file configHandler.py.

00628 
00629     def GetExtraHelpSourceList(self,configSet):
00630         """Fetch list of extra help sources from a given configSet.
00631 
00632         Valid configSets are 'user' or 'default'.  Return a list of tuples of
00633         the form (menu_item , path_to_help_file , option), or return the empty
00634         list.  'option' is the sequence number of the help resource.  'option'
00635         values determine the position of the menu items on the Help menu,
00636         therefore the returned list must be sorted by 'option'.
00637 
00638         """
00639         helpSources=[]
00640         if configSet=='user':
00641             cfgParser=self.userCfg['main']
00642         elif configSet=='default':
00643             cfgParser=self.defaultCfg['main']
00644         else:
00645             raise InvalidConfigSet('Invalid configSet specified')
00646         options=cfgParser.GetOptionList('HelpFiles')
00647         for option in options:
00648             value=cfgParser.Get('HelpFiles',option,default=';')
00649             if value.find(';')==-1: #malformed config entry with no ';'
00650                 menuItem='' #make these empty
00651                 helpPath='' #so value won't be added to list
00652             else: #config entry contains ';' as expected
00653                 value=value.split(';')
00654                 menuItem=value[0].strip()
00655                 helpPath=value[1].strip()
00656             if menuItem and helpPath: #neither are empty strings
00657                 helpSources.append( (menuItem,helpPath,option) )
00658         helpSources.sort(key=lambda x: x[2])
00659         return helpSources

Here is the caller graph for this function:

def idlelib.configHandler.IdleConf.GetHighlight (   self,
  theme,
  element,
  fgBg = None 
)
return individual highlighting theme elements.
fgBg - string ('fg'or'bg') or None, if None return a dictionary
containing fg and bg colours (appropriate for passing to Tkinter in,
e.g., a tag_config call), otherwise fg or bg colour only as specified.

Definition at line 282 of file configHandler.py.

00282 
00283     def GetHighlight(self, theme, element, fgBg=None):
00284         """
00285         return individual highlighting theme elements.
00286         fgBg - string ('fg'or'bg') or None, if None return a dictionary
00287         containing fg and bg colours (appropriate for passing to Tkinter in,
00288         e.g., a tag_config call), otherwise fg or bg colour only as specified.
00289         """
00290         if self.defaultCfg['highlight'].has_section(theme):
00291             themeDict=self.GetThemeDict('default',theme)
00292         else:
00293             themeDict=self.GetThemeDict('user',theme)
00294         fore=themeDict[element+'-foreground']
00295         if element=='cursor': #there is no config value for cursor bg
00296             back=themeDict['normal-background']
00297         else:
00298             back=themeDict[element+'-background']
00299         highlight={"foreground": fore,"background": back}
00300         if not fgBg: #return dict of both colours
00301             return highlight
00302         else: #return specified colour only
00303             if fgBg == 'fg':
00304                 return highlight["foreground"]
00305             if fgBg == 'bg':
00306                 return highlight["background"]
00307             else:
00308                 raise InvalidFgBg('Invalid fgBg specified')

Here is the call graph for this function:

def idlelib.configHandler.IdleConf.GetKeyBinding (   self,
  keySetName,
  eventStr 
)
returns the keybinding for a specific event.
keySetName - string, name of key binding set
eventStr - string, the virtual event we want the binding for,
   represented as a string, eg. '<<event>>'

Definition at line 500 of file configHandler.py.

00500 
00501     def GetKeyBinding(self, keySetName, eventStr):
00502         """
00503         returns the keybinding for a specific event.
00504         keySetName - string, name of key binding set
00505         eventStr - string, the virtual event we want the binding for,
00506                    represented as a string, eg. '<<event>>'
00507         """
00508         eventName=eventStr[2:-2] #trim off the angle brackets
00509         binding=self.GetOption('keys',keySetName,eventName,default='').split()
00510         return binding

Here is the call graph for this function:

Here is the caller graph for this function:

def idlelib.configHandler.IdleConf.GetKeySet (   self,
  keySetName 
)
Returns a dictionary of: all requested core keybindings, plus the
keybindings for all currently active extensions. If a binding defined
in an extension is already in use, that binding is disabled.

Definition at line 525 of file configHandler.py.

00525 
00526     def GetKeySet(self,keySetName):
00527         """
00528         Returns a dictionary of: all requested core keybindings, plus the
00529         keybindings for all currently active extensions. If a binding defined
00530         in an extension is already in use, that binding is disabled.
00531         """
00532         keySet=self.GetCoreKeys(keySetName)
00533         activeExtns=self.GetExtensions(active_only=1)
00534         for extn in activeExtns:
00535             extKeys=self.__GetRawExtensionKeys(extn)
00536             if extKeys: #the extension defines keybindings
00537                 for event in extKeys:
00538                     if extKeys[event] in keySet.values():
00539                         #the binding is already in use
00540                         extKeys[event]='' #disable this binding
00541                     keySet[event]=extKeys[event] #add binding
00542         return keySet

Here is the call graph for this function:

Here is the caller graph for this function:

def idlelib.configHandler.IdleConf.GetOption (   self,
  configType,
  section,
  option,
  default = None,
  type = None,
  warn_on_default = True,
  raw = False 
)
Get an option value for given config type and given general
configuration section/option or return a default. If type is specified,
return as type. Firstly the user configuration is checked, with a
fallback to the default configuration, and a final 'catch all'
fallback to a useable passed-in default if the option isn't present in
either the user or the default configuration.
configType must be one of ('main','extensions','highlight','keys')
If a default is returned, and warn_on_default is True, a warning is
printed to stderr.

Definition at line 227 of file configHandler.py.

00227 
00228                   warn_on_default=True, raw=False):
00229         """
00230         Get an option value for given config type and given general
00231         configuration section/option or return a default. If type is specified,
00232         return as type. Firstly the user configuration is checked, with a
00233         fallback to the default configuration, and a final 'catch all'
00234         fallback to a useable passed-in default if the option isn't present in
00235         either the user or the default configuration.
00236         configType must be one of ('main','extensions','highlight','keys')
00237         If a default is returned, and warn_on_default is True, a warning is
00238         printed to stderr.
00239 
00240         """
00241         if self.userCfg[configType].has_option(section,option):
00242             return self.userCfg[configType].Get(section, option,
00243                                                 type=type, raw=raw)
00244         elif self.defaultCfg[configType].has_option(section,option):
00245             return self.defaultCfg[configType].Get(section, option,
00246                                                    type=type, raw=raw)
00247         else: #returning default, print warning
00248             if warn_on_default:
00249                 warning = ('\n Warning: configHandler.py - IdleConf.GetOption -\n'
00250                            ' problem retrieving configuration option %r\n'
00251                            ' from section %r.\n'
00252                            ' returning default value: %r\n' %
00253                            (option, section, default))
00254                 try:
00255                     sys.stderr.write(warning)
00256                 except IOError:
00257                     pass
00258             return default

Here is the caller graph for this function:

def idlelib.configHandler.IdleConf.GetSectionList (   self,
  configSet,
  configType 
)
Get a list of sections from either the user or default config for
the given config type.
configSet must be either 'user' or 'default'
configType must be one of ('main','extensions','highlight','keys')

Definition at line 265 of file configHandler.py.

00265 
00266     def GetSectionList(self, configSet, configType):
00267         """
00268         Get a list of sections from either the user or default config for
00269         the given config type.
00270         configSet must be either 'user' or 'default'
00271         configType must be one of ('main','extensions','highlight','keys')
00272         """
00273         if not (configType in ('main','extensions','highlight','keys')):
00274             raise InvalidConfigType('Invalid configType specified')
00275         if configSet == 'user':
00276             cfgParser=self.userCfg[configType]
00277         elif configSet == 'default':
00278             cfgParser=self.defaultCfg[configType]
00279         else:
00280             raise InvalidConfigSet('Invalid configSet specified')
00281         return cfgParser.sections()

Here is the caller graph for this function:

def idlelib.configHandler.IdleConf.GetThemeDict (   self,
  type,
  themeName 
)
type - string, 'default' or 'user' theme type
themeName - string, theme name
Returns a dictionary which holds {option:value} for each element
in the specified theme. Values are loaded over a set of ultimate last
fallback defaults to guarantee that all theme elements are present in
a newly created theme.

Definition at line 309 of file configHandler.py.

00309 
00310     def GetThemeDict(self,type,themeName):
00311         """
00312         type - string, 'default' or 'user' theme type
00313         themeName - string, theme name
00314         Returns a dictionary which holds {option:value} for each element
00315         in the specified theme. Values are loaded over a set of ultimate last
00316         fallback defaults to guarantee that all theme elements are present in
00317         a newly created theme.
00318         """
00319         if type == 'user':
00320             cfgParser=self.userCfg['highlight']
00321         elif type == 'default':
00322             cfgParser=self.defaultCfg['highlight']
00323         else:
00324             raise InvalidTheme('Invalid theme type specified')
00325         #foreground and background values are provded for each theme element
00326         #(apart from cursor) even though all these values are not yet used
00327         #by idle, to allow for their use in the future. Default values are
00328         #generally black and white.
00329         theme={ 'normal-foreground':'#000000',
00330                 'normal-background':'#ffffff',
00331                 'keyword-foreground':'#000000',
00332                 'keyword-background':'#ffffff',
00333                 'builtin-foreground':'#000000',
00334                 'builtin-background':'#ffffff',
00335                 'comment-foreground':'#000000',
00336                 'comment-background':'#ffffff',
00337                 'string-foreground':'#000000',
00338                 'string-background':'#ffffff',
00339                 'definition-foreground':'#000000',
00340                 'definition-background':'#ffffff',
00341                 'hilite-foreground':'#000000',
00342                 'hilite-background':'gray',
00343                 'break-foreground':'#ffffff',
00344                 'break-background':'#000000',
00345                 'hit-foreground':'#ffffff',
00346                 'hit-background':'#000000',
00347                 'error-foreground':'#ffffff',
00348                 'error-background':'#000000',
00349                 #cursor (only foreground can be set)
00350                 'cursor-foreground':'#000000',
00351                 #shell window
00352                 'stdout-foreground':'#000000',
00353                 'stdout-background':'#ffffff',
00354                 'stderr-foreground':'#000000',
00355                 'stderr-background':'#ffffff',
00356                 'console-foreground':'#000000',
00357                 'console-background':'#ffffff' }
00358         for element in theme:
00359             if not cfgParser.has_option(themeName,element):
00360                 #we are going to return a default, print warning
00361                 warning=('\n Warning: configHandler.py - IdleConf.GetThemeDict'
00362                            ' -\n problem retrieving theme element %r'
00363                            '\n from theme %r.\n'
00364                            ' returning default value: %r\n' %
00365                            (element, themeName, theme[element]))
00366                 try:
00367                     sys.stderr.write(warning)
00368                 except IOError:
00369                     pass
00370             colour=cfgParser.Get(themeName,element,default=theme[element])
00371             theme[element]=colour
00372         return theme

Here is the caller graph for this function:

Creates (if required) and returns a filesystem directory for storing
user config files.

Definition at line 195 of file configHandler.py.

00195 
00196     def GetUserCfgDir(self):
00197         """
00198         Creates (if required) and returns a filesystem directory for storing
00199         user config files.
00200 
00201         """
00202         cfgDir = '.idlerc'
00203         userDir = os.path.expanduser('~')
00204         if userDir != '~': # expanduser() found user home dir
00205             if not os.path.exists(userDir):
00206                 warn = ('\n Warning: os.path.expanduser("~") points to\n '+
00207                         userDir+',\n but the path does not exist.\n')
00208                 try:
00209                     sys.stderr.write(warn)
00210                 except IOError:
00211                     pass
00212                 userDir = '~'
00213         if userDir == "~": # still no path to home!
00214             # traditionally IDLE has defaulted to os.getcwd(), is this adequate?
00215             userDir = os.getcwd()
00216         userDir = os.path.join(userDir, cfgDir)
00217         if not os.path.exists(userDir):
00218             try:
00219                 os.mkdir(userDir)
00220             except (OSError, IOError):
00221                 warn = ('\n Warning: unable to create user config directory\n'+
00222                         userDir+'\n Check path and permissions.\n Exiting!\n\n')
00223                 sys.stderr.write(warn)
00224                 raise SystemExit
00225         return userDir

Here is the call graph for this function:

Here is the caller graph for this function:

def idlelib.configHandler.IdleConf.IsCoreBinding (   self,
  virtualEvent 
)
returns true if the virtual event is bound in the core idle keybindings.
virtualEvent - string, name of the virtual event to test for, without
       the enclosing '<< >>'

Definition at line 543 of file configHandler.py.

00543 
00544     def IsCoreBinding(self,virtualEvent):
00545         """
00546         returns true if the virtual event is bound in the core idle keybindings.
00547         virtualEvent - string, name of the virtual event to test for, without
00548                        the enclosing '<< >>'
00549         """
00550         return ('<<'+virtualEvent+'>>') in self.GetCoreKeys()

Here is the call graph for this function:

load all configuration files.

Definition at line 670 of file configHandler.py.

00670 
00671     def LoadCfgFiles(self):
00672         """
00673         load all configuration files.
00674         """
00675         for key in self.defaultCfg:
00676             self.defaultCfg[key].Load()
00677             self.userCfg[key].Load() #same keys

def idlelib.configHandler.IdleConf.RemoveKeyBindNames (   self,
  extnNameList 
)

Definition at line 418 of file configHandler.py.

00418 
00419     def RemoveKeyBindNames(self,extnNameList):
00420         #get rid of keybinding section names
00421         names=extnNameList
00422         kbNameIndicies=[]
00423         for name in names:
00424             if name.endswith(('_bindings', '_cfgBindings')):
00425                 kbNameIndicies.append(names.index(name))
00426         kbNameIndicies.sort()
00427         kbNameIndicies.reverse()
00428         for index in kbNameIndicies: #delete each keybinding section name
00429             del(names[index])
00430         return names

Here is the caller graph for this function:

write all loaded user configuration files back to disk

Definition at line 678 of file configHandler.py.

00678 
00679     def SaveUserCfgFiles(self):
00680         """
00681         write all loaded user configuration files back to disk
00682         """
00683         for key in self.userCfg:
00684             self.userCfg[key].Save()
00685 
00686 idleConf=IdleConf()

def idlelib.configHandler.IdleConf.SetOption (   self,
  configType,
  section,
  option,
  value 
)
In user's config file, set section's option to value.

Definition at line 259 of file configHandler.py.

00259 
00260     def SetOption(self, configType, section, option, value):
00261         """In user's config file, set section's option to value.
00262 
00263         """
00264         self.userCfg[configType].SetOption(section, option, value)


Member Data Documentation

Definition at line 169 of file configHandler.py.

Definition at line 167 of file configHandler.py.

Definition at line 168 of file configHandler.py.


The documentation for this class was generated from the following file: