summaryrefslogtreecommitdiffstats
path: root/Lib/stdwin
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1993-12-17 15:25:27 (GMT)
committerGuido van Rossum <guido@python.org>1993-12-17 15:25:27 (GMT)
commit7bc817d5ba917528e8bd07ec461c635291e7b06a (patch)
treed244fa2c8a15248efe095823be9f5e690a2efe38 /Lib/stdwin
parentaa14837bd00c28997dbde4014f8c994b9482def1 (diff)
downloadcpython-7bc817d5ba917528e8bd07ec461c635291e7b06a.zip
cpython-7bc817d5ba917528e8bd07ec461c635291e7b06a.tar.gz
cpython-7bc817d5ba917528e8bd07ec461c635291e7b06a.tar.bz2
* Mass change: get rid of all init() methods, in favor of __init__()
constructors. There is no backward compatibility. Not everything has been tested. * aiff.{py,doc}: deleted in favor of aifc.py (which contains its docs as comments)
Diffstat (limited to 'Lib/stdwin')
-rwxr-xr-xLib/stdwin/WindowSched.py2
-rwxr-xr-xLib/stdwin/basewin.py3
-rwxr-xr-xLib/stdwin/formatter.py5
-rwxr-xr-xLib/stdwin/mainloop.py3
-rwxr-xr-xLib/stdwin/srcwin.py11
-rwxr-xr-xLib/stdwin/wdb.py30
-rwxr-xr-xLib/stdwin/wdbframewin.py8
-rwxr-xr-xLib/stdwin/wdbsrcwin.py4
8 files changed, 30 insertions, 36 deletions
diff --git a/Lib/stdwin/WindowSched.py b/Lib/stdwin/WindowSched.py
index 67c3afb..56ca6f8 100755
--- a/Lib/stdwin/WindowSched.py
+++ b/Lib/stdwin/WindowSched.py
@@ -35,7 +35,7 @@ def delayfunc(msecs):
if event[0] <> WE_TIMER:
mainloop.dispatch(event)
-q = sched.scheduler().init(time.millitimer, delayfunc)
+q = sched.scheduler(time.millitimer, delayfunc)
# Export functions enter, enterabs and cancel just like a scheduler
#
diff --git a/Lib/stdwin/basewin.py b/Lib/stdwin/basewin.py
index f896fe2..7a43536 100755
--- a/Lib/stdwin/basewin.py
+++ b/Lib/stdwin/basewin.py
@@ -6,11 +6,10 @@ from stdwinevents import *
class BaseWindow:
- def init(self, title):
+ def __init__(self, title):
self.win = stdwin.open(title)
self.win.dispatch = self.dispatch
mainloop.register(self.win)
- return self
# def reopen(self):
# title = self.win.gettitle()
diff --git a/Lib/stdwin/formatter.py b/Lib/stdwin/formatter.py
index ac34ce9..7ddfc1d 100755
--- a/Lib/stdwin/formatter.py
+++ b/Lib/stdwin/formatter.py
@@ -13,7 +13,7 @@ class formatter:
# Pass the window's drawing object, and left, top, right
# coordinates of the drawing space as arguments.
#
- def init(self, d, left, top, right):
+ def __init__(self, d, left, top, right):
self.d = d # Drawing object
self.left = left # Left margin
self.right = right # Right margin
@@ -22,7 +22,6 @@ class formatter:
self.justify = 1
self.setfont('') # Default font
self._reset() # Prepare for new line
- return self
#
# Reset for start of fresh line.
#
@@ -190,7 +189,7 @@ def test():
w.change((0, 0), (1000, 1000))
elif type == WE_DRAW:
width, height = winsize
- f = formatter().init(w.begindrawing(), 0, 0, width)
+ f = formatter(w.begindrawing(), 0, 0, width)
f.center = center
f.justify = justify
if not center:
diff --git a/Lib/stdwin/mainloop.py b/Lib/stdwin/mainloop.py
index ca3e9ac..aa40c34 100755
--- a/Lib/stdwin/mainloop.py
+++ b/Lib/stdwin/mainloop.py
@@ -224,11 +224,10 @@ def dispatch(event):
#
class Dialog:
#
- def init(self, title):
+ def __init__(self, title):
self.window = stdwin.open(title)
self.window.dispatch = self.dispatch
register(self.window)
- return self
#
def close(self):
unregister(self.window)
diff --git a/Lib/stdwin/srcwin.py b/Lib/stdwin/srcwin.py
index a71c568..29b7801 100755
--- a/Lib/stdwin/srcwin.py
+++ b/Lib/stdwin/srcwin.py
@@ -10,7 +10,7 @@ MAXHEIGHT = 24
class TextWindow(basewin.BaseWindow):
- def init(self, title, contents):
+ def __init__(self, title, contents):
self.contents = contents
self.linecount = countlines(self.contents)
#
@@ -23,11 +23,10 @@ class TextWindow(basewin.BaseWindow):
width = WIDTH*stdwin.textwidth('0')
height = lh*min(MAXHEIGHT, self.linecount)
stdwin.setdefwinsize(width, height)
- self = basewin.BaseWindow.init(self, title)
+ basewin.BaseWindow.__init__(self, title)
#
self.win.setdocsize(0, self.bottom)
self.initeditor()
- return self
def initeditor(self):
r = (self.leftmargin, self.top), (self.rightmargin, self.bottom)
@@ -113,12 +112,12 @@ def countlines(text):
class SourceWindow(TextWindow):
- def init(self, filename):
+ def __init__(self, filename):
self.filename = filename
f = open(self.filename, 'r')
contents = f.read()
f.close()
- return TextWindow.init(self, self.filename, contents)
+ TextWindow.__init__(self, self.filename, contents)
# ------------------------------ testing ------------------------------
@@ -126,5 +125,5 @@ TESTFILE = 'srcwin.py'
def test():
import mainloop
- sw = SourceWindow().init(TESTFILE)
+ sw = SourceWindow(TESTFILE)
mainloop.mainloop()
diff --git a/Lib/stdwin/wdb.py b/Lib/stdwin/wdb.py
index c499296..d5c28bb 100755
--- a/Lib/stdwin/wdb.py
+++ b/Lib/stdwin/wdb.py
@@ -19,16 +19,15 @@ WdbDone = 'wdb.WdbDone' # Exception to continue execution
class Wdb(bdb.Bdb, basewin.BaseWindow): # Window debugger
- def init(self):
+ def __init__(self):
self.sourcewindows = {}
self.framewindows = {}
- self = bdb.Bdb.init(self)
+ bdb.Bdb.__init__(self)
width = WIDTH*stdwin.textwidth('0')
height = HEIGHT*stdwin.lineheight()
stdwin.setdefwinsize(width, height)
- self = basewin.BaseWindow.init(self, '--Stack--')
+ basewin.BaseWindow.__init__(self, '--Stack--')
self.closed = 0
- return self
def reset(self):
if self.closed: raise RuntimeError, 'already closed'
@@ -151,9 +150,8 @@ class Wdb(bdb.Bdb, basewin.BaseWindow): # Window debugger
if not self.sourcewindows.has_key(fn):
import wdbsrcwin
try:
- self.sourcewindows[fn] = \
- wdbsrcwin.DebuggerSourceWindow(). \
- init(self, fn)
+ self.sourcewindows[fn] = wdbsrcwin. \
+ DebuggerSourceWindow(self, fn)
except IOError:
stdwin.fleep()
return
@@ -170,7 +168,7 @@ class Wdb(bdb.Bdb, basewin.BaseWindow): # Window debugger
else:
import wdbframewin
self.framewindows[name] = \
- wdbframewin.FrameWindow().init(self, \
+ wdbframewin.FrameWindow(self, \
self.curframe, \
self.curframe.f_locals, name)
do_f = do_frame
@@ -182,7 +180,7 @@ class Wdb(bdb.Bdb, basewin.BaseWindow): # Window debugger
else:
import wdbframewin
self.framewindows[name] = \
- wdbframewin.FrameWindow().init(self, \
+ wdbframewin.FrameWindow(self, \
self.curframe, \
self.curframe.f_globals, name)
do_g = do_globalframe
@@ -274,27 +272,27 @@ class Wdb(bdb.Bdb, basewin.BaseWindow): # Window debugger
# Simplified interface
def run(statement):
- x = Wdb().init()
+ x = Wdb()
try: x.run(statement)
finally: x.close()
def runctx(statement, globals, locals):
- x = Wdb().init()
+ x = Wdb()
try: x.runctx(statement, globals, locals)
finally: x.close()
def runcall(*args):
- x = Wdb().init()
- try: apply(Pdb().init().runcall, args)
+ x = Wdb()
+ try: apply(x.runcall, args)
finally: x.close()
# Post-Mortem interface
def post_mortem(traceback):
- p = Pdb().init()
- p.reset()
- p.interaction(None, traceback)
+ x = Wdb()
+ x.reset()
+ x.interaction(None, traceback)
def pm():
import sys
diff --git a/Lib/stdwin/wdbframewin.py b/Lib/stdwin/wdbframewin.py
index f8b84e3..13bd173 100755
--- a/Lib/stdwin/wdbframewin.py
+++ b/Lib/stdwin/wdbframewin.py
@@ -17,7 +17,7 @@ MAXHEIGHT = 16
class FrameWindow(basewin.BaseWindow):
- def init(self, debugger, frame, dict, name):
+ def __init__(self, debugger, frame, dict, name):
self.debugger = debugger
self.frame = frame # Not used except for identity tests
self.dict = dict
@@ -27,12 +27,12 @@ class FrameWindow(basewin.BaseWindow):
width = WIDTH*stdwin.textwidth('0')
height = nl*stdwin.lineheight()
stdwin.setdefwinsize(width, height)
- self = basewin.BaseWindow.init(self, '--Frame ' + name + '--')
+ basewin.BaseWindow.__init__(
+ self, '--Frame ' + name + '--')
# XXX Should use current function name
self.initeditor()
self.displaylist = ['>>>', '', '-'*WIDTH]
self.refreshframe()
- return self
def initeditor(self):
r = (stdwin.textwidth('>>> '), 0), (30000, stdwin.lineheight())
@@ -81,7 +81,7 @@ class FrameWindow(basewin.BaseWindow):
self.debugger.framewindows[name].popup()
else:
self.debugger.framewindows[name] = \
- FrameWindow().init(self.debugger,
+ FrameWindow(self.debugger,
self.frame, value.__dict__,
name)
return
diff --git a/Lib/stdwin/wdbsrcwin.py b/Lib/stdwin/wdbsrcwin.py
index 6c5cde8..f79fab9 100755
--- a/Lib/stdwin/wdbsrcwin.py
+++ b/Lib/stdwin/wdbsrcwin.py
@@ -7,11 +7,11 @@ import srcwin
class DebuggerSourceWindow(srcwin.SourceWindow):
- def init(self, debugger, filename):
+ def __init__(self, debugger, filename):
self.debugger = debugger
self.curlineno = 0
self.focus = 0
- return srcwin.SourceWindow.init(self, filename)
+ srcwin.SourceWindow.__init__(self, filename)
def close(self):
del self.debugger.sourcewindows[self.filename]