[Idle-dev] CVS: idle configDialog.py,1.20,1.21

Stephen M. Gava elguavas@users.sourceforge.net
Thu, 03 Jan 2002 04:05:19 -0800


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

Modified Files:
	configDialog.py 
Log Message:
further development of highlighting and editor preference handling, 
plus misc fixes cleanups for new config system


Index: configDialog.py
===================================================================
RCS file: /cvsroot/idlefork/idle/configDialog.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** configDialog.py	2001/12/05 07:54:07	1.20
--- configDialog.py	2002/01/03 12:05:17	1.21
***************
*** 23,38 ****
          #The third value indicates whether the element can have a foreground 
          #or background colour or both. 
!         self.themeElements={'Normal Text':('normal','00','both'),
!             'Python Keywords':('keyword','01','both'),
!             'Python Definitions':('definition','02','both'),
!             'Python Comments':('comment','03','both'),
!             'Python Strings':('string','04','both'),
!             'Selected Text':('hilite','05','both'),
!             'Found Text':('hit','06','both'),
!             'Cursor':('cursor','07','fg'),
!             'Error Background':('error','08','bg'),
!             'Shell Foreground':('console','09','fg'),
!             'Shell Stdout Foreground':('stdout','10','fg'),
!             'Shell Stderr Foreground':('stderr','11','fg')}
          self.CreateWidgets()
          self.resizable(height=FALSE,width=FALSE)
--- 23,38 ----
          #The third value indicates whether the element can have a foreground 
          #or background colour or both. 
!         self.themeElements={'Normal Text':('normal','00'),
!             'Python Keywords':('keyword','01'),
!             'Python Definitions':('definition','02'),
!             'Python Comments':('comment','03'),
!             'Python Strings':('string','04'),
!             'Selected Text':('hilite','05'),
!             'Found Text':('hit','06'),
!             'Cursor':('cursor','07'),
!             'Error Text':('error','08'),
!             'Shell Normal Text':('console','09'),
!             'Shell Stdout Text':('stdout','10'),
!             'Shell Stderr Text':('stderr','11')}
          self.CreateWidgets()
          self.resizable(height=FALSE,width=FALSE)
***************
*** 116,132 ****
          
      def SetHighlightTarget(self):
!         colourPlane=self.themeElements[self.highlightTarget.get()][2]
!         if colourPlane == 'bg': 
              self.radioFg.config(state=DISABLED)
              self.radioBg.config(state=DISABLED)
!             self.fgHilite.set(0)
!         elif colourPlane == 'fg':
              self.radioFg.config(state=DISABLED)
              self.radioBg.config(state=DISABLED)
              self.fgHilite.set(1)
-         elif colourPlane == 'both':
-             self.radioFg.config(state=NORMAL)
-             self.radioBg.config(state=NORMAL)
-             self.fgHilite.set(1) #default to setting foreground attribute
          self.SetColourSample()
      
--- 116,127 ----
          
      def SetHighlightTarget(self):
!         if self.highlightTarget.get()=='Cursor': #bg not possible
              self.radioFg.config(state=DISABLED)
              self.radioBg.config(state=DISABLED)
!             self.fgHilite.set(1)
!         else: #both fg and bg can be set
              self.radioFg.config(state=DISABLED)
              self.radioBg.config(state=DISABLED)
              self.fgHilite.set(1)
          self.SetColourSample()
      
***************
*** 145,148 ****
--- 140,144 ----
          self.tabPages = TabPageSet(self,
                  pageNames=['Fonts/Tabs','Highlighting','Keys','General'])
+         self.tabPages.ChangePage()#activates default (first) page
          frameActionButtons = Frame(self)
          #action buttons
***************
*** 499,505 ****
          for element in self.themeElements.keys():
              colours=idleConf.GetHighlight(theme, self.themeElements[element][0])
              apply(self.textHighlightSample.tag_config,
                  (self.themeElements[element][0],),colours)
!         
      def LoadFontCfg(self):
          ##base editor font selection list
--- 495,504 ----
          for element in self.themeElements.keys():
              colours=idleConf.GetHighlight(theme, self.themeElements[element][0])
+             if element=='Cursor': #cursor sample needs special painting
+                 colours['background']=idleConf.GetHighlight(theme, 
+                         'normal-text', fgBg='bg')
              apply(self.textHighlightSample.tag_config,
                  (self.themeElements[element][0],),colours)
!     
      def LoadFontCfg(self):
          ##base editor font selection list
***************
*** 539,543 ****
              type='int',default=1))
          ##currently set theme
!         currentOption=idleConf.GetOption('main','Theme','name')
          ##load available theme option menus
          if self.themeIsBuiltin.get(): #default theme selected
--- 538,542 ----
              type='int',default=1))
          ##currently set theme
!         currentOption=idleConf.CurrentTheme()
          ##load available theme option menus
          if self.themeIsBuiltin.get(): #default theme selected
***************
*** 576,580 ****
              type='int',default=1))
          ##currently set keys
!         currentOption=idleConf.GetOption('main','Keys','name')
          ##load available keyset option menus
          if self.keysAreDefault.get(): #default theme selected
--- 575,579 ----
              type='int',default=1))
          ##currently set keys
!         currentOption=idleConf.CurrentKeys()
          ##load available keyset option menus
          if self.keysAreDefault.get(): #default theme selected