def init(self, rsubject): """Set up the editor for a new report. rsubject: A RSubject object for the current report. """ self.rsubject = rsubject if self.edCursor: self.edCursor.stop() # Set the viewing area (x-margin, y-margin, width) self.mainWidth = self.rsubject.db.layoutInfo.mainWidth self.canvas.initArea(20, 10, self.mainWidth) # Special background for overflow text self.ovflRect = BGRect(self.canvas, "ovflbg", under=True) # Render the frames frames = self.rsubject.frames y = 0.0 for f in frames[:-1]: # Separator line HLine(self.canvas, y, self.mainWidth) f.render(self.canvas, self.rsubject, y) y += f.maxHeight # The overflow frame: HLine(self.canvas, y, self.mainWidth) f = frames[-1] yo = 0.0 ol = self.rsubject.getFrameLines(f) if ol: lastline = ol[-1] # vertical space needed by the frame text: yo = lastline.y + lastline.height f.getHeight(yo) f.render(self.canvas, self.rsubject, y) self.setSize(y, f.height) self.edCursor = EdCursor(self) self.selection = Selection(self) self.initCurSel()