[Python-checkins] python/dist/src/Lib/idlelib ClassBrowser.py, 1.7, 1.8 ColorDelegator.py, 1.12, 1.13 EditorWindow.py, 1.55, 1.56 NEWS.txt, 1.30, 1.31 PyShell.py, 1.86, 1.87 TreeWidget.py, 1.8, 1.9 config-highlight.def, 1.7, 1.8 configDialog.py, 1.56, 1.57 configHandler.py, 1.33, 1.34

kbk at users.sourceforge.net kbk at users.sourceforge.net
Mon Mar 8 13:15:35 EST 2004


Update of /cvsroot/python/python/dist/src/Lib/idlelib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13677

Modified Files:
	ClassBrowser.py ColorDelegator.py EditorWindow.py NEWS.txt 
	PyShell.py TreeWidget.py config-highlight.def configDialog.py 
	configHandler.py 
Log Message:
Add a highlight theme for builtin keywords.  Python Patch 805830 Nigel Rowe

M ClassBrowser.py
M ColorDelegator.py
M EditorWindow.py
M NEWS.txt
M PyShell.py
M TreeWidget.py
M config-highlight.def
M configDialog.py
M configHandler.py


Index: ClassBrowser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/ClassBrowser.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** ClassBrowser.py	20 Jan 2003 04:49:37 -0000	1.7
--- ClassBrowser.py	8 Mar 2004 18:15:30 -0000	1.8
***************
*** 18,21 ****
--- 18,22 ----
  from WindowList import ListedToplevel
  from TreeWidget import TreeNode, TreeItem, ScrolledCanvas
+ from configHandler import idleConf
  
  class ClassBrowser:
***************
*** 43,47 ****
          top.focus_set()
          # create scrolled canvas
!         sc = ScrolledCanvas(top, bg="white", highlightthickness=0, takefocus=1)
          sc.frame.pack(expand=1, fill="both")
          item = self.rootnode()
--- 44,50 ----
          top.focus_set()
          # create scrolled canvas
!         theme = idleConf.GetOption('main','Theme','name')
!         background = idleConf.GetHighlight(theme, 'normal')['background']
!         sc = ScrolledCanvas(top, bg=background, highlightthickness=0, takefocus=1)
          sc.frame.pack(expand=1, fill="both")
          item = self.rootnode()

Index: ColorDelegator.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/ColorDelegator.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** ColorDelegator.py	12 Feb 2004 17:35:08 -0000	1.12
--- ColorDelegator.py	8 Mar 2004 18:15:30 -0000	1.13
***************
*** 2,5 ****
--- 2,6 ----
  import re
  import keyword
+ import __builtin__
  from Tkinter import *
  from Delegator import Delegator
***************
*** 18,21 ****
--- 19,25 ----
  def make_pat():
      kw = r"\b" + any("KEYWORD", keyword.kwlist) + r"\b"
+     builtinlist = [str(name) for name in dir(__builtin__)
+                                         if not name.startswith('_')]
+     builtin = r"([^\\.]\b|^)" + any("BUILTIN", builtinlist) + r"\b"
      comment = any("COMMENT", [r"#[^\n]*"])
      sqstring = r"(\b[rR])?'[^'\\\n]*(\\.[^'\\\n]*)*'?"
***************
*** 24,28 ****
      dq3string = r'(\b[rR])?"""[^"\\]*((\\.|"(?!""))[^"\\]*)*(""")?'
      string = any("STRING", [sq3string, dq3string, sqstring, dqstring])
!     return kw + "|" + comment + "|" + string + "|" + any("SYNC", [r"\n"])
  
  prog = re.compile(make_pat(), re.S)
--- 28,32 ----
      dq3string = r'(\b[rR])?"""[^"\\]*((\\.|"(?!""))[^"\\]*)*(""")?'
      string = any("STRING", [sq3string, dq3string, sqstring, dqstring])
