[Idle-dev] CVS: idle configDialog.py,1.16,1.17 configHandler.py,1.5,1.6

Stephen M. Gava elguavas@users.sourceforge.net
Sat, 03 Nov 2001 23:03:10 -0800


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

Modified Files:
	configDialog.py configHandler.py 
Log Message:
further config system work


Index: configDialog.py
===================================================================
RCS file: /cvsroot/idlefork/idle/configDialog.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** configDialog.py	2001/11/03 14:54:25	1.16
--- configDialog.py	2001/11/04 07:03:08	1.17
***************
*** 321,328 ****
              (' ','normal'),('func','definition'),('(param):','normal'),
              ('\n  ','normal'),('"""string"""','string'),('\n  var0 = ','normal'),
!             ("'string'",'string'),('\n  var1 = ','normal'),("'selected'",'selected'),('\n  var2 = ','normal'),
!             ("'found'",'found'),('\n\n','normal'),(' error ','error'),
!             ('cursor |','cursor'),('\n ','normal'),('shell','shfg'),(' ','normal'),('stdout','shstdout'),(' ','normal'),
!             ('stderr','shstderr'))
          for txTa in textAndTags:
              text.insert(END,txTa[0],txTa[1])
--- 321,329 ----
              (' ','normal'),('func','definition'),('(param):','normal'),
              ('\n  ','normal'),('"""string"""','string'),('\n  var0 = ','normal'),
!             ("'string'",'string'),('\n  var1 = ','normal'),("'selected'",'selected'),
!             ('\n  var2 = ','normal'),("'found'",'found'),('\n\n','normal'),
!             (' error ','error'),(' ','normal'),('cursor |','cursor'),
!             ('\n ','normal'),('shell','shfg'),(' ','normal'),('stdout','shstdout'),
!             (' ','normal'),('stderr','shstderr'),('\n','normal'))
          for txTa in textAndTags:
              text.insert(END,txTa[0],txTa[1])
***************
*** 536,541 ****
  
      def PaintThemeSample(self):
!         pass
!                 
      def LoadFontCfg(self):
          ##base editor font selection list
--- 537,570 ----
  
      def PaintThemeSample(self):
!         if self.themeBuiltin.get: #a default theme
!             theme=self.builtinTheme.get()
!         else: #a user theme
!             theme=self.customTheme.get()
!         colours=idleConf.GetHighlight(theme, 'normal')
!         #normalBg=colours['background']
!         apply(self.textHighlightSample.tag_config,('normal',),colours)
!         colours=idleConf.GetHighlight(theme, 'keyword')
!         apply(self.textHighlightSample.tag_config,('keyword',),colours)
!         colours=idleConf.GetHighlight(theme, 'comment')
!         apply(self.textHighlightSample.tag_config,('comment',),colours)
!         colours=idleConf.GetHighlight(theme, 'definition')
!         apply(self.textHighlightSample.tag_config,('definition',),colours)
!         colours=idleConf.GetHighlight(theme, 'string')
!         apply(self.textHighlightSample.tag_config,('string',),colours)
!         colours=idleConf.GetHighlight(theme, 'hilite')
!         apply(self.textHighlightSample.tag_config,('selected',),colours)
!         colours=idleConf.GetHighlight(theme, 'hit')
!         apply(self.textHighlightSample.tag_config,('found',),colours)
!         colours=idleConf.GetHighlight(theme, 'cursor')
!         apply(self.textHighlightSample.tag_config,('cursor',),colours)
!         colours=idleConf.GetHighlight(theme, 'error')
!         apply(self.textHighlightSample.tag_config,('error',),colours)
!         colours=idleConf.GetHighlight(theme, 'console')
!         apply(self.textHighlightSample.tag_config,('shfg',),colours)
!         colours=idleConf.GetHighlight(theme, 'stdout')
!         apply(self.textHighlightSample.tag_config,('shstdout',),colours)
!         colours=idleConf.GetHighlight(theme, 'stderr')
!         apply(self.textHighlightSample.tag_config,('shstderr',),colours)
!         
      def LoadFontCfg(self):
          ##base editor font selection list

Index: configHandler.py
===================================================================
RCS file: /cvsroot/idlefork/idle/configHandler.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** configHandler.py	2001/11/03 05:06:34	1.5
--- configHandler.py	2001/11/04 07:03:08	1.6
***************
*** 6,10 ****
  ##---------------------------------------------------------------------------##
  """
! Provides access to configuration information
  """
  
--- 6,10 ----
  ##---------------------------------------------------------------------------##
  """
! Provides access to stored idle configuration information
  """
  
***************
*** 154,159 ****
--- 154,168 ----
      
      def GetHighlight(self, theme, element):
+         #get some fallback defaults
+         defaultFg=self.GetOption('highlight', theme, 'normal' + "-foreground",
+             default='#000000')
+         defaultBg=self.GetOption('highlight', theme, 'normal' + "-background",
+             default='#ffffff')
+         #try for requested element colours
          fore = self.GetOption('highlight', theme, element + "-foreground")
          back = self.GetOption('highlight', theme, element + "-background")
+         #fall back if required
+         if not fore: fore=defaultFg
+         if not back: back=defaultBg
          return {"foreground": fore,
                  "background": back}