コード例 #1
0
 def __init__(self, editor):
     # There are 3 rectangles for marking selection, 1st line, middle lines
     # and last line.
     self.editor = editor
     view = self.editor.canvas
     self.selRect1 = BGRect(view, "selbg")
     self.selRect2 = BGRect(view, "selbg")
     self.selRect3 = BGRect(view, "selbg")
     self.mainWidth = self.editor.rsubject.db.layoutInfo.mainWidth
コード例 #2
0
    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()