!     return kw + "|" + builtin + "|" + comment + "|" + string + "|" + any("SYNC", [r"\n"])
  
  prog = re.compile(make_pat(), re.S)
***************
*** 59,62 ****
--- 63,67 ----
              "COMMENT": idleConf.GetHighlight(theme, "comment"),
              "KEYWORD": idleConf.GetHighlight(theme, "keyword"),
+             "BUILTIN": idleConf.GetHighlight(theme, "builtin"),
              "STRING": idleConf.GetHighlight(theme, "string"),
              "DEFINITION": idleConf.GetHighlight(theme, "definition"),
***************
*** 69,73 ****
              }
  
!     if DEBUG: print 'tagdefs',tagdefs
  
      def insert(self, index, chars, tags=None):
--- 74,78 ----
              }
  
!         if DEBUG: print 'tagdefs',self.tagdefs
  
      def insert(self, index, chars, tags=None):

Index: EditorWindow.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/EditorWindow.py,v
retrieving revision 1.55
retrieving revision 1.56
diff -C2 -d -r1.55 -r1.56
*** EditorWindow.py	12 Feb 2004 17:35:08 -0000	1.55
--- EditorWindow.py	8 Mar 2004 18:15:30 -0000	1.56
***************
*** 511,514 ****
--- 511,516 ----
              self.color = self.ColorDelegator()
              self.per.insertfilter(self.color)
+         theme = idleConf.GetOption('main','Theme','name')
+         self.text.config(idleConf.GetHighlight(theme, "normal"))
  
      def ResetFont(self):

Index: NEWS.txt
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/NEWS.txt,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** NEWS.txt	21 Jan 2004 19:21:11 -0000	1.30
--- NEWS.txt	8 Mar 2004 18:15:30 -0000	1.31
***************
*** 4,7 ****
--- 4,9 ----
  *Release date: XX-XXX-2004*
  
+ - Add a highlight theme for builtin keywords.  Python Patch 805830 Nigel Rowe
+ 
  - rpc.py:SocketIO - Large modules were generating large pickles when downloaded
    to the execution server.  The return of the OK response from the subprocess

Index: PyShell.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/PyShell.py,v
retrieving revision 1.86
retrieving revision 1.87
diff -C2 -d -r1.86 -r1.87
*** PyShell.py	12 Feb 2004 17:35:09 -0000	1.86
--- PyShell.py	8 Mar 2004 18:15:31 -0000	1.87
***************
*** 529,533 ****
          from TreeWidget import ScrolledCanvas, TreeNode
          top = Toplevel(self.tkconsole.root)
!         sc = ScrolledCanvas(top, bg="white", highlightthickness=0)
          sc.frame.pack(expand=1, fill="both")
          node = TreeNode(sc.canvas, None, item)
--- 529,535 ----
          from TreeWidget import ScrolledCanvas, TreeNode
          top = Toplevel(self.tkconsole.root)
!         theme = idleConf.GetOption('main','Theme','name')
!         background = idleConf.GetHighlight(theme, 'normal')['background']
!         sc = ScrolledCanvas(top, bg=background, highlightthickness=0)
          sc.frame.pack(expand=1, fill="both")
          node = TreeNode(sc.canvas, None, item)

Index: TreeWidget.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/TreeWidget.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** TreeWidget.py	12 Feb 2004 17:35:09 -0000	1.8
--- TreeWidget.py	8 Mar 2004 18:15:31 -0000	1.9
***************
*** 21,24 ****
--- 21,25 ----
  
  import ZoomHeight
+ from configHandler import idleConf
  
  ICONDIR = "Icons"
***************
*** 250,257 ****
              # padding carefully selected (on Windows) to match Entry widget:
              self.label = Label(self.canvas, text=text, bd=0, padx=2, pady=2)
          if self.selected:
!             self.label.configure(fg="white", bg="darkblue")
          else:
!             self.label.configure(fg="black", bg="white")
          id = self.canvas.create_window(textx, texty,
                                         anchor="nw", window=self.label)
