summaryrefslogtreecommitdiffstats
path: root/Tools/idle/EditorWindow.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2000-03-03 23:06:45 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2000-03-03 23:06:45 (GMT)
commite81f28b630a7192207b9ac9a6813c8d29f1bed6c (patch)
tree470d5306ede24a1819eefb1fff1fb3abae7446f3 /Tools/idle/EditorWindow.py
parent583abb80277d6ab5c8ad887477c12a3139e6f5f9 (diff)
downloadcpython-e81f28b630a7192207b9ac9a6813c8d29f1bed6c.zip
cpython-e81f28b630a7192207b9ac9a6813c8d29f1bed6c.tar.gz
cpython-e81f28b630a7192207b9ac9a6813c8d29f1bed6c.tar.bz2
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.
Diffstat (limited to 'Tools/idle/EditorWindow.py')
-rw-r--r--Tools/idle/EditorWindow.py41
1 files changed, 13 insertions, 28 deletions
diff --git a/Tools/idle/EditorWindow.py b/Tools/idle/EditorWindow.py
index 0e0e0dc..ee3b9c3 100644
--- a/Tools/idle/EditorWindow.py
+++ b/Tools/idle/EditorWindow.py
@@ -8,23 +8,7 @@ import tkSimpleDialog
import tkMessageBox
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)
+from IdleConf import IdleConf
# The default tab setting for a Text widget, in average-width characters.
TK_TABWIDTH_DEFAULT = 8
@@ -110,7 +94,8 @@ class EditorWindow:
vars = {}
def __init__(self, flist=None, filename=None, key=None, root=None):
- cprefs = self.ColorDelegator.cprefs
+ edconf = IdleConf.getsection('EditorWindow')
+ coconf = IdleConf.getsection('Colors')
self.flist = flist
root = root or flist.root
self.root = root
@@ -121,13 +106,14 @@ class EditorWindow:
self.vbar = vbar = Scrollbar(top, name='vbar')
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")
+ 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()
self.apply_bindings()
@@ -156,7 +142,7 @@ class EditorWindow:
vbar.pack(side=RIGHT, fill=Y)
text['yscrollcommand'] = vbar.set
- text['font'] = FONT
+ 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)
text.focus_set()
@@ -544,8 +530,7 @@ class EditorWindow:
traceback.print_exc()
def get_standard_extension_names(self):
- import extend
- return extend.standard
+ return IdleConf.getextensions()
def load_extension(self, name):
mod = __import__(name, globals(), locals(), [])