[Python-checkins] CVS: python/dist/src/Tools/idle ColorDelegator.py,1.8,1.9 EditorWindow.py,1.30,1.31 ParenMatch.py,1.1,1.2 PyShell.py,1.24,1.25 idle.py,1.1,1.2 extend.py,1.4,NONE
Jeremy Hylton
jhylton@cnri.reston.va.us
Fri, 3 Mar 2000 18:06:48 -0500 (EST)
Update of /projects/cvsroot/python/dist/src/Tools/idle
In directory bitdiddle:/home/jhylton/python/src/Tools/idle
Modified Files:
ColorDelegator.py EditorWindow.py ParenMatch.py PyShell.py
idle.py
Removed Files:
extend.py
Log Message:
migrate to use of IdleConf and config files to set options
idle.py:
Load the config files before anything else happens
XXX Need to define standard way to get files relative to the
IDLE install dir
PyShell.py:
ColorDelegator.py:
Get color defns out of IdleConf instead of IdlePrefs
EditorWindow.py:
Replace hard-coded font & window size with config options
Get extension names via IdleConf.getextensions
extend.py:
Obsolete. Extensions defined in config file.
ParenMatch.py:
Use config file for extension options.
Revise comment about parser requirements.
Simplify logic on find returning None.
Index: ColorDelegator.py
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Tools/idle/ColorDelegator.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** ColorDelegator.py 1999/04/26 22:20:38 1.8
--- ColorDelegator.py 2000/03/03 23:06:44 1.9
***************
*** 5,9 ****
from Tkinter import *
from Delegator import Delegator
! import IdlePrefs
#$ event <<toggle-auto-coloring>>
--- 5,9 ----
from Tkinter import *
from Delegator import Delegator
! from IdleConf import IdleConf
#$ event <<toggle-auto-coloring>>
***************
*** 52,78 ****
self.tag_raise('sel')
! cprefs = IdlePrefs.ColorPrefs()
tagdefs = {
! "COMMENT": {"foreground": cprefs.CComment[0],
! "background": cprefs.CComment[1]},
! "KEYWORD": {"foreground": cprefs.CKeyword[0],
! "background": cprefs.CKeyword[1]},
! "STRING": {"foreground": cprefs.CString[0],
! "background": cprefs.CString[1]},
! "DEFINITION": {"foreground": cprefs.CDefinition[0],
! "background": cprefs.CDefinition[1]},
!
! "SYNC": {"background": cprefs.CSync[0],
! "background": cprefs.CSync[1]},
! "TODO": {"background": cprefs.CTodo[0],
! "background": cprefs.CTodo[1]},
!
! "BREAK": {"background": cprefs.CBreak[0],
! "background": cprefs.CBreak[1]},
!
# The following is used by ReplaceDialog:
! "hit": {"foreground": cprefs.CHit[0],
! "background": cprefs.CHit[1]},
}
--- 52,67 ----
self.tag_raise('sel')
! cconf = IdleConf.getsection('Colors')
tagdefs = {
! "COMMENT": cconf.getcolor("comment"),
! "KEYWORD": cconf.getcolor("keyword"),
! "STRING": cconf.getcolor("string"),
! "DEFINITION": cconf.getcolor("definition"),
! "SYNC": cconf.getcolor("sync"),
! "TODO": cconf.getcolor("todo"),
! "BREAK": cconf.getcolor("break"),
# The following is used by ReplaceDialog:
! "hit": cconf.getcolor("hit"),
}
Index: EditorWindow.py
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Tools/idle/EditorWindow.py,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -r1.30 -r1.31
*** EditorWindow.py 2000/02/17 16:14:16 1.30
--- EditorWindow.py 2000/03/03 23:06:44 1.31
***************
*** 9,30 ****
import idlever
import WindowList
- # Customization of default window size and font
- # standard
- WIDTH = 80
- HEIGHT = 24
- if sys.platform[:3] == 'win':
- FONT = ("courier new", 10)
- else:
- FONT = ("courier", 10)
- if 0:
- # for demos (on Windows)
- WIDTH = 70
- HEIGHT = 16
- FONT = ("lucida console", 14)
- if 0:
- # for Windows 98
- FONT = ("lucida console", 8)
-
# The default tab setting for a Text widget, in average-width characters.
TK_TABWIDTH_DEFAULT = 8
--- 9,14 ----
import idlever
import WindowList
+ from IdleConf import IdleConf
# The default tab setting for a Text widget, in average-width characters.
TK_TABWIDTH_DEFAULT = 8
***************
*** 111,115 ****
def __init__(self, flist=None, filename=None, key=None, root=None):
! cprefs = self.ColorDelegator.cprefs
self.flist = flist
root = root or flist.root
--- 95,100 ----
def __init__(self, flist=None, filename=None, key=None, root=None):
! edconf = IdleConf.getsection('EditorWindow')
! coconf = IdleConf.getsection('Colors')
self.flist = flist
root = root or flist.root
***************
*** 122,132 ****
self.text_frame = text_frame = Frame(top)
self.text = text = Text(text_frame, name='text', padx=5,
! foreground=cprefs.CNormal[0],
! background=cprefs.CNormal[1],
! highlightcolor=cprefs.CHilite[0],
! highlightbackground=cprefs.CHilite[1],
! insertbackground=cprefs.CCursor[1],
! width=WIDTH, height=HEIGHT,
! wrap="none")
self.createmenubar()
--- 107,118 ----
self.text_frame = text_frame = Frame(top)
self.text = text = Text(text_frame, name='text', padx=5,
! foreground=coconf.getdef('normal-foreground'),
! background=coconf.getdef('normal-background'),
! highlightcolor=coconf.getdef('hilite-foreground'),
! highlightbackground=coconf.getdef('hilite-background'),
! insertbackground=coconf.getdef('cursor-background'),
! width=edconf.getint('width'),
! height=edconf.getint('height'),
! wrap="none")
self.createmenubar()
***************
*** 157,161 ****
text['yscrollcommand'] = vbar.set
! text['font'] = FONT
text_frame.pack(side=LEFT, fill=BOTH, expand=1)
text.pack(side=TOP, fill=BOTH, expand=1)
--- 143,147 ----
text['yscrollcommand'] = vbar.set
! text['font'] = edconf.get('font-name'), edconf.get('font-size')
text_frame.pack(side=LEFT, fill=BOTH, expand=1)
text.pack(side=TOP, fill=BOTH, expand=1)
***************
*** 545,550 ****
def get_standard_extension_names(self):
! import extend
! return extend.standard
def load_extension(self, name):
--- 531,535 ----
def get_standard_extension_names(self):
! return IdleConf.getextensions()
def load_extension(self, name):
Index: ParenMatch.py
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Tools/idle/ParenMatch.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** ParenMatch.py 2000/03/02 19:06:57 1.1
--- ParenMatch.py 2000/03/03 23:06:44 1.2
***************
*** 15,18 ****
--- 15,19 ----
import PyParse
from AutoIndent import AutoIndent, index2line
+ from IdleConf import IdleConf
class ParenMatch:
***************
*** 56,65 ****
unix_keydefs = {}
! STYLE = "default" # or "expression"
! FLASH_DELAY = 500
! HILITE_CONFIG = {"foreground": "black",
! "background": "#43cd80", # SeaGreen3
! }
! BELL = 1 # set to false for no bell
def __init__(self, editwin):
--- 57,66 ----
unix_keydefs = {}
! iconf = IdleConf.getsection('ParenMatch')
! STYLE = iconf.get('style')
! FLASH_DELAY = iconf.getint('flash-delay')
! HILITE_CONFIG = iconf.getcolor('hilite')
! BELL = iconf.getboolean('bell')
! del iconf
def __init__(self, editwin):
***************
*** 157,163 ****
startatindex = `startat` + ".0"
# rawtext needs to contain everything up to the last
! # character, which was the close paren. also need to
! # append "\n" to please the parser, which seems to expect
! # a complete line
rawtext = self.text.get(startatindex, "insert")[:-1] + "\n"
y.set_str(rawtext)
--- 158,163 ----
startatindex = `startat` + ".0"
# rawtext needs to contain everything up to the last
! # character, which was the close paren. the parser also
! # requires that the last line ends with "\n"
rawtext = self.text.get(startatindex, "insert")[:-1] + "\n"
y.set_str(rawtext)
***************
*** 175,181 ****
lno = index2line(self.text.index("insert"))
i, buf = self._find_offset_in_buf(lno)
! if i is None:
! return i
! if keysym_type(buf[i]) != right_keysym_type:
return None
lines_back = buf[i:].count("\n") - 1
--- 175,180 ----
lno = index2line(self.text.index("insert"))
i, buf = self._find_offset_in_buf(lno)
! if i is None \
! or keysym_type(buf[i]) != right_keysym_type:
return None
lines_back = buf[i:].count("\n") - 1
Index: PyShell.py
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Tools/idle/PyShell.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** PyShell.py 1999/06/25 17:26:34 1.24
--- PyShell.py 2000/03/03 23:06:44 1.25
***************
*** 17,20 ****
--- 17,21 ----
from ColorDelegator import ColorDelegator
from OutputWindow import OutputWindow
+ from IdleConf import IdleConf
import idlever
***************
*** 115,133 ****
tagdefs = ColorDelegator.tagdefs.copy()
! cprefs = ColorDelegator.cprefs
tagdefs.update({
! "stdin": {"foreground": cprefs.CStdIn[0],
! "background": cprefs.CStdIn[1]},
! "stdout": {"foreground": cprefs.CStdOut[0],
! "background": cprefs.CStdOut[1]},
! "stderr": {"foreground": cprefs.CStdErr[0],
! "background": cprefs.CStdErr[1]},
! "console": {"foreground": cprefs.CConsole[0],
! "background": cprefs.CConsole[1]},
! "ERROR": {"background": cprefs.CError[0],
! "background": cprefs.CError[1]},
! None: {"foreground": cprefs.CNormal[0],
! "background": cprefs.CNormal[1]},
})
--- 116,128 ----
tagdefs = ColorDelegator.tagdefs.copy()
! cconf = IdleConf.getsection('Colors')
tagdefs.update({
! "stdin": cconf.getcolor("stdin"),
! "stdout": cconf.getcolor("stdout"),
! "stderr": cconf.getcolor("stderr"),
! "console": cconf.getcolor("console"),
! "ERROR": cconf.getcolor("ERROR"),
! None: cconf.getcolor("normal"),
})
Index: idle.py
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Tools/idle/idle.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** idle.py 1999/01/28 18:50:31 1.1
--- idle.py 2000/03/03 23:06:45 1.2
***************
*** 1,3 ****
--- 1,12 ----
#! /usr/bin/env python
+
+ import os
+ import sys
+ import IdleConf
+
+ idle_dir = os.path.split(sys.argv[0])[0]
+ IdleConf.load(idle_dir)
+
+ # defer importing Pyshell until IdleConf is loaded
import PyShell
PyShell.main()