summaryrefslogtreecommitdiffstats
path: root/Mac/Demo
diff options
context:
space:
mode:
Diffstat (limited to 'Mac/Demo')
-rw-r--r--Mac/Demo/PICTbrowse/PICTbrowse.py6
-rw-r--r--Mac/Demo/PICTbrowse/oldPICTbrowse.py8
-rw-r--r--Mac/Demo/applescript/makedisk.py6
-rw-r--r--Mac/Demo/imgbrowse/imgbrowse.py10
-rw-r--r--Mac/Demo/imgbrowse/mac_image.py26
-rw-r--r--Mac/Demo/quicktime/VerySimplePlayer.py4
-rw-r--r--Mac/Demo/resources/copyres.py8
-rw-r--r--Mac/Demo/resources/listres.py10
-rw-r--r--Mac/Demo/sound/playaiff.py18
-rw-r--r--Mac/Demo/textedit/ped.py8
10 files changed, 52 insertions, 52 deletions
diff --git a/Mac/Demo/PICTbrowse/PICTbrowse.py b/Mac/Demo/PICTbrowse/PICTbrowse.py
index 0adfc83..83f431e 100644
--- a/Mac/Demo/PICTbrowse/PICTbrowse.py
+++ b/Mac/Demo/PICTbrowse/PICTbrowse.py
@@ -69,9 +69,9 @@ class PICTwindow(FrameWork.Window):
self.resid = resid
picture = Qd.GetPicture(self.resid)
# Get rect for picture
- print repr(picture.data[:16])
+ print(repr(picture.data[:16]))
sz, t, l, b, r = struct.unpack('hhhhh', picture.data[:10])
- print 'pict:', t, l, b, r
+ print('pict:', t, l, b, r)
width = r-l
height = b-t
if width < 64: width = 64
@@ -79,7 +79,7 @@ class PICTwindow(FrameWork.Window):
if height < 64: height = 64
elif height > 320: height = 320
bounds = (LEFT, TOP, LEFT+width, TOP+height)
- print 'bounds:', bounds
+ print('bounds:', bounds)
self.wid = Win.NewWindow(bounds, resname, 1, 0, -1, 1, 0)
self.wid.SetWindowPic(picture)
diff --git a/Mac/Demo/PICTbrowse/oldPICTbrowse.py b/Mac/Demo/PICTbrowse/oldPICTbrowse.py
index 8600bb2..2c6f08b 100644
--- a/Mac/Demo/PICTbrowse/oldPICTbrowse.py
+++ b/Mac/Demo/PICTbrowse/oldPICTbrowse.py
@@ -68,9 +68,9 @@ class PICTwindow(FrameWork.Window):
self.resid = resid
picture = Qd.GetPicture(self.resid)
# Get rect for picture
- print repr(picture.data[:16])
+ print(repr(picture.data[:16]))
sz, t, l, b, r = struct.unpack('hhhhh', picture.data[:10])
- print 'pict:', t, l, b, r
+ print('pict:', t, l, b, r)
width = r-l
height = b-t
if width < 64: width = 64
@@ -78,7 +78,7 @@ class PICTwindow(FrameWork.Window):
if height < 64: height = 64
elif height > 320: height = 320
bounds = (LEFT, TOP, LEFT+width, TOP+height)
- print 'bounds:', bounds
+ print('bounds:', bounds)
self.wid = Win.NewWindow(bounds, resname, 1, 0, -1, 1, 0)
self.wid.SetWindowPic(picture)
@@ -115,7 +115,7 @@ class MyDialog(FrameWork.DialogWindow):
(what, message, when, where, modifiers) = event
Qd.SetPort(self.wid)
where = Qd.GlobalToLocal(where)
- print 'LISTHIT', where
+ print('LISTHIT', where)
if self.list.LClick(where, modifiers):
self.do_show()
diff --git a/Mac/Demo/applescript/makedisk.py b/Mac/Demo/applescript/makedisk.py
index 013331c..981a5ef 100644
--- a/Mac/Demo/applescript/makedisk.py
+++ b/Mac/Demo/applescript/makedisk.py
@@ -8,8 +8,8 @@ filespec = macfs.FSSpec('my disk image.img')
try:
objref = talker.create('my disk image', saving_as=filespec, leave_image_mounted=1)
except Disk_Copy.Error as arg:
- print "ERROR: my disk image:", arg
+ print("ERROR: my disk image:", arg)
else:
- print 'objref=', objref
-print 'Type return to exit-'
+ print('objref=', objref)
+print('Type return to exit-')
sys.stdin.readline()
diff --git a/Mac/Demo/imgbrowse/imgbrowse.py b/Mac/Demo/imgbrowse/imgbrowse.py
index 57cddd3..fddfc99 100644
--- a/Mac/Demo/imgbrowse/imgbrowse.py
+++ b/Mac/Demo/imgbrowse/imgbrowse.py
@@ -25,7 +25,7 @@ MAXHEIGHT=320
def main():
- print 'hello world'
+ print('hello world')
imgbrowse()
class imgbrowse(FrameWork.Application):
@@ -84,10 +84,10 @@ class imgwindow(FrameWork.Window):
def do_update(self, *args):
pass
currect = self.fitrect()
- print 'PICT:', self.pictrect
- print 'WIND:', currect
- print 'ARGS:', (self.pixmap, self.wid.GetWindowPort().GetPortBitMapForCopyBits(), self.pictrect,
- currect, QuickDraw.srcCopy, None)
+ print('PICT:', self.pictrect)
+ print('WIND:', currect)
+ print('ARGS:', (self.pixmap, self.wid.GetWindowPort().GetPortBitMapForCopyBits(), self.pictrect,
+ currect, QuickDraw.srcCopy, None))
self.info()
Qd.CopyBits(self.pixmap, self.wid.GetWindowPort().GetPortBitMapForCopyBits(), self.pictrect,
currect, QuickDraw.srcCopy, None)
diff --git a/Mac/Demo/imgbrowse/mac_image.py b/Mac/Demo/imgbrowse/mac_image.py
index 9c9eeb7..75baff4 100644
--- a/Mac/Demo/imgbrowse/mac_image.py
+++ b/Mac/Demo/imgbrowse/mac_image.py
@@ -38,19 +38,19 @@ def dumppixmap(data):
cmpCount, cmpSize, \
planeBytes, pmTable, pmReserved \
= struct.unpack("lhhhhhhhlllhhhhlll", data)
- print 'Base: 0x%x'%baseAddr
- print 'rowBytes: %d (0x%x)'%(rowBytes&0x3fff, rowBytes)
- print 'rect: %d, %d, %d, %d'%(t, l, b, r)
- print 'pmVersion: 0x%x'%pmVersion
- print 'packing: %d %d'%(packType, packSize)
- print 'resolution: %f x %f'%(float(hRes)/0x10000, float(vRes)/0x10000)
- print 'pixeltype: %d, size %d'%(pixelType, pixelSize)
- print 'components: %d, size %d'%(cmpCount, cmpSize)
- print 'planeBytes: %d (0x%x)'%(planeBytes, planeBytes)
- print 'pmTable: 0x%x'%pmTable
- print 'pmReserved: 0x%x'%pmReserved
+ print('Base: 0x%x'%baseAddr)
+ print('rowBytes: %d (0x%x)'%(rowBytes&0x3fff, rowBytes))
+ print('rect: %d, %d, %d, %d'%(t, l, b, r))
+ print('pmVersion: 0x%x'%pmVersion)
+ print('packing: %d %d'%(packType, packSize))
+ print('resolution: %f x %f'%(float(hRes)/0x10000, float(vRes)/0x10000))
+ print('pixeltype: %d, size %d'%(pixelType, pixelSize))
+ print('components: %d, size %d'%(cmpCount, cmpSize))
+ print('planeBytes: %d (0x%x)'%(planeBytes, planeBytes))
+ print('pmTable: 0x%x'%pmTable)
+ print('pmReserved: 0x%x'%pmReserved)
for i in range(0, len(data), 16):
for j in range(16):
if i + j < len(data):
- print '%02.2x'%ord(data[i+j]),
- print
+ print('%02.2x'%ord(data[i+j]), end=' ')
+ print()
diff --git a/Mac/Demo/quicktime/VerySimplePlayer.py b/Mac/Demo/quicktime/VerySimplePlayer.py
index 2930eac..7c0fef0 100644
--- a/Mac/Demo/quicktime/VerySimplePlayer.py
+++ b/Mac/Demo/quicktime/VerySimplePlayer.py
@@ -18,7 +18,7 @@ import sys
# XXXX maxbounds = (40, 40, 1000, 1000)
def main():
- print 'hello world' # XXXX
+ print('hello world') # XXXX
# skip the toolbox initializations, already done
# XXXX Should use gestalt here to check for quicktime version
Qt.EnterMovies()
@@ -75,7 +75,7 @@ def main():
whichWindow = Win.WhichWindow(message)
if not whichWindow:
# Probably the console window. Print something, hope it helps.
- print 'update'
+ print('update')
else:
Qd.SetPort(whichWindow)
whichWindow.BeginUpdate()
diff --git a/Mac/Demo/resources/copyres.py b/Mac/Demo/resources/copyres.py
index da55b06..6c8a3c0 100644
--- a/Mac/Demo/resources/copyres.py
+++ b/Mac/Demo/resources/copyres.py
@@ -34,7 +34,7 @@ def copyres(src, dst):
id, type, name = res.GetResInfo()
size = res.SizeResource()
attrs = res.GetResAttrs()
- print id, type, name, size, hex(attrs)
+ print(id, type, name, size, hex(attrs))
res.DetachResource()
UseResFile(output)
try:
@@ -42,15 +42,15 @@ def copyres(src, dst):
except (RuntimeError, Res.Error) as msg:
res2 = None
if res2:
- print "Duplicate type+id, not copied"
+ print("Duplicate type+id, not copied")
print (res2.size, res2.data)
- print res2.GetResInfo()
+ print(res2.GetResInfo())
if res2.HomeResFile() == output:
'OK'
elif res2.HomeResFile() == input:
'BAD!'
else:
- print 'Home:', res2.HomeResFile()
+ print('Home:', res2.HomeResFile())
else:
res.AddResource(type, id, name)
#res.SetResAttrs(attrs)
diff --git a/Mac/Demo/resources/listres.py b/Mac/Demo/resources/listres.py
index 6ce5779..8f391eb 100644
--- a/Mac/Demo/resources/listres.py
+++ b/Mac/Demo/resources/listres.py
@@ -7,7 +7,7 @@ def list1resources():
ntypes = Res.Count1Types()
for itype in range(1, 1+ntypes):
type = Res.Get1IndType(itype)
- print "Type:", repr(type)
+ print("Type:", repr(type))
nresources = Res.Count1Resources(type)
for i in range(1, 1 + nresources):
Res.SetResLoad(0)
@@ -19,7 +19,7 @@ def listresources():
ntypes = Res.CountTypes()
for itype in range(1, 1+ntypes):
type = Res.GetIndType(itype)
- print "Type:", repr(type)
+ print("Type:", repr(type))
nresources = Res.CountResources(type)
for i in range(1, 1 + nresources):
Res.SetResLoad(0)
@@ -28,7 +28,7 @@ def listresources():
info(res)
def info(res):
- print res.GetResInfo(), res.SizeResource(), decodeattrs(res.GetResAttrs())
+ print(res.GetResInfo(), res.SizeResource(), decodeattrs(res.GetResAttrs()))
attrnames = {
resChanged: 'Changed',
@@ -51,9 +51,9 @@ def decodeattrs(attrs):
return names
def test():
- print "=== Local resourcess ==="
+ print("=== Local resourcess ===")
list1resources()
- print "=== All resources ==="
+ print("=== All resources ===")
listresources()
if __name__ == '__main__':
diff --git a/Mac/Demo/sound/playaiff.py b/Mac/Demo/sound/playaiff.py
index 8237895..087f7c9 100644
--- a/Mac/Demo/sound/playaiff.py
+++ b/Mac/Demo/sound/playaiff.py
@@ -5,16 +5,16 @@ import aifc, audioop
fn = 'f:just samples:2ndbeat.aif'
af = aifc.open(fn, 'r')
-print af.getparams()
-print 'nframes =', af.getnframes()
-print 'nchannels =', af.getnchannels()
-print 'framerate =', af.getframerate()
+print(af.getparams())
+print('nframes =', af.getnframes())
+print('nchannels =', af.getnchannels())
+print('framerate =', af.getframerate())
nframes = min(af.getnframes(), 100000)
frames = af.readframes(nframes)
-print 'len(frames) =', len(frames)
-print repr(frames[:100])
+print('len(frames) =', len(frames))
+print(repr(frames[:100]))
frames = audioop.add(frames, '\x80'*len(frames), 1)
-print repr(frames[:100])
+print(repr(frames[:100]))
import struct
@@ -27,7 +27,7 @@ header1 = struct.pack('llhhllbbl',
0xFF,
60,
nframes)
-print repr(header1)
+print(repr(header1))
header2 = struct.pack('llhlll', 0, 0, 0, 0, 0, 0)
header3 = struct.pack('hhlll',
af.getsampwidth()*8,
@@ -35,7 +35,7 @@ header3 = struct.pack('hhlll',
0,
0,
0)
-print repr(header3)
+print(repr(header3))
header = header1 + header2 + header3
buffer = header + frames
diff --git a/Mac/Demo/textedit/ped.py b/Mac/Demo/textedit/ped.py
index 8cd4713..f28ae3c 100644
--- a/Mac/Demo/textedit/ped.py
+++ b/Mac/Demo/textedit/ped.py
@@ -50,7 +50,7 @@ class TEWindow(ScrolledWindow):
height = self.ted.nLines * self.ted.lineHeight
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
+ print(dr, vr, height, vx, vy)
return None, vy
def scrollbar_callback(self, which, what, value):
@@ -72,12 +72,12 @@ class TEWindow(ScrolledWindow):
if delta >= 0:
delta = -self.ted.lineHeight
self.ted.TEPinScroll(0, delta)
- print 'SCROLL Y', delta
+ print('SCROLL Y', delta)
else:
pass # No horizontal scrolling
def do_activate(self, onoff, evt):
- print "ACTIVATE", onoff
+ print("ACTIVATE", onoff)
ScrolledWindow.do_activate(self, onoff, evt)
if onoff:
self.ted.TEActivate()
@@ -121,7 +121,7 @@ class TEWindow(ScrolledWindow):
if not self.path:
self.menu_save_as()
return # Will call us recursively
- print 'Saving to ', self.path
+ print('Saving to ', self.path)
dhandle = self.ted.TEGetText()
data = dhandle.data
fp = open(self.path, 'wb') # NOTE: wb, because data has CR for end-of-line