diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 1996-04-19 15:54:47 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 1996-04-19 15:54:47 (GMT) |
commit | 8444507faf45eb14bc19be4371a766c05d684aa2 (patch) | |
tree | 804c2d5d1bd5422e2928fcf77c0bc31d94f89643 /Mac | |
parent | dce32a93d3eaa1e42c316c5bb29bc657453a6a3e (diff) | |
download | cpython-8444507faf45eb14bc19be4371a766c05d684aa2.zip cpython-8444507faf45eb14bc19be4371a766c05d684aa2.tar.gz cpython-8444507faf45eb14bc19be4371a766c05d684aa2.tar.bz2 |
Use FrameWork.windowbounds(), fixed idle routine
Diffstat (limited to 'Mac')
-rw-r--r-- | Mac/Demo/textedit/ped.py | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/Mac/Demo/textedit/ped.py b/Mac/Demo/textedit/ped.py index 425224a..92c852e 100644 --- a/Mac/Demo/textedit/ped.py +++ b/Mac/Demo/textedit/ped.py @@ -18,14 +18,15 @@ class TEWindow(ScrolledWindow): def open(self, path, name, data): self.path = path self.name = name - r = (40, 40, 400, 300) + r = windowbounds(400, 400) w = Win.NewWindow(r, name, 1, 0, -1, 1, 0x55555555) self.wid = w - r2 = (0, 0, 345, 245) + vr = 0, 0, r[2]-r[0]-15, r[3]-r[1]-15 + dr = (0, 0, vr[2], 0) Qd.SetPort(w) Qd.TextFont(4) Qd.TextSize(9) - self.ted = TE.TENew(r2, r2) + self.ted = TE.TENew(dr, vr) self.ted.TEAutoView(1) self.ted.TESetText(data) w.DrawGrowIcon() @@ -44,7 +45,7 @@ class TEWindow(ScrolledWindow): vx = self.scalebarvalue(dr[0], dr[2]-dr[0], vr[0], vr[2]) vy = self.scalebarvalue(dr[1], dr[1]+height, vr[1], vr[3]) print dr, vr, height, vx, vy - return vx, vy + return None, vy def scrollbar_callback(self, which, what, value): if which == 'y': @@ -67,18 +68,7 @@ class TEWindow(ScrolledWindow): self.ted.TEPinScroll(0, delta) print 'SCROLL Y', delta else: - if what == 'set': - return # XXXX - if what == '-': - delta = self.ted.viewRect[2]/10 - elif what == '--': - delta = self.ted.viewRect[2]/2 - elif what == '+': - delta = +self.ted.viewRect[2]/10 - elif what == '++': - delta = +self.ted.viewRect[2]/2 - self.ted.TEPinScroll(delta, 0) - + pass # No horizontal scrolling def do_activate(self, onoff, evt): print "ACTIVATE", onoff @@ -337,8 +327,8 @@ class Ped(Application): # def idle(self, *args): - for l in self._windows.values(): - l.do_idle() + if self.active: + self.active.do_idle() def main(): App = Ped() |