Lots of minor tweaks for the pep252 checkins, mainly because Qd
attributes are no longer supported.
diff --git a/Mac/Tools/IDE/MacPrefs.py b/Mac/Tools/IDE/MacPrefs.py
index b1fa7ca..716c828 100644
--- a/Mac/Tools/IDE/MacPrefs.py
+++ b/Mac/Tools/IDE/MacPrefs.py
@@ -70,7 +70,7 @@
 			else:
 				prefdict[key] = value
 		marshal.dump(prefdict, open(self.__path, 'wb'))
-		fss = macfs.FSSpec(self.__path)
+		fss = macfs.FSSpec(macfs.FSRef(self.__path))
 		fss.SetCreatorType(self.__creator, 'pref')
 	
 	def __getattr__(self, attr):
@@ -97,7 +97,7 @@
 	# Find the preferences folder and our prefs file, create if needed.
 	vrefnum, dirid = macfs.FindFolder(kOnSystemDisk, 'pref', 0)
 	prefsfolder_fss = macfs.FSSpec((vrefnum, dirid, ''))
-	prefsfolder = prefsfolder_fss.as_pathname()
+	prefsfolder = macfs.FSRef(prefsfolder_fss).as_fsspec().as_pathname()
 	path = os.path.join(prefsfolder, prefname)
 	head, tail = os.path.split(path)
 	# make sure the folder(s) exist
diff --git a/Mac/Tools/IDE/PyBrowser.py b/Mac/Tools/IDE/PyBrowser.py
index 2bb1686..fab577a 100644
--- a/Mac/Tools/IDE/PyBrowser.py
+++ b/Mac/Tools/IDE/PyBrowser.py
@@ -5,7 +5,6 @@
 import types
 import re
 from Carbon import Qd, Icn, Fm, QuickDraw
-from Carbon.List import GetListPort
 from Carbon.QuickDraw import hilitetransfermode
 
 
@@ -211,7 +210,7 @@
 				Qd.PaintRect(rect)
 				lastpoint = (x, y)
 		Qd.PaintRect(rect)
-		Qd.PenPat(Qd.qd.black)
+		Qd.PenPat(Qd.GetQDGlobalsBlack())
 		Qd.PenNormal()
 		if newcol > 0 and newcol <> abscol:
 			self.setcolumn(newcol - l)
@@ -369,7 +368,7 @@
 	def myDrawCell(self, onlyHilite, selected, cellRect, theCell, 
 			dataOffset, dataLen, theList):
 		savedPort = Qd.GetPort()
-		Qd.SetPort(GetListPort(theList))
+		Qd.SetPort(theList.GetListPort())
 		savedClip = Qd.NewRgn()
 		Qd.GetClip(savedClip)
 		Qd.ClipRect(cellRect)
diff --git a/Mac/Tools/IDE/PyConsole.py b/Mac/Tools/IDE/PyConsole.py
index 23f301b..9a4a44b 100644
--- a/Mac/Tools/IDE/PyConsole.py
+++ b/Mac/Tools/IDE/PyConsole.py
@@ -108,8 +108,8 @@
 		self._buf = ""
 		self.ted.WEClearUndo()
 		self.updatescrollbars()
-		if Qd.QDIsPortBuffered(self._parentwindow.wid):
-			Qd.QDFlushPortBuffer(self._parentwindow.wid, None)
+		if self._parentwindow.wid.GetWindowPort().QDIsPortBuffered():
+			self._parentwindow.wid.GetWindowPort().QDFlushPortBuffer(None)
 	
 	def selection_ok(self):
 		selstart, selend = self.getselection()
@@ -300,8 +300,8 @@
 		self._buf = ""
 		self.w.outputtext.updatescrollbars()
 		self.w.outputtext.ted.WEFeatureFlag(WASTEconst.weFReadOnly, 1)
-		if Qd.QDIsPortBuffered(self.w.wid):
-			Qd.QDFlushPortBuffer(self.w.wid, None)
+		if self.w.wid.GetWindowPort().QDIsPortBuffered():
+			self.w.wid.GetWindowPort().QDFlushPortBuffer(None)
 	
 	def show(self):
 		if self.closed:
diff --git a/Mac/Tools/IDE/Splash.py b/Mac/Tools/IDE/Splash.py
index 302053f..86009d2 100644
--- a/Mac/Tools/IDE/Splash.py
+++ b/Mac/Tools/IDE/Splash.py
@@ -48,8 +48,8 @@
 	if drawdialog:
 		splash.DrawDialog()
 	drawtext(what)
