Kaydet (Commit) 362c7cd0 authored tarafından Jack Jansen's avatar Jack Jansen

Lots of minor tweaks for the pep252 checkins, mainly because Qd

attributes are no longer supported.
üst 202355a3
...@@ -124,7 +124,7 @@ class ExtMovie: ...@@ -124,7 +124,7 @@ class ExtMovie:
#Qd.MoveTo(10,10) #Qd.MoveTo(10,10)
#Qd.LineTo(200,150) #Qd.LineTo(200,150)
Qd.CopyBits(self.gw.portBits,Qd.GetPort().portBits,self.myRect,destRect,srcCopy,None) Qd.CopyBits(self.gw.GetPortBitMapForCopyBits(),Qd.GetPort().GetPortBitMapForCopyBits(),self.myRect,destRect,srcCopy,None)
class MovieWin(W.Window): class MovieWin(W.Window):
......
...@@ -93,7 +93,7 @@ class ICONwindow(FrameWork.Window): ...@@ -93,7 +93,7 @@ class ICONwindow(FrameWork.Window):
def fitrect(self): def fitrect(self):
"""Return self.pictrect scaled to fit in window""" """Return self.pictrect scaled to fit in window"""
graf = self.wid.GetWindowPort() graf = self.wid.GetWindowPort()
screenrect = graf.portRect screenrect = graf.GetPortBounds()
picwidth = self.pictrect[2] - self.pictrect[0] picwidth = self.pictrect[2] - self.pictrect[0]
picheight = self.pictrect[3] - self.pictrect[1] picheight = self.pictrect[3] - self.pictrect[1]
if picwidth > screenrect[2] - screenrect[0]: if picwidth > screenrect[2] - screenrect[0]:
......
...@@ -93,7 +93,7 @@ class PICTwindow(FrameWork.Window): ...@@ -93,7 +93,7 @@ class PICTwindow(FrameWork.Window):
def fitrect(self): def fitrect(self):
"""Return self.pictrect scaled to fit in window""" """Return self.pictrect scaled to fit in window"""
graf = self.dlg.GetWindowPort() graf = self.dlg.GetWindowPort()
screenrect = graf.portRect screenrect = graf.GetPortBounds()
picwidth = self.pictrect[2] - self.pictrect[0] picwidth = self.pictrect[2] - self.pictrect[0]
picheight = self.pictrect[3] - self.pictrect[1] picheight = self.pictrect[3] - self.pictrect[1]
if picwidth > screenrect[2] - screenrect[0]: if picwidth > screenrect[2] - screenrect[0]:
......
...@@ -93,7 +93,7 @@ class CIconwindow(FrameWork.Window): ...@@ -93,7 +93,7 @@ class CIconwindow(FrameWork.Window):
def fitrect(self): def fitrect(self):
"""Return self.pictrect scaled to fit in window""" """Return self.pictrect scaled to fit in window"""
graf = self.wid.GetWindowPort() graf = self.wid.GetWindowPort()
screenrect = graf.portRect screenrect = graf.GetPortBounds()
picwidth = self.pictrect[2] - self.pictrect[0] picwidth = self.pictrect[2] - self.pictrect[0]
picheight = self.pictrect[3] - self.pictrect[1] picheight = self.pictrect[3] - self.pictrect[1]
if picwidth > screenrect[2] - screenrect[0]: if picwidth > screenrect[2] - screenrect[0]:
......
"""imgbrowse - Display pictures using img""" GetPortBounds()"""imgbrowse - Display pictures using img"""
import FrameWork import FrameWork
import EasyDialogs import EasyDialogs
...@@ -88,16 +88,16 @@ class imgwindow(FrameWork.Window): ...@@ -88,16 +88,16 @@ class imgwindow(FrameWork.Window):
currect = self.fitrect() currect = self.fitrect()
print 'PICT:', self.pictrect print 'PICT:', self.pictrect
print 'WIND:', currect print 'WIND:', currect
print 'ARGS:', (self.pixmap, self.wid.GetWindowPort().portBits, self.pictrect, print 'ARGS:', (self.pixmap, self.wid.GetWindowPort().GetPortBitMapForCopyBits(), self.pictrect,
currect, QuickDraw.srcCopy, None) currect, QuickDraw.srcCopy, None)
self.info() self.info()
Qd.CopyBits(self.pixmap, self.wid.GetWindowPort().portBits, self.pictrect, Qd.CopyBits(self.pixmap, self.wid.GetWindowPort().GetPortBitMapForCopyBits(), self.pictrect,
currect, QuickDraw.srcCopy, None) currect, QuickDraw.srcCopy, None)
def fitrect(self): def fitrect(self):
"""Return self.pictrect scaled to fit in window""" """Return self.pictrect scaled to fit in window"""
graf = self.wid.GetWindowPort() graf = self.wid.GetWindowPort()
screenrect = graf.portRect screenrect = graf.GetPortBounds()
picwidth = self.pictrect[2] - self.pictrect[0] picwidth = self.pictrect[2] - self.pictrect[0]
picheight = self.pictrect[3] - self.pictrect[1] picheight = self.pictrect[3] - self.pictrect[1]
if picwidth > screenrect[2] - screenrect[0]: if picwidth > screenrect[2] - screenrect[0]:
...@@ -113,7 +113,7 @@ class imgwindow(FrameWork.Window): ...@@ -113,7 +113,7 @@ class imgwindow(FrameWork.Window):
def info(self): def info(self):
graf = self.wid.GetWindowPort() graf = self.wid.GetWindowPort()
bits = graf.portBits bits = graf.GetPortBitMapForCopyBits()
mac_image.dumppixmap(bits.pixmap_data) mac_image.dumppixmap(bits.pixmap_data)
main() main()
...@@ -362,7 +362,7 @@ class Mlted(Application): ...@@ -362,7 +362,7 @@ class Mlted(Application):
if self.active: if self.active:
self.active.do_idle(event) self.active.do_idle(event)
else: else:
Qd.SetCursor(Qd.qd.arrow) Qd.SetCursor(Qd.GetQDGlobalsArrow())
def main(): def main():
Mlte.TXNInitTextension(0) Mlte.TXNInitTextension(0)
......
...@@ -31,7 +31,7 @@ def main(): ...@@ -31,7 +31,7 @@ def main():
Qd.SetPort(theWindow) Qd.SetPort(theWindow)
# XXXX Needed? SetGWorld((CGrafPtr)theWindow, nil) # XXXX Needed? SetGWorld((CGrafPtr)theWindow, nil)
playMovieInWindow(theWindow, fss, theWindow.GetWindowPort().portRect) playMovieInWindow(theWindow, fss, theWindow.GetWindowPort().GetPortBounds())
def playMovieInWindow(theWindow, theFile, movieBox): def playMovieInWindow(theWindow, theFile, movieBox):
"""Play a movie in a window""" """Play a movie in a window"""
......
...@@ -78,7 +78,7 @@ def main(): ...@@ -78,7 +78,7 @@ def main():
else: else:
Qd.SetPort(whichWindow) Qd.SetPort(whichWindow)
whichWindow.BeginUpdate() whichWindow.BeginUpdate()
Qd.EraseRect(whichWindow.GetWindowPort().portRect) Qd.EraseRect(whichWindow.GetWindowPort().GetPortBounds())
whichWindow.EndUpdate() whichWindow.EndUpdate()
def loadMovie(theFile): def loadMovie(theFile):
......
...@@ -21,7 +21,7 @@ class TEWindow(ScrolledWindow): ...@@ -21,7 +21,7 @@ class TEWindow(ScrolledWindow):
r = windowbounds(400, 400) r = windowbounds(400, 400)
w = Win.NewWindow(r, name, 1, 0, -1, 1, 0) w = Win.NewWindow(r, name, 1, 0, -1, 1, 0)
self.wid = w self.wid = w
x0, y0, x1, y1 = self.wid.GetWindowPort().portRect x0, y0, x1, y1 = self.wid.GetWindowPort().GetPortBounds()
x0 = x0 + 4 x0 = x0 + 4
y0 = y0 + 4 y0 = y0 + 4
x1 = x1 - 20 x1 = x1 - 20
...@@ -87,8 +87,8 @@ class TEWindow(ScrolledWindow): ...@@ -87,8 +87,8 @@ class TEWindow(ScrolledWindow):
self.ted.TEDeactivate() self.ted.TEDeactivate()
def do_update(self, wid, event): def do_update(self, wid, event):
Qd.EraseRect(wid.GetWindowPort().portRect) Qd.EraseRect(wid.GetWindowPort().GetPortBounds())
self.ted.TEUpdate(wid.GetWindowPort().portRect) self.ted.TEUpdate(wid.GetWindowPort().GetPortBounds())
self.updatescrollbars() self.updatescrollbars()
def do_contentclick(self, local, modifiers, evt): def do_contentclick(self, local, modifiers, evt):
...@@ -350,7 +350,7 @@ class Ped(Application): ...@@ -350,7 +350,7 @@ class Ped(Application):
if self.active: if self.active:
self.active.do_idle() self.active.do_idle()
else: else:
Qd.SetCursor(Qd.qd.arrow) Qd.SetCursor(Qd.GetQDGlobalsArrow())
def main(): def main():
App = Ped() App = Ped()
......
...@@ -95,7 +95,7 @@ class WasteWindow(ScrolledWindow): ...@@ -95,7 +95,7 @@ class WasteWindow(ScrolledWindow):
self.ted.WEIdle() self.ted.WEIdle()
if self.ted.WEAdjustCursor(where, BIGREGION): if self.ted.WEAdjustCursor(where, BIGREGION):
return return
Qd.SetCursor(Qd.qd.arrow) Qd.SetCursor(Qd.GetQDGlobalsArrow())
def getscrollbarvalues(self): def getscrollbarvalues(self):
dr = self.ted.WEGetDestRect() dr = self.ted.WEGetDestRect()
...@@ -780,7 +780,7 @@ class Wed(Application): ...@@ -780,7 +780,7 @@ class Wed(Application):
if self.active: if self.active:
self.active.do_idle(event) self.active.do_idle(event)
else: else:
Qd.SetCursor(Qd.qd.arrow) Qd.SetCursor(Qd.GetQDGlobalsArrow())
def newRuler(self, obj): def newRuler(self, obj):
"""Insert a new ruler. Make it as wide as the window minus 2 pxls""" """Insert a new ruler. Make it as wide as the window minus 2 pxls"""
......
...@@ -83,7 +83,7 @@ class WasteWindow(ScrolledWindow): ...@@ -83,7 +83,7 @@ class WasteWindow(ScrolledWindow):
self.ted.WEIdle() self.ted.WEIdle()
if self.ted.WEAdjustCursor(where, BIGREGION): if self.ted.WEAdjustCursor(where, BIGREGION):
return return
Qd.SetCursor(Qd.qd.arrow) Qd.SetCursor(Qd.GetQDGlobalsArrow())
def getscrollbarvalues(self): def getscrollbarvalues(self):
dr = self.ted.WEGetDestRect() dr = self.ted.WEGetDestRect()
...@@ -609,7 +609,7 @@ class Wed(Application): ...@@ -609,7 +609,7 @@ class Wed(Application):
if self.active: if self.active:
self.active.do_idle(event) self.active.do_idle(event)
else: else:
Qd.SetCursor(Qd.qd.arrow) Qd.SetCursor(Qd.GetQDGlobalsArrow())
def getfontnames(): def getfontnames():
names = [] names = []
......
...@@ -50,7 +50,7 @@ class WasteWindow(ScrolledWindow): ...@@ -50,7 +50,7 @@ class WasteWindow(ScrolledWindow):
self.ted.WEIdle() self.ted.WEIdle()
if self.ted.WEAdjustCursor(where, BIGREGION): if self.ted.WEAdjustCursor(where, BIGREGION):
return return
Qd.SetCursor(Qd.qd.arrow) Qd.SetCursor(Qd.GetQDGlobalsArrow())
def getscrollbarvalues(self): def getscrollbarvalues(self):
dr = self.ted.WEGetDestRect() dr = self.ted.WEGetDestRect()
...@@ -417,7 +417,7 @@ class Wed(Application): ...@@ -417,7 +417,7 @@ class Wed(Application):
if self.active: if self.active:
self.active.do_idle(event) self.active.do_idle(event)
else: else:
Qd.SetCursor(Qd.qd.arrow) Qd.SetCursor(Qd.GetQDGlobalsArrow())
def main(): def main():
App = Wed() App = Wed()
......
...@@ -222,7 +222,7 @@ def AskYesNoCancel(question, default = 0, yes=None, no=None, cancel=None, id=262 ...@@ -222,7 +222,7 @@ def AskYesNoCancel(question, default = 0, yes=None, no=None, cancel=None, id=262
screenbounds = Qd.qd.screenBits.bounds screenbounds = Qd.GetQDGlobalsScreenBits().bounds
screenbounds = screenbounds[0]+4, screenbounds[1]+4, \ screenbounds = screenbounds[0]+4, screenbounds[1]+4, \
screenbounds[2]-4, screenbounds[3]-4 screenbounds[2]-4, screenbounds[3]-4
......
...@@ -68,7 +68,7 @@ partname[8] = 'inZoomOut' ...@@ -68,7 +68,7 @@ partname[8] = 'inZoomOut'
# #
# The useable portion of the screen # The useable portion of the screen
# ## but what happens with multiple screens? jvr # ## but what happens with multiple screens? jvr
screenbounds = qd.screenBits.bounds screenbounds = GetQDGlobalsScreenBits().bounds
screenbounds = screenbounds[0]+4, screenbounds[1]+4, \ screenbounds = screenbounds[0]+4, screenbounds[1]+4, \
screenbounds[2]-4, screenbounds[3]-4 screenbounds[2]-4, screenbounds[3]-4
...@@ -97,7 +97,7 @@ def setwatchcursor(): ...@@ -97,7 +97,7 @@ def setwatchcursor():
SetCursor(_watch) SetCursor(_watch)
def setarrowcursor(): def setarrowcursor():
SetCursor(qd.arrow) SetCursor(GetQDGlobalsArrow())
class Application: class Application:
...@@ -808,7 +808,7 @@ class Window: ...@@ -808,7 +808,7 @@ class Window:
growlimit = (50, 50, screenbounds[2] - screenbounds[0], screenbounds[3] - screenbounds[1]) # jvr growlimit = (50, 50, screenbounds[2] - screenbounds[0], screenbounds[3] - screenbounds[1]) # jvr
def do_resize(self, width, height, window): def do_resize(self, width, height, window):
l, t, r, b = self.wid.GetWindowPort().portRect # jvr, forGrowIcon l, t, r, b = self.wid.GetWindowPort().GetPortBounds() # jvr, forGrowIcon
self.SetPort() # jvr self.SetPort() # jvr
self.wid.InvalWindowRect((r - SCROLLBARWIDTH + 1, b - SCROLLBARWIDTH + 1, r, b)) # jvr self.wid.InvalWindowRect((r - SCROLLBARWIDTH + 1, b - SCROLLBARWIDTH + 1, r, b)) # jvr
window.SizeWindow(width, height, 1) # changed updateFlag to true jvr window.SizeWindow(width, height, 1) # changed updateFlag to true jvr
...@@ -816,7 +816,7 @@ class Window: ...@@ -816,7 +816,7 @@ class Window:
def do_postresize(self, width, height, window): def do_postresize(self, width, height, window):
SetPort(window) SetPort(window)
self.wid.InvalWindowRect(window.GetWindowPort().portRect) self.wid.InvalWindowRect(window.GetWindowPort().GetPortBounds())
def do_inContent(self, partcode, window, event): def do_inContent(self, partcode, window, event):
# #
...@@ -849,7 +849,7 @@ class Window: ...@@ -849,7 +849,7 @@ class Window:
for i in range(8): for i in range(8):
time.sleep(0.1) time.sleep(0.1)
InvertRgn(window.GetWindowPort().visRgn) InvertRgn(window.GetWindowPort().visRgn)
FillRgn(window.GetWindowPort().visRgn, qd.gray) FillRgn(window.GetWindowPort().visRgn, GetQDGlobalsGray())
else: else:
EraseRgn(window.GetWindowPort().visRgn) EraseRgn(window.GetWindowPort().visRgn)
...@@ -902,7 +902,7 @@ class ScrolledWindow(ControlsWindow): ...@@ -902,7 +902,7 @@ class ScrolledWindow(ControlsWindow):
SetPort(self.wid) SetPort(self.wid)
self.barx = self.bary = None self.barx = self.bary = None
self.barx_enabled = self.bary_enabled = 1 self.barx_enabled = self.bary_enabled = 1
x0, y0, x1, y1 = self.wid.GetWindowPort().portRect x0, y0, x1, y1 = self.wid.GetWindowPort().GetPortBounds()
vx, vy = self.getscrollbarvalues() vx, vy = self.getscrollbarvalues()
if vx == None: self.barx_enabled, vx = 0, 0 if vx == None: self.barx_enabled, vx = 0, 0
if vy == None: self.bary_enabled, vy = 0, 0 if vy == None: self.bary_enabled, vy = 0, 0
...@@ -938,7 +938,7 @@ class ScrolledWindow(ControlsWindow): ...@@ -938,7 +938,7 @@ class ScrolledWindow(ControlsWindow):
self.wid.DrawGrowIcon() # jvr self.wid.DrawGrowIcon() # jvr
def do_postresize(self, width, height, window): def do_postresize(self, width, height, window):
l, t, r, b = self.wid.GetWindowPort().portRect l, t, r, b = self.wid.GetWindowPort().GetPortBounds()
self.SetPort() self.SetPort()
if self.barx: if self.barx:
self.barx.HideControl() # jvr self.barx.HideControl() # jvr
......
...@@ -151,7 +151,7 @@ class PixMapWrapper: ...@@ -151,7 +151,7 @@ class PixMapWrapper:
if y2 == None: if y2 == None:
dest[3] = y1 + src[3]-src[1] dest[3] = y1 + src[3]-src[1]
if not port: port = Qd.GetPort() if not port: port = Qd.GetPort()
Qd.CopyBits(self.PixMap(), port.portBits, src, tuple(dest), Qd.CopyBits(self.PixMap(), port.GetPortBitMapForCopyBits(), src, tuple(dest),
QuickDraw.srcCopy, None) QuickDraw.srcCopy, None)
def fromstring(self,s,width,height,format=imgformat.macrgb): def fromstring(self,s,width,height,format=imgformat.macrgb):
......
...@@ -28,7 +28,7 @@ else: ...@@ -28,7 +28,7 @@ else:
if sys.platform == 'mac': if sys.platform == 'mac':
_MWERKSDIR="Macintosh HD:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior" _MWERKSDIR="Macintosh HD:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior"
else: else:
_MWERKSDIR="/Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/" _MWERKSDIR="/Volumes/Moes/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/"
INCLUDEDIR=os.path.join(_MWERKSDIR, "MacOS Support", "Universal", "Interfaces", "CIncludes") INCLUDEDIR=os.path.join(_MWERKSDIR, "MacOS Support", "Universal", "Interfaces", "CIncludes")
# #
......
...@@ -70,7 +70,7 @@ class PrefFile(PrefObject): ...@@ -70,7 +70,7 @@ class PrefFile(PrefObject):
else: else:
prefdict[key] = value prefdict[key] = value
marshal.dump(prefdict, open(self.__path, 'wb')) marshal.dump(prefdict, open(self.__path, 'wb'))
fss = macfs.FSSpec(self.__path) fss = macfs.FSSpec(macfs.FSRef(self.__path))
fss.SetCreatorType(self.__creator, 'pref') fss.SetCreatorType(self.__creator, 'pref')
def __getattr__(self, attr): def __getattr__(self, attr):
...@@ -97,7 +97,7 @@ def GetPrefs(prefname, creator = 'Pyth'): ...@@ -97,7 +97,7 @@ def GetPrefs(prefname, creator = 'Pyth'):
# Find the preferences folder and our prefs file, create if needed. # Find the preferences folder and our prefs file, create if needed.
vrefnum, dirid = macfs.FindFolder(kOnSystemDisk, 'pref', 0) vrefnum, dirid = macfs.FindFolder(kOnSystemDisk, 'pref', 0)
prefsfolder_fss = macfs.FSSpec((vrefnum, dirid, '')) 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) path = os.path.join(prefsfolder, prefname)
head, tail = os.path.split(path) head, tail = os.path.split(path)
# make sure the folder(s) exist # make sure the folder(s) exist
......
...@@ -5,7 +5,6 @@ import string ...@@ -5,7 +5,6 @@ import string
import types import types
import re import re
from Carbon import Qd, Icn, Fm, QuickDraw from Carbon import Qd, Icn, Fm, QuickDraw
from Carbon.List import GetListPort
from Carbon.QuickDraw import hilitetransfermode from Carbon.QuickDraw import hilitetransfermode
...@@ -211,7 +210,7 @@ class BrowserWidget(W.CustomList): ...@@ -211,7 +210,7 @@ class BrowserWidget(W.CustomList):
Qd.PaintRect(rect) Qd.PaintRect(rect)
lastpoint = (x, y) lastpoint = (x, y)
Qd.PaintRect(rect) Qd.PaintRect(rect)
Qd.PenPat(Qd.qd.black) Qd.PenPat(Qd.GetQDGlobalsBlack())
Qd.PenNormal() Qd.PenNormal()
if newcol > 0 and newcol <> abscol: if newcol > 0 and newcol <> abscol:
self.setcolumn(newcol - l) self.setcolumn(newcol - l)
...@@ -369,7 +368,7 @@ class BrowserWidget(W.CustomList): ...@@ -369,7 +368,7 @@ class BrowserWidget(W.CustomList):
def myDrawCell(self, onlyHilite, selected, cellRect, theCell, def myDrawCell(self, onlyHilite, selected, cellRect, theCell,
dataOffset, dataLen, theList): dataOffset, dataLen, theList):
savedPort = Qd.GetPort() savedPort = Qd.GetPort()
Qd.SetPort(GetListPort(theList)) Qd.SetPort(theList.GetListPort())
savedClip = Qd.NewRgn() savedClip = Qd.NewRgn()
Qd.GetClip(savedClip) Qd.GetClip(savedClip)
Qd.ClipRect(cellRect) Qd.ClipRect(cellRect)
......
...@@ -108,8 +108,8 @@ class ConsoleTextWidget(W.EditText): ...@@ -108,8 +108,8 @@ class ConsoleTextWidget(W.EditText):
self._buf = "" self._buf = ""
self.ted.WEClearUndo() self.ted.WEClearUndo()
self.updatescrollbars() self.updatescrollbars()
if Qd.QDIsPortBuffered(self._parentwindow.wid): if self._parentwindow.wid.GetWindowPort().QDIsPortBuffered():
Qd.QDFlushPortBuffer(self._parentwindow.wid, None) self._parentwindow.wid.GetWindowPort().QDFlushPortBuffer(None)
def selection_ok(self): def selection_ok(self):
selstart, selend = self.getselection() selstart, selend = self.getselection()
...@@ -300,8 +300,8 @@ class PyOutput: ...@@ -300,8 +300,8 @@ class PyOutput:
self._buf = "" self._buf = ""
self.w.outputtext.updatescrollbars() self.w.outputtext.updatescrollbars()
self.w.outputtext.ted.WEFeatureFlag(WASTEconst.weFReadOnly, 1) self.w.outputtext.ted.WEFeatureFlag(WASTEconst.weFReadOnly, 1)
if Qd.QDIsPortBuffered(self.w.wid): if self.w.wid.GetWindowPort().QDIsPortBuffered():
Qd.QDFlushPortBuffer(self.w.wid, None) self.w.wid.GetWindowPort().QDFlushPortBuffer(None)
def show(self): def show(self):
if self.closed: if self.closed:
......
...@@ -48,8 +48,8 @@ def UpdateSplash(drawdialog = 0, what = 0): ...@@ -48,8 +48,8 @@ def UpdateSplash(drawdialog = 0, what = 0):
if drawdialog: if drawdialog:
splash.DrawDialog() splash.DrawDialog()
drawtext(what) drawtext(what)
splash.GetDialogWindow().ValidWindowRect(splash.GetDialogPort().portRect) splash.GetDialogWindow().ValidWindowRect(splash.GetDialogPort().GetPortBounds())
Qd.QDFlushPortBuffer(splash.GetDialogWindow().GetWindowPort(), None) splash.GetDialogWindow().GetWindowPort().QDFlushPortBuffer(None)
def drawtext(what = 0): def drawtext(what = 0):
Qd.SetPort(splash) Qd.SetPort(splash)
......
...@@ -376,7 +376,7 @@ class VerticalLine(_Line): ...@@ -376,7 +376,7 @@ class VerticalLine(_Line):
class Frame(Widget): 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) Widget.__init__(self, possize)
self._framepattern = pattern self._framepattern = pattern
self._framecolor = color self._framecolor = color
...@@ -570,7 +570,7 @@ class HorizontalPanes(Widget): ...@@ -570,7 +570,7 @@ class HorizontalPanes(Widget):
# track mouse --- XXX move to separate method? # track mouse --- XXX move to separate method?
Qd.PenMode(QuickDraw.srcXor) Qd.PenMode(QuickDraw.srcXor)
Qd.PenPat(Qd.qd.gray) Qd.PenPat(Qd.GetQDGlobalsGray())
Qd.PaintRect(rect) Qd.PaintRect(rect)
lastpos = None lastpos = None
while Evt.Button(): while Evt.Button():
...@@ -579,16 +579,16 @@ class HorizontalPanes(Widget): ...@@ -579,16 +579,16 @@ class HorizontalPanes(Widget):
pos = min(pos, maxpos) pos = min(pos, maxpos)
if pos == lastpos: if pos == lastpos:
continue continue
Qd.PenPat(Qd.qd.gray) Qd.PenPat(Qd.GetQDGlobalsGray())
Qd.PaintRect(rect) Qd.PaintRect(rect)
if self._direction: if self._direction:
rect = l, pos - 1, r, pos rect = l, pos - 1, r, pos
else: else:
rect = pos - 1, t, pos, b rect = pos - 1, t, pos, b
Qd.PenPat(Qd.qd.gray) Qd.PenPat(Qd.GetQDGlobalsGray())
Qd.PaintRect(rect) Qd.PaintRect(rect)
lastpos = pos lastpos = pos
Qd.QDFlushPortBuffer(self._parentwindow.wid, None) self._parentwindow.wid.GetWindowPort().QDFlushPortBuffer(None)
Evt.WaitNextEvent(0, 3) Evt.WaitNextEvent(0, 3)
Qd.PaintRect(rect) Qd.PaintRect(rect)
Qd.PenNormal() Qd.PenNormal()
...@@ -643,7 +643,7 @@ class ColorPicker(ClickableWidget): ...@@ -643,7 +643,7 @@ class ColorPicker(ClickableWidget):
if self._visible: if self._visible:
if not visRgn: if not visRgn:
visRgn = self._parentwindow.wid.GetWindowPort().visRgn visRgn = self._parentwindow.wid.GetWindowPort().visRgn
Qd.PenPat(Qd.qd.gray) Qd.PenPat(Qd.GetQDGlobalsGray())
rect = self._bounds rect = self._bounds
Qd.FrameRect(rect) Qd.FrameRect(rect)
rect = Qd.InsetRect(rect, 3, 3) rect = Qd.InsetRect(rect, 3, 3)
...@@ -700,7 +700,7 @@ def HasBaseClass(obj, class_): ...@@ -700,7 +700,7 @@ def HasBaseClass(obj, class_):
# data below. # data below.
#_cursors = { #_cursors = {
# "watch" : Qd.GetCursor(QuickDraw.watchCursor).data, # "watch" : Qd.GetCursor(QuickDraw.watchCursor).data,
# "arrow" : Qd.qd.arrow, # "arrow" : Qd.GetQDGlobalsArrow(),
# "iBeam" : Qd.GetCursor(QuickDraw.iBeamCursor).data, # "iBeam" : Qd.GetCursor(QuickDraw.iBeamCursor).data,
# "cross" : Qd.GetCursor(QuickDraw.crossCursor).data, # "cross" : Qd.GetCursor(QuickDraw.crossCursor).data,
# "plus" : Qd.GetCursor(QuickDraw.plusCursor).data, # "plus" : Qd.GetCursor(QuickDraw.plusCursor).data,
......
...@@ -170,7 +170,7 @@ class Button(ControlWidget): ...@@ -170,7 +170,7 @@ class Button(ControlWidget):
# emulate the pushing of the button # emulate the pushing of the button
import time import time
self._control.HiliteControl(Controls.kControlButtonPart) 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) time.sleep(0.1)
self._control.HiliteControl(0) self._control.HiliteControl(0)
if self._callback: if self._callback:
......
...@@ -2,7 +2,7 @@ import Wbase ...@@ -2,7 +2,7 @@ import Wbase
import Wkeys import Wkeys
import string import string
from Carbon import Evt, Events, Fm, Lists, Qd, Scrap, Win 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.Lists import kListDefUserProcType, lInitMsg, lDrawMsg, lHiliteMsg, lCloseMsg
from Carbon.QuickDraw import hilitetransfermode from Carbon.QuickDraw import hilitetransfermode
from Carbon import App from Carbon import App
...@@ -435,7 +435,7 @@ class TwoLineList(CustomList): ...@@ -435,7 +435,7 @@ class TwoLineList(CustomList):
def listDefDraw(self, selected, cellRect, theCell, def listDefDraw(self, selected, cellRect, theCell,
dataOffset, dataLen, theList): dataOffset, dataLen, theList):
savedPort = Qd.GetPort() savedPort = Qd.GetPort()
Qd.SetPort(GetListPort(theList)) Qd.SetPort(theList.GetListPort())
savedClip = Qd.NewRgn() savedClip = Qd.NewRgn()
Qd.GetClip(savedClip) Qd.GetClip(savedClip)
Qd.ClipRect(cellRect) Qd.ClipRect(cellRect)
...@@ -477,7 +477,7 @@ class TwoLineList(CustomList): ...@@ -477,7 +477,7 @@ class TwoLineList(CustomList):
def listDefHighlight(self, selected, cellRect, theCell, def listDefHighlight(self, selected, cellRect, theCell,
dataOffset, dataLen, theList): dataOffset, dataLen, theList):
savedPort = Qd.GetPort() savedPort = Qd.GetPort()
Qd.SetPort(GetListPort(theList)) Qd.SetPort(theList.GetListPort())
savedClip = Qd.NewRgn() savedClip = Qd.NewRgn()
Qd.GetClip(savedClip) Qd.GetClip(savedClip)
Qd.ClipRect(cellRect) Qd.ClipRect(cellRect)
......
...@@ -965,7 +965,7 @@ class PyEditor(TextEditor): ...@@ -965,7 +965,7 @@ class PyEditor(TextEditor):
if autoscroll: if autoscroll:
self.ted.WEFeatureFlag(WASTEconst.weFAutoScroll, 0) self.ted.WEFeatureFlag(WASTEconst.weFAutoScroll, 0)
self.ted.WESetSelection(count, count + 1) 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) time.sleep(0.2)
self.ted.WESetSelection(selstart, selend) self.ted.WESetSelection(selstart, selend)
if autoscroll: if autoscroll:
...@@ -1042,7 +1042,7 @@ class PyEditor(TextEditor): ...@@ -1042,7 +1042,7 @@ class PyEditor(TextEditor):
breakrect = bl, bt, br, bb = self._getbreakrect() breakrect = bl, bt, br, bb = self._getbreakrect()
br = br - 1 br = br - 1
self.SetPort() self.SetPort()
Qd.PenPat(Qd.qd.gray) Qd.PenPat(Qd.GetQDGlobalsGray())
Qd.PaintRect((br, bt, br + 1, bb)) Qd.PaintRect((br, bt, br + 1, bb))
Qd.PenNormal() Qd.PenNormal()
self._parentwindow.tempcliprect(breakrect) self._parentwindow.tempcliprect(breakrect)
...@@ -1123,7 +1123,7 @@ def GetFNum(fontname): ...@@ -1123,7 +1123,7 @@ def GetFNum(fontname):
GetFName = Fm.GetFontName GetFName = Fm.GetFontName
def GetPortFontSettings(port): 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)): def SetPortFontSettings(port, (font, face, size)):
saveport = Qd.GetPort() saveport = Qd.GetPort()
......
...@@ -270,7 +270,7 @@ class Window(FrameWork.Window, Wbase.SelectableWidget): ...@@ -270,7 +270,7 @@ class Window(FrameWork.Window, Wbase.SelectableWidget):
self._collectselectablewidgets(w._widgets) self._collectselectablewidgets(w._widgets)
def _calcbounds(self): def _calcbounds(self):
self._possize = self.wid.GetWindowPort().portRect[2:] self._possize = self.wid.GetWindowPort().GetPortBounds()[2:]
w, h = self._possize w, h = self._possize
self._bounds = (0, 0, w, h) self._bounds = (0, 0, w, h)
self.wid.GetWindowContentRgn(scratchRegion) self.wid.GetWindowContentRgn(scratchRegion)
...@@ -387,7 +387,7 @@ class Window(FrameWork.Window, Wbase.SelectableWidget): ...@@ -387,7 +387,7 @@ class Window(FrameWork.Window, Wbase.SelectableWidget):
del self.saveclip[-1] del self.saveclip[-1]
def getgrowrect(self): 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) return (r - 15, b - 15, r, b)
def has_key(self, key): def has_key(self, key):
...@@ -423,7 +423,7 @@ class Dialog(Window): ...@@ -423,7 +423,7 @@ class Dialog(Window):
return 0 return 0
def getwindowbounds(self, size, minsize = None): 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 w, h = size
l = sl + (sr - sl - w) / 2 l = sl + (sr - sl - w) / 2
t = st + (sb - st - h) / 3 t = st + (sb - st - h) / 3
...@@ -615,7 +615,7 @@ def windowbounds(preferredsize, minsize=None): ...@@ -615,7 +615,7 @@ def windowbounds(preferredsize, minsize=None):
minwidth, minheight = minsize minwidth, minheight = minsize
width, height = preferredsize 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() l, t = getnextwindowpos()
if (l + width) > sr: if (l + width) > sr:
_windowcounter = 0 _windowcounter = 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment