summaryrefslogtreecommitdiffstats
path: root/Lib/lib-stdwin
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1991-05-14 12:22:25 (GMT)
committerGuido van Rossum <guido@python.org>1991-05-14 12:22:25 (GMT)
commitaa1791765ee8de07ac37b71ad1c7d8d902e46aaa (patch)
tree3dbf409cb9c83c51d68e3e6c846f4c9cbfb54817 /Lib/lib-stdwin
parent17fca179bc3de0106cd10b2341663f72946b8cfe (diff)
downloadcpython-aa1791765ee8de07ac37b71ad1c7d8d902e46aaa.zip
cpython-aa1791765ee8de07ac37b71ad1c7d8d902e46aaa.tar.gz
cpython-aa1791765ee8de07ac37b71ad1c7d8d902e46aaa.tar.bz2
*** empty log message ***
Diffstat (limited to 'Lib/lib-stdwin')
-rw-r--r--Lib/lib-stdwin/TextEdit.py2
-rw-r--r--Lib/lib-stdwin/WindowParent.py18
2 files changed, 12 insertions, 8 deletions
diff --git a/Lib/lib-stdwin/TextEdit.py b/Lib/lib-stdwin/TextEdit.py
index d7b2236..f70fba1 100644
--- a/Lib/lib-stdwin/TextEdit.py
+++ b/Lib/lib-stdwin/TextEdit.py
@@ -25,7 +25,7 @@ class TextEdit():
del self.window
#
def minsize(self, m):
- return self.cols*m.textwidth('n'), self.rows*m.lineheight()
+ return self.cols*m.textwidth('in')/2, self.rows*m.lineheight()
def setbounds(self, bounds):
self.bounds = bounds
if self.editor:
diff --git a/Lib/lib-stdwin/WindowParent.py b/Lib/lib-stdwin/WindowParent.py
index 1a63674..2388443 100644
--- a/Lib/lib-stdwin/WindowParent.py
+++ b/Lib/lib-stdwin/WindowParent.py
@@ -22,14 +22,15 @@ class WindowParent() = ManageOneChild():
return self
#
def _reset(self):
- self.child = 0
- self.win = 0
+ self.child = None
+ self.win = None
self.itimer = 0
self.do_mouse = 0
self.do_keybd = 0
self.do_timer = 0
self.do_altdraw = 0
self.pending_destroy = 0
+ self.close_hook = None
#
def destroy(self):
if self.win in WindowList:
@@ -43,6 +44,9 @@ class WindowParent() = ManageOneChild():
# is not a good idea...
self.pending_destroy = 1
#
+ def close_trigger(self):
+ if self.close_hook: self.close_hook(self)
+ #
def need_mouse(self, child): self.do_mouse = 1
def no_mouse(self, child): self.do_mouse = 0
#
@@ -63,10 +67,8 @@ class WindowParent() = ManageOneChild():
size = self.child.minsize(self.beginmeasuring())
self.size = max(self.size[0], size[0]), \
max(self.size[1], size[1])
- stdwin.setdefscrollbars(0, 0)
- # XXX Compensate stdwin bug:
- # XXX should really be stdwin.setdefwinsize(self.size)
- stdwin.setdefwinsize(self.size[0]+4, self.size[1]+2)
+ # XXX Don't... stdwin.setdefscrollbars(0, 0)
+ stdwin.setdefwinsize(self.size)
self.win = stdwin.open(self.title)
self.win.setdocsize(self.size)
if self.itimer:
@@ -82,6 +84,8 @@ class WindowParent() = ManageOneChild():
self.win.setdocsize(self.size)
bounds = (0, 0), self.win.getwinsize()
self.child.setbounds(bounds)
+ # Force a redraw of the entire window:
+ self.win.change((0, 0), (10000, 10000))
#
def beginmeasuring(self):
# Return something with which a child can measure text
@@ -137,7 +141,7 @@ class WindowParent() = ManageOneChild():
elif type = WE_SIZE:
self.fixup()
elif type = WE_CLOSE:
- self.delayed_destroy()
+ self.close_trigger()
if self.pending_destroy:
self.destroy()
#