Example #1
0
    def set_scale(self, ctx, page_w, page_h):

        """
        Automatically sets a scale factor for the drawing.

        This will normally be called after the set_scale()
        function of a subclass has set the scale factor.
        'page_h' and 'page_w' should already have been up-scaled
        by the time this happens.

        Arguments:
        ctx -- a Pycairo context
        page_w, page_h -- height and width of the drawing area
        """

        # Upscale lines

        # Note that self.dim_line_length is used to calculate
        # the lengths of radius dimension lines. These lengths
        # can differ for individual subclasses, and so
        # self.dim_line_length should be set in the subclass's
        # own set_scale() function, but the dimension is common
        # to all Pipe subclasses, and so we upscale it here.

        self.dim_line_length /= self.scale     # pylint: disable=E1101

        # Call parent function

        DrawnComponent.set_scale(self, ctx, page_w, page_h)