[Idle-dev] CVS: idle configHandler.py,1.2,1.3

Stephen M. Gava elguavas@users.sourceforge.net
Thu, 25 Oct 2001 23:50:56 -0700


Update of /cvsroot/idlefork/idle
In directory usw-pr-cvs1:/tmp/cvs-serv22877

Modified Files:
	configHandler.py 
Log Message:
further work supporting reading config dialog values form config files.


Index: configHandler.py
===================================================================
RCS file: /cvsroot/idlefork/idle/configHandler.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** configHandler.py	2001/10/23 10:42:12	1.2
--- configHandler.py	2001/10/26 06:50:54	1.3
***************
*** 5,9 ****
  ## 
  ##---------------------------------------------------------------------------##
! """Provides access to configuration information"""
  
  import os
--- 5,11 ----
  ## 
  ##---------------------------------------------------------------------------##
! """
! Provides access to configuration information
! """
  
  import os
***************
*** 22,39 ****
          ConfigParser.__init__(self,defaults=cfgDefaults)
      
- #     def GetInt(self, section, option, *kw):
- #         """
- #         Get an option value as an integer
- #         """
- #         return self.Get(section, option, type='int', *kw)
- # 
- #     def GetBool(self, section, option, **kw):
- #         """
- #         Get an option value as a boolean
- #         """
- #         return self.Get(section, option, type='bool', *kw)
-         
- #    def Get(self, section, option, raw=0, vars=None, default=None, 
- #            type=None):
      def Get(self, section, option, default=None, type=None):
          """
--- 24,27 ----
***************
*** 50,57 ****
              return default
  
-     def GetSectionList(self):
-         # only provided for consistency
-         return self.sections()
-     
      def GetOptionList(self,section):
          """
--- 38,41 ----
***************
*** 139,143 ****
              self.userCfg[cfgType]=IdleUserConfParser(usrCfgFiles[cfgType])
      
!     def GetDefault(self, configType, section, option, default=None, type=None):
          """
          Get an option value for given config type and given general 
--- 123,127 ----
              self.userCfg[cfgType]=IdleUserConfParser(usrCfgFiles[cfgType])
      
!     def GetOption(self, configType, section, option, default=None, type=None):
          """
          Get an option value for given config type and given general 
***************
*** 155,158 ****
--- 139,178 ----
          else:
              return default
+     
+     def 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 ('extensions','highlight','keys')
+         """
+         if not (configType in ('extensions','highlight','keys')):
+             raise 'Invalid configType specified'
+         if configSet == 'user':
+             cfgParser=self.userCfg[configType]
+         elif configSet == 'default':
+             cfgParser=self.defaultCfg[configType]
+         else:
+             raise 'Invalid configSet specified'
+         
+         return cfgParser.sections()
+     
+     
+     def GetTheme(self, name=None):
+         """
+         Gets the requested theme or returns a final fallback theme in case 
+         one can't be obtained from either the user or default config files.
+         """
+         pass
+     
+     
+     def GetKeys(self, name=None):
+         """
+         Gets the requested keybindings or returns a final fallback keybinding 
+         set in case one can't be obtained from either the user or default 
+         config files.
+         """
+         pass
+     
      
      def LoadCfgFiles(self):