Next / Previous / Contents / Shipman's homepage

30. class PageDims

An instance of this class describes a number of the dimensions of a full page layout.

fosox.py
# - - - - -   c l a s s   P a g e D i m s

class PageDims(object):
    '''Represents a page layout.

      Exports:
        PageDims(pageBox, pageMargins=None, frameMargins=None,
                bodyMargins=None):
          [ (pageBox is the paper size as a Box instance) and
            (pageMargins represents the page margins as a MarginSet
            instance, defaulting to no margins) and
            (frameMargins represents the header and footer
            heights as a MarginSet instance, defaulting to zero) and
            (bodyMargins represents the margin above and below
            the body as a MarginSet instance, defaulting to zero) ->
              return a new PageDim instance representing
              that layout ]
        .pageBox:      [ as passed to constructor ]
        .pageMargins:  [ as passed to constructor ]
        .frameMargins: [ as passed to constructor ]
        .bodyMargins:  [ as passed to constructor ]

      Invariants:
        .pageMargins, .frameMargins, and .bodyMargins always
        contain a MarginSet instance.
    '''

30.1. PageDims.__init__()

fosox.py
# - - -   P a g e D i m s . _ _ i n i t _ _

    def __init__(self, pageBox, pageMargins=None, frameMargins=None,
                 bodyMargins=None):
        '''Constructor
        '''
        self.pageBox = pageBox
        self.pageMargins = pageMargins or MarginSet()
        self.frameMargins = frameMargins or MarginSet()
        self.bodyMargins = bodyMargins or MarginSet()