def open(self, path, name, data): self.path = path self.name = name r = windowbounds(400, 400) w = Win.NewWindow(r, name, 1, 0, -1, 1, 0) self.wid = w x0, y0, x1, y1 = self.wid.GetWindowPort().GetPortBounds() x0 = x0 + 4 y0 = y0 + 4 x1 = x1 - 20 y1 = y1 - 20 vr = dr = x0, y0, x1, y1 ##vr = 4, 0, r[2]-r[0]-15, r[3]-r[1]-15 ##dr = (0, 0, vr[2], 0) Qd.SetPort(w) Qd.TextFont(4) Qd.TextSize(9) self.ted = TE.TENew(dr, vr) self.ted.TEAutoView(1) self.ted.TESetText(data) w.DrawGrowIcon() self.scrollbars() self.changed = 0 self.do_postopen() self.do_activate(1, None)
def open(self, path, name, data): self.path = path self.name = name r = windowbounds(400, 400) w = Win.NewWindow(r, name, 1, 0, -1, 1, 0) self.wid = w flags = MacTextEditor.kTXNDrawGrowIconMask|MacTextEditor.kTXNWantHScrollBarMask| \ MacTextEditor.kTXNWantVScrollBarMask self.ted, self.frameid = Mlte.TXNNewObject( None, w, None, flags, MacTextEditor.kTXNTextEditStyleFrameType, MacTextEditor.kTXNTextFile, MacTextEditor.kTXNMacOSEncoding) self.ted.TXNSetData(MacTextEditor.kTXNTextData, data, 0, 0x7fffffff) self.changed = 0 self.do_postopen() self.do_activate(1, None)
class ICONwindow(FrameWork.Window): def open(self, (resid, resname)): if not resname: resname = '#'+`resid` self.resid = resid self.picture = Icn.GetIcon(self.resid) l, t, r, b = 0, 0, 32, 32 self.pictrect = (l, t, r, b) width = r-l height = b-t if width < MINWIDTH: width = MINWIDTH elif width > MAXWIDTH: width = MAXWIDTH if height < MINHEIGHT: height = MINHEIGHT elif height > MAXHEIGHT: height = MAXHEIGHT bounds = (LEFT, TOP, LEFT+width, TOP+height) self.wid = Win.NewWindow(bounds, resname, 1, 0, -1, 1, 0) self.do_postopen()
class PICTwindow(FrameWork.Window): def open(self, (resid, resname)): if not resname: resname = '#%r' % (resid, ) self.resid = resid self.picture = Qd.GetPicture(self.resid) # Get rect for picture sz, t, l, b, r = struct.unpack('hhhhh', self.picture.data[:10]) self.pictrect = (l, t, r, b) width = r - l height = b - t if width < MINWIDTH: width = MINWIDTH elif width > MAXWIDTH: width = MAXWIDTH if height < MINHEIGHT: height = MINHEIGHT elif height > MAXHEIGHT: height = MAXHEIGHT bounds = (LEFT, TOP, LEFT + width, TOP + height) self.wid = Win.NewWindow(bounds, resname, 1, 0, -1, 1, 0) self.do_postopen()
class PICTwindow(FrameWork.Window): def open(self, (resid, resname)): if not resname: resname = '#%r' % (resid, ) self.resid = resid picture = Qd.GetPicture(self.resid) # Get rect for picture print repr(picture.data[:16]) sz, t, l, b, r = struct.unpack('hhhhh', picture.data[:10]) print 'pict:', t, l, b, r width = r - l height = b - t if width < 64: width = 64 elif width > 480: width = 480 if height < 64: height = 64 elif height > 320: height = 320 bounds = (LEFT, TOP, LEFT + width, TOP + height) print 'bounds:', bounds self.wid = Win.NewWindow(bounds, resname, 1, 0, -1, 1, 0) self.wid.SetWindowPic(picture) self.do_postopen()
def open(self, path, name, data): self.path = path self.name = name r = windowbounds(400, 400) w = Win.NewWindow(r, name, 1, 0, -1, 1, 0) self.wid = w vr = 0, 0, r[2] - r[0] - 15, r[3] - r[1] - 15 dr = (0, 0, 10240, 0) Qd.SetPort(w) Qd.TextFont(4) Qd.TextSize(9) flags = WASTEconst.weDoAutoScroll | WASTEconst.weDoOutlineHilite | \ WASTEconst.weDoMonoStyled | WASTEconst.weDoUndo self.ted = waste.WENew(dr, vr, flags) self.tedtexthandle = Res.Resource(data) self.ted.WEUseText(self.tedtexthandle) self.ted.WECalText() w.DrawGrowIcon() self.scrollbars() self.changed = 0 self.do_postopen() self.do_activate(1, None)
def open(self, path, name, data): self.path = path self.name = name r = windowbounds(400, 400) w = Win.NewWindow(r, name, 1, 0, -1, 1, 0) self.wid = w vr = LEFTMARGIN, 0, r[2] - r[0] - 15, r[3] - r[1] - 15 dr = (0, 0, vr[2], 0) Qd.SetPort(w) Qd.TextFont(4) Qd.TextSize(9) flags = WASTEconst.weDoAutoScroll | WASTEconst.weDoOutlineHilite | \ WASTEconst.weDoMonoStyled | WASTEconst.weDoUndo self.ted = waste.WENew(dr, vr, flags) self.ted.WEInstallTabHooks() style, soup = self.getstylesoup(self.path) self.ted.WEInsert(data, style, soup) self.ted.WESetSelection(0, 0) self.ted.WECalText() self.ted.WEResetModCount() w.DrawGrowIcon() self.scrollbars() self.do_postopen() self.do_activate(1, None)
"""browsepict - Display all "cicn" resources found"""
# A minimal text editor.
"""browsepict - Display all "PICT" resources found"""
# A minimal text editor using MLTE. Based on wed.py.
# Test List module.