-	splash.GetDialogWindow().ValidWindowRect(splash.GetDialogPort().portRect)
-	Qd.QDFlushPortBuffer(splash.GetDialogWindow().GetWindowPort(), None)
+	splash.GetDialogWindow().ValidWindowRect(splash.GetDialogPort().GetPortBounds())
+	splash.GetDialogWindow().GetWindowPort().QDFlushPortBuffer(None)
 
 def drawtext(what = 0):
 	Qd.SetPort(splash)
diff --git a/Mac/Tools/IDE/Wbase.py b/Mac/Tools/IDE/Wbase.py
index c63aa77..f988ce7 100644
--- a/Mac/Tools/IDE/Wbase.py
+++ b/Mac/Tools/IDE/Wbase.py
@@ -376,7 +376,7 @@
 
 class Frame(Widget):
 	
-	def __init__(self, possize, pattern = Qd.qd.black, color = (0, 0, 0)):
+	def __init__(self, possize, pattern = Qd.GetQDGlobalsBlack(), color = (0, 0, 0)):
 		Widget.__init__(self, possize)
 		self._framepattern = pattern
 		self._framecolor = color
@@ -570,7 +570,7 @@
 		
 		# track mouse --- XXX  move to separate method?
 		Qd.PenMode(QuickDraw.srcXor)
-		Qd.PenPat(Qd.qd.gray)
+		Qd.PenPat(Qd.GetQDGlobalsGray())
 		Qd.PaintRect(rect)
 		lastpos = None
 		while Evt.Button():
@@ -579,16 +579,16 @@
 			pos = min(pos, maxpos)
 			if pos == lastpos:
 				continue
-			Qd.PenPat(Qd.qd.gray)
+			Qd.PenPat(Qd.GetQDGlobalsGray())
 			Qd.PaintRect(rect)
 			if self._direction:
 				rect = l, pos - 1, r, pos
 			else:
 				rect = pos - 1, t, pos, b
-			Qd.PenPat(Qd.qd.gray)
+			Qd.PenPat(Qd.GetQDGlobalsGray())
 			Qd.PaintRect(rect)
 			lastpos = pos
-			Qd.QDFlushPortBuffer(self._parentwindow.wid, None)
+			self._parentwindow.wid.GetWindowPort().QDFlushPortBuffer(None)
 			Evt.WaitNextEvent(0, 3)
 		Qd.PaintRect(rect)
 		Qd.PenNormal()
@@ -643,7 +643,7 @@
 		if self._visible:
 			if not visRgn:
 				visRgn = self._parentwindow.wid.GetWindowPort().visRgn
-			Qd.PenPat(Qd.qd.gray)
+			Qd.PenPat(Qd.GetQDGlobalsGray())
 			rect = self._bounds
 			Qd.FrameRect(rect)
 			rect = Qd.InsetRect(rect, 3, 3)
@@ -700,7 +700,7 @@
 # data below.
 #_cursors = {
 #	"watch"	: Qd.GetCursor(QuickDraw.watchCursor).data,
-#	"arrow"	: Qd.qd.arrow,
+#	"arrow"	: Qd.GetQDGlobalsArrow(),
 #	"iBeam"	: Qd.GetCursor(QuickDraw.iBeamCursor).data,
 #	"cross"	: Qd.GetCursor(QuickDraw.crossCursor).data,
 #	"plus"		: Qd.GetCursor(QuickDraw.plusCursor).data,
diff --git a/Mac/Tools/IDE/Wcontrols.py b/Mac/Tools/IDE/Wcontrols.py
index ab6ae96..3d52383 100644
--- a/Mac/Tools/IDE/Wcontrols.py
+++ b/Mac/Tools/IDE/Wcontrols.py
@@ -170,7 +170,7 @@
 		# emulate the pushing of the button
 		import time
 		self._control.HiliteControl(Controls.kControlButtonPart)
-		Qd.QDFlushPortBuffer(self._parentwindow.wid, None)  # needed under OSX
+		self._parentwindow.wid.GetWindowPort().QDFlushPortBuffer(None)  # needed under OSX
 		time.sleep(0.1)
 		self._control.HiliteControl(0)
 		if self._callback:
diff --git a/Mac/Tools/IDE/Wlists.py b/Mac/Tools/IDE/Wlists.py
index 2be1a9c..4f0e49b 100644
--- a/Mac/Tools/IDE/Wlists.py
+++ b/Mac/Tools/IDE/Wlists.py
@@ -2,7 +2,7 @@
 import Wkeys
 import string
 from Carbon import Evt, Events, Fm, Lists, Qd, Scrap, Win
-from Carbon.List import LNew, CreateCustomList, GetListPort
+from Carbon.List import LNew, CreateCustomList
 from Carbon.Lists import kListDefUserProcType, lInitMsg, lDrawMsg, lHiliteMsg, lCloseMsg
 from Carbon.QuickDraw import hilitetransfermode
 from Carbon import App
@@ -435,7 +435,7 @@
 	def listDefDraw(self, selected, cellRect, theCell,
 			dataOffset, dataLen, theList):
 		savedPort = Qd.GetPort()
-		Qd.SetPort(GetListPort(theList))
+		Qd.SetPort(theList.GetListPort())
 		savedClip = Qd.NewRgn()
 		Qd.GetClip(savedClip)
 		Qd.ClipRect(cellRect)
@@ -477,7 +477,7 @@
 	def listDefHighlight(self, selected, cellRect, theCell,
 			dataOffset, dataLen, theList):
 		savedPort = Qd.GetPort()
-		Qd.SetPort(GetListPort(theList))
+		Qd.SetPort(theList.GetListPort())
 		savedClip = Qd.NewRgn()
 		Qd.GetClip(savedClip)
 		Qd.ClipRect(cellRect)
diff --git a/Mac/Tools/IDE/Wtext.py b/Mac/Tools/IDE/Wtext.py
index 86c79c3..d611c73 100644
--- a/Mac/Tools/IDE/Wtext.py
+++ b/Mac/Tools/IDE/Wtext.py
@@ -965,7 +965,7 @@
 					if autoscroll:
 						self.ted.WEFeatureFlag(WASTEconst.weFAutoScroll, 0)
 					self.ted.WESetSelection(count, count + 1)
-					Qd.QDFlushPortBuffer(self._parentwindow.wid, None)  # needed under OSX
+					self._parentwindow.wid.GetWindowPort().QDFlushPortBuffer(None)  # needed under OSX
 					time.sleep(0.2)
 					self.ted.WESetSelection(selstart, selend)
 					if autoscroll:
@@ -1042,7 +1042,7 @@
 		breakrect = bl, bt, br, bb = self._getbreakrect()
 		br = br - 1
 		self.SetPort()
-		Qd.PenPat(Qd.qd.gray)
+		Qd.PenPat(Qd.GetQDGlobalsGray())
 		Qd.PaintRect((br, bt, br + 1, bb))
 		Qd.PenNormal()
 		self._parentwindow.tempcliprect(breakrect)
@@ -1123,7 +1123,7 @@
 GetFName = Fm.GetFontName
 
 def GetPortFontSettings(port):
-	return Fm.GetFontName(port.txFont), port.txFace, port.txSize
+	return Fm.GetFontName(port.GetPortTextFont()), port.GetPortTextFace(), port.GetPortTextSize()
 
 def SetPortFontSettings(port, (font, face, size)):
 	saveport = Qd.GetPort()
diff --git a/Mac/Tools/IDE/Wwindows.py b/Mac/Tools/IDE/Wwindows.py
index ffab76c..d646bcf 100644
--- a/Mac/Tools/IDE/Wwindows.py
+++ b/Mac/Tools/IDE/Wwindows.py
@@ -270,7 +270,7 @@
 			self._collectselectablewidgets(w._widgets)
 	
 	def _calcbounds(self):
-		self._possize = self.wid.GetWindowPort().portRect[2:]
+		self._possize = self.wid.GetWindowPort().GetPortBounds()[2:]
 		w, h = self._possize
 		self._bounds = (0, 0, w, h)
 		self.wid.GetWindowContentRgn(scratchRegion)
@@ -387,7 +387,7 @@
 		del self.saveclip[-1]
 	
 	def getgrowrect(self):
-		l, t, r, b = self.wid.GetWindowPort().portRect
+		l, t, r, b = self.wid.GetWindowPort().GetPortBounds()
 		return (r - 15, b - 15, r, b)
 	
 	def has_key(self, key):
@@ -423,7 +423,7 @@
 		return 0
 	
 	def getwindowbounds(self, size, minsize = None):
-		screenbounds = sl, st, sr, sb = Qd.qd.screenBits.bounds
+		screenbounds = sl, st, sr, sb = Qd.GetQDGlobalsScreenBits().bounds
 		w, h = size
 		l = sl + (sr - sl - w) / 2
 		t = st + (sb - st - h) / 3
@@ -615,7 +615,7 @@
 	minwidth, minheight = minsize
 	width, height = preferredsize
 	
-	sl, st, sr, sb = screenbounds = Qd.InsetRect(Qd.qd.screenBits.bounds, 4, 4)
+	sl, st, sr, sb = screenbounds = Qd.InsetRect(Qd.GetQDGlobalsScreenBits().bounds, 4, 4)
 	l, t = getnextwindowpos()
 	if (l + width) > sr:
 		_windowcounter = 0