summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorJust van Rossum <just@lettererror.com>1999-09-26 12:21:32 (GMT)
committerJust van Rossum <just@lettererror.com>1999-09-26 12:21:32 (GMT)
commitb7ad821f022a62656677b03f1d081e1e284047ea (patch)
tree20d0c62f2879c8cc10eaea1159f2e652f5ad7b52 /Mac
parent03bca30ea1b576abe190d3ad8922c3a9624a6606 (diff)
downloadcpython-b7ad821f022a62656677b03f1d081e1e284047ea.zip
cpython-b7ad821f022a62656677b03f1d081e1e284047ea.tar.gz
cpython-b7ad821f022a62656677b03f1d081e1e284047ea.tar.bz2
Added support for global default font settings. (jvr)
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Tools/IDE/Wtext.py40
-rw-r--r--Mac/Tools/IDE/Wwindows.py16
2 files changed, 33 insertions, 23 deletions
diff --git a/Mac/Tools/IDE/Wtext.py b/Mac/Tools/IDE/Wtext.py
index 963f1ba..ac9d48e 100644
--- a/Mac/Tools/IDE/Wtext.py
+++ b/Mac/Tools/IDE/Wtext.py
@@ -24,11 +24,13 @@ class TextBox(Wbase.Widget):
"""A static text widget"""
- def __init__(self, possize, text = "", align = TextEdit.teJustLeft,
- fontsettings = ("Python-Sans", 0, 9, (0, 0, 0)),
- backgroundcolor = (0xffff, 0xffff, 0xffff)
+ def __init__(self, possize, text="", align=TextEdit.teJustLeft,
+ fontsettings=None,
+ backgroundcolor=(0xffff, 0xffff, 0xffff)
):
-
+ if fontsettings is None:
+ import W
+ fontsettings = W.getdefaultfont()
Wbase.Widget.__init__(self, possize)
self.fontsettings = fontsettings
self.text = text
@@ -90,12 +92,14 @@ class EditText(Wbase.SelectableWidget, _ScrollWidget):
"""A text edit widget, mainly for simple entry fields."""
- def __init__(self, possize, text = "",
- callback = None, inset = (3, 3),
- fontsettings = ("Python-Sans", 0, 9, (0, 0, 0)),
+ def __init__(self, possize, text="",
+ callback=None, inset=(3, 3),
+ fontsettings=None,
tabsettings = (32, 0),
readonly = 0):
-
+ if fontsettings is None:
+ import W
+ fontsettings = W.getdefaultfont()
Wbase.SelectableWidget.__init__(self, possize)
self.temptext = text
self.ted = None
@@ -553,10 +557,10 @@ class TextEditor(EditText):
"""A text edit widget."""
- def __init__(self, possize, text = "", callback = None, wrap = 1, inset = (4, 4),
- fontsettings = ("Python-Sans", 0, 9, (0, 0, 0)),
- tabsettings = (32, 0),
- readonly = 0):
+ def __init__(self, possize, text="", callback=None, wrap=1, inset=(4, 4),
+ fontsettings=None,
+ tabsettings=(32, 0),
+ readonly=0):
EditText.__init__(self, possize, text, callback, inset, fontsettings, tabsettings, readonly)
self.wrap = wrap
@@ -607,12 +611,12 @@ class PyEditor(TextEditor):
"""A specialized Python source edit widget"""
- def __init__(self, possize, text = "", callback = None, inset = (4, 4),
- fontsettings = ("Python-Sans", 0, 9, (0, 0, 0)),
- tabsettings = (32, 0),
- readonly = 0,
- debugger = None,
- file = ''):
+ def __init__(self, possize, text="", callback=None, inset=(4, 4),
+ fontsettings=None,
+ tabsettings=(32, 0),
+ readonly=0,
+ debugger=None,
+ file=''):
TextEditor.__init__(self, possize, text, callback, 0, inset, fontsettings, tabsettings, readonly)
self.bind("cmd[", self.domenu_shiftleft)
self.bind("cmd]", self.domenu_shiftright)
diff --git a/Mac/Tools/IDE/Wwindows.py b/Mac/Tools/IDE/Wwindows.py
index 8e4d665..f48e11e 100644
--- a/Mac/Tools/IDE/Wwindows.py
+++ b/Mac/Tools/IDE/Wwindows.py
@@ -19,8 +19,12 @@ class Window(FrameWork.Window, Wbase.SelectableWidget):
windowkind = Windows.documentProc
- def __init__(self, possize, title = "", minsize = None, maxsize = None, tabbable = 1, show = 1):
+ def __init__(self, possize, title="", minsize=None, maxsize=None,
+ tabbable=1, show=1, fontsettings=None):
import W
+ if fontsettings is None:
+ fontsettings = W.getdefaultfont()
+ self._fontsettings = fontsettings
W.SelectableWidget.__init__(self, possize)
self._globalbounds = l, t, r, b = self.getwindowbounds(possize, minsize)
self._bounds = (0, 0, r - l, b - t)
@@ -92,11 +96,13 @@ class Window(FrameWork.Window, Wbase.SelectableWidget):
self.wid = Win.NewCWindow(self._globalbounds, self.title, self._show,
self.windowkind, -1, self.hasclosebox, 0)
self.SetPort()
- fnum = Fm.GetFNum("Python-Sans")
+ fontname, fontstyle, fontsize, fontcolor = self._fontsettings
+ fnum = Fm.GetFNum(fontname)
if fnum == 0:
fnum = Fm.GetFNum("Geneva")
- Qd.TextFont(fnum) # XXX font&size from a function?
- Qd.TextSize(9) # XXX font&size from a function?
+ Qd.TextFont(fnum)
+ Qd.TextFace(fontstyle)
+ Qd.TextSize(fontsize)
if self._bindings.has_key("<open>"):
callback = self._bindings["<open>"]
callback()
@@ -286,7 +292,7 @@ class Window(FrameWork.Window, Wbase.SelectableWidget):
(what, message, when, where, modifiers) = event
key = char
if Wkeys.keynames.has_key(key):
- key = Wkeys.keynames[char]
+ key = Wkeys.keynames[key]
if modifiers & Events.shiftKey:
key = 'shift' + key
if modifiers & Events.cmdKey: