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()
"""browsepict - Display all "PICT" resources found"""