--- 251,259 ----
              # padding carefully selected (on Windows) to match Entry widget:
              self.label = Label(self.canvas, text=text, bd=0, padx=2, pady=2)
+         theme = idleConf.GetOption('main','Theme','name')
          if self.selected:
!             self.label.configure(idleConf.GetHighlight(theme, 'hilite'))
          else:
!             self.label.configure(idleConf.GetHighlight(theme, 'normal'))
          id = self.canvas.create_window(textx, texty,
                                         anchor="nw", window=self.label)

Index: config-highlight.def
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/config-highlight.def,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** config-highlight.def	18 May 2003 02:21:55 -0000	1.7
--- config-highlight.def	8 Mar 2004 18:15:31 -0000	1.8
***************
*** 7,10 ****
--- 7,12 ----
  keyword-foreground= #ff7700
  keyword-background= #ffffff
+ builtin-foreground= #ca00ca
+ builtin-background= #ffffff
  comment-foreground= #dd0000
  comment-background= #ffffff
***************
*** 36,39 ****
--- 38,43 ----
  keyword-foreground= #ff7700
  keyword-background= #ffffff
+ builtin-foreground= #ca00ca
+ builtin-background= #ffffff
  comment-foreground= #dd0000
  comment-background= #ffffff

Index: configDialog.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/configDialog.py,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -d -r1.56 -r1.57
*** configDialog.py	12 Feb 2004 17:35:09 -0000	1.56
--- configDialog.py	8 Mar 2004 18:15:31 -0000	1.57
***************
*** 36,48 ****
              '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.ResetChangedItems() #load initial values in changed items dict
          self.CreateWidgets()
--- 36,50 ----
              'Python Keywords':('keyword','01'),
              'Python Definitions':('definition','02'),
!             'Python Builtins':('builtin', '03'),
!             'Python Comments':('comment','04'),
!             'Python Strings':('string','05'),
!             'Selected Text':('hilite','06'),
!             'Found Text':('hit','07'),
!             'Cursor':('cursor','08'),
!             'Error Text':('error','09'),
!             'Shell Normal Text':('console','10'),
!             'Shell Stdout Text':('stdout','11'),
!             'Shell Stderr Text':('stderr','12'),
!             }
          self.ResetChangedItems() #load initial values in changed items dict
          self.CreateWidgets()
***************
*** 198,202 ****
              ('\n  ','normal'),('"""string"""','string'),('\n  var0 = ','normal'),
              ("'string'",'string'),('\n  var1 = ','normal'),("'selected'",'hilite'),
!             ('\n  var2 = ','normal'),("'found'",'hit'),('\n\n','normal'),
              (' error ','error'),(' ','normal'),('cursor |','cursor'),
              ('\n ','normal'),('shell','console'),(' ','normal'),('stdout','stdout'),
--- 200,206 ----
              ('\n  ','normal'),('"""string"""','string'),('\n  var0 = ','normal'),
              ("'string'",'string'),('\n  var1 = ','normal'),("'selected'",'hilite'),
!             ('\n  var2 = ','normal'),("'found'",'hit'),
!             ('\n  var3 = ','normal'),('list', 'builtin'), ('(','normal'),
!             ('None', 'builtin'),(')\n\n','normal'),
              (' error ','error'),(' ','normal'),('cursor |','cursor'),
              ('\n ','normal'),('shell','console'),(' ','normal'),('stdout','stdout'),

Index: configHandler.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/configHandler.py,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** configHandler.py	12 Feb 2004 17:35:09 -0000	1.33
--- configHandler.py	8 Mar 2004 18:15:31 -0000	1.34
***************
*** 307,310 ****
--- 307,312 ----
                  'keyword-foreground':'#000000',
                  'keyword-background':'#ffffff',
+                 'builtin-foreground':'#000000',
+                 'builtin-background':'#ffffff',
                  'comment-foreground':'#000000',
                  'comment-background':'#ffffff',




More information about the Python-checkins mailing list