Next / Previous / Contents / Shipman's homepage

19.2. BodyLayout.__init__(): Constructor

listext2
# - - -   B o d y L a y o u t . _ _ i n i t _ _

    def __init__(self):
        '''Constructor.
        '''

First we set up the two h.PageDim instances that describe the odd-page and even-page layouts; see Section 19.1, “class BodyLayout: Constants”.

listext2
        #-- 1
        # [ self.oddDims  :=  odd-page layout described by Args()
        #   self.evenDims  :=  even-page layout described by Args()
        paperType = (h.PAPER_LETTER_LAND
                     if Args().isLandscape
                     else h.PAPER_LETTER)
        oddKey = (Args().isLandscape, False)
        evenKey = (Args().isLandscape, True)
        self.oddDims = h.pageDimFactory(paperType)
        self.oddDims.pageMargins = self.PAGE_MARGIN_MAP[oddKey]
        self.oddDims.frameMargins = self.FRAME_MARGIN_MAP[oddKey]
        self.oddDims.bodyMargins = self.FRAME_MARGIN_MAP[oddKey]
        self.evenDims = h.pageDimFactory(paperType)
        self.evenDims.pageMargins = self.PAGE_MARGIN_MAP[evenKey]
        self.evenDims.frameMargins = self.FRAME_MARGIN_MAP[evenKey]
        self.evenDims.bodyMargins = self.FRAME_MARGIN_MAP[evenKey]

Various calculations relevant to variable widths and heights are performed in Section 19.3, “BodyLayout.__findWidths(): Calculate width-related dimensions” and Section 19.4, “BodyLayout.__findHeights(): Calculate lines per column”.

listext2
        #-- 3
        # [ self.oneColWide  :=  as invariant
        #   self.oneCharWide  :=  as invariant
        #   self.charsPerCol  :=  
        #   self.charsPerOver  :=  as invariant
        #   self.indent  :=  as invariant ]
        self.__findWidths()

        #-- 4
        # [ self.linesPerCol  :=  as invariant ]
        self.__findHeights()