def _draw_rectangle_path(self, context, width, height, only_get_extents=False):
        """Draws the rectangle path for the port

        The rectangle is correctly rotated. Height therefore refers to the border thickness and width to the length
        of the port.

        :param context: The context to draw on
        :param float width: The width of the rectangle
        :param float height: The height of the rectangle
        """
        c = context

        # Current position is the center of the rectangle
        c.save()
        if self.side is SnappedSide.LEFT or self.side is SnappedSide.RIGHT:
            c.rotate(deg2rad(90))
        c.rel_move_to(-width / 2., - height / 2.)
        c.rel_line_to(width, 0)
        c.rel_line_to(0, height)
        c.rel_line_to(-width, 0)
        c.close_path()
        c.restore()

        if only_get_extents:
            extents = c.path_extents()
            c.new_path()
            return extents
def _draw_rectangle_path ( self , context , width , height , only_get_extents = False ) : c = context c . save ( ) if self . side is SnappedSide . LEFT or self . side is SnappedSide . RIGHT : c . rotate ( deg2rad ( 90 ) ) c . rel_move_to ( - width / 2. , - height / 2. ) c . rel_line_to ( width , 0 ) c . rel_line_to ( 0 , height ) c . rel_line_to ( - width , 0 ) c . close_path ( ) c . restore ( ) if only_get_extents : extents = c . path_extents ( ) c . new_path ( ) return extents
Draws the rectangle path for the port

        The rectangle is correctly rotated. Height therefore refers to the border thickness and width to the length
        of the port.

        :param context: The context to draw on
        :param float width: The width of the rectangle
        :param float height: The height of the rectangle