Пример #1
0
    def setMargins(self):
        """Override setMargins() specially for diary pages."""
        PostscriptPage.setMargins(self)
        di = self.di
        self.pTop_diary = di.pageHeight - di.tMargin
        self.pHeight_diary = self.pTop_diary - self.pBottom
        self.ptop_diary = 0
        self.pheight_diary = 0

        if di.layout == "week-to-opening":
            self.dheight = self.pHeight_diary/4.0
        elif di.layout == "week-to-page" or di.layout == "week-with-notes":
            self.dheight = self.pHeight_diary/7.0
        elif di.layout == "day-to-page":
            self.dheight = self.pHeight_diary * 0.9
            self.bottomcalheight = self.pHeight_diary - self.dheight
        elif di.layout == "work":
            self.dheight = self.pHeight_diary * 0.45
            self.bottomcalheight = self.pHeight_diary - self.dheight * 2.0
            self.weekendDheight = self.dheight / 2.0
        else:
            self.dheight = self.pHeight_diary/2.0
        self.dwidth = self.pWidth

        # In here, "app" is short for appointment.
        if di.appointments:
            self.appProportion = self.di.appointmentWidth /100.0 # Proportion of page width
            self.appLeft = self.dwidth * (1.0 - self.appProportion)
            self.appRight = self.dwidth
            self.appWidth = self.appRight - self.appLeft
            self.dwidthLines = self.appLeft - 0.2*di.lineSpacing
        else:
            self.dwidthLines = self.pWidth

        # These are the settings that have the most effect on the layout of a day.
        if di.layout == "week-to-opening" or di.layout == "week-to-page":
            # Smaller boxes when we cram a week into one or two pages
            self.titleboxsize = di.lineSpacing * 1.2
        else:
            self.titleboxsize = di.lineSpacing * 1.4
        self.titleboxy = self.dheight - self.titleboxsize
        self.titlefontsize = self.titleboxsize * 0.63
        self.titlefonty = self.dheight - self.titleboxsize * 0.7
        if self.di.dayTitleBoxes:
            # If we're printing boxes around the title, move the title text in slightly so it's
            # inside the box.
            self.titlefontgap = self.titlefontsize * 0.5
        else:
            # No boxes, so put the title text at the edge.
            self.titlefontgap = 0
        self.subtitlefontsize = self.titleboxsize * 0.35

        # Number of writing lines
        self.nlines = int(self.titleboxy / di.lineSpacing)
Пример #2
0
    def setMargins(self):
        """Override setMargins() specially for diary pages."""
        PostscriptPage.setMargins(self)
        di = self.di
        self.pTop_diary = di.pageHeight - di.tMargin
        self.pHeight_diary = self.pTop_diary - self.pBottom
        self.ptop_diary = 0
        self.pheight_diary = 0

        if di.layout == "week-to-opening":
            self.dheight = self.pHeight_diary / 4.0
        elif di.layout == "week-to-page" or di.layout == "week-with-notes":
            self.dheight = self.pHeight_diary / 7.0
        elif di.layout == "day-to-page":
            self.dheight = self.pHeight_diary * 0.9
            self.bottomcalheight = self.pHeight_diary - self.dheight
        elif di.layout == "work":
            self.dheight = self.pHeight_diary * 0.45
            self.bottomcalheight = self.pHeight_diary - self.dheight * 2.0
            self.weekendDheight = self.dheight / 2.0
        else:
            self.dheight = self.pHeight_diary / 2.0
        self.dwidth = self.pWidth

        # In here, "app" is short for appointment.
        if di.appointments:
            self.appProportion = self.di.appointmentWidth / 100.0  # Proportion of page width
            self.appLeft = self.dwidth * (1.0 - self.appProportion)
            self.appRight = self.dwidth
            self.appWidth = self.appRight - self.appLeft
            self.dwidthLines = self.appLeft - 0.2 * di.lineSpacing
        else:
            self.dwidthLines = self.pWidth

        # These are the settings that have the most effect on the layout of a day.
        if di.layout == "week-to-opening" or di.layout == "week-to-page":
            # Smaller boxes when we cram a week into one or two pages
            self.titleboxsize = di.lineSpacing * 1.2
        else:
            self.titleboxsize = di.lineSpacing * 1.4
        self.titleboxy = self.dheight - self.titleboxsize
        self.titlefontsize = self.titleboxsize * 0.63
        self.titlefonty = self.dheight - self.titleboxsize * 0.7
        if self.di.dayTitleBoxes:
            # If we're printing boxes around the title, move the title text in slightly so it's
            # inside the box.
            self.titlefontgap = self.titlefontsize * 0.5
        else:
            # No boxes, so put the title text at the edge.
            self.titlefontgap = 0
        self.subtitlefontsize = self.titleboxsize * 0.35

        # Number of writing lines
        self.nlines = int(self.titleboxy / di.lineSpacing)