예제 #1
0
    def do_paint_below_children(self, ctx, rect):
        ctx.set_source_rgba(*color.to_rgba(self.props.color))
        ctx.rectangle(rect.x, rect.y, rect.width, rect.height)
        ctx.clip()
        rtl  = self.props.radius_top_left
        rtr  = self.props.radius_top_right
        rbl  = self.props.radius_bottom_left
        rbr  = self.props.radius_bottom_right
        x, y = 0, 0
        w, h = self.get_allocation()

        #  A****BQ
        # H      C
        # *      *
        # G      D
        #  F****E
        ctx.move_to(x+rtl,y)                      # A
        ctx.line_to(x+w-rtr,y)                    # B
        ctx.curve_to(x+w,y,x+w,y,x+w,y+rtr)       # C, both control points at Q
        ctx.line_to(x+w,y+h-rbr)                  # D
        ctx.curve_to(x+w,y+h,x+w,y+h,x+w-rbr,y+h) # E
        ctx.line_to(x+rbl,y+h)                    # F
        ctx.curve_to(x,y+h,x,y+h,x,y+h-rbl)       # G
        ctx.line_to(x,y+rtl)                      # H
        ctx.curve_to(x,y,x,y,x+rtl,y)             # A
        ctx.fill()
예제 #2
0
    def do_paint_below_children(self, ctx, rect):
        ctx.set_source_rgba(*color.to_rgba(self.props.color))
        ctx.rectangle(rect.x, rect.y, rect.width, rect.height)
        ctx.clip()
        rtl = self.props.radius_top_left
        rtr = self.props.radius_top_right
        rbl = self.props.radius_bottom_left
        rbr = self.props.radius_bottom_right
        x, y = 0, 0
        w, h = self.get_allocation()

        #  A****BQ
        # H      C
        # *      *
        # G      D
        #  F****E
        ctx.move_to(x + rtl, y)  # A
        ctx.line_to(x + w - rtr, y)  # B
        ctx.curve_to(x + w, y, x + w, y, x + w,
                     y + rtr)  # C, both control points at Q
        ctx.line_to(x + w, y + h - rbr)  # D
        ctx.curve_to(x + w, y + h, x + w, y + h, x + w - rbr, y + h)  # E
        ctx.line_to(x + rbl, y + h)  # F
        ctx.curve_to(x, y + h, x, y + h, x, y + h - rbl)  # G
        ctx.line_to(x, y + rtl)  # H
        ctx.curve_to(x, y, x, y, x + rtl, y)  # A
        ctx.fill()
예제 #3
0
    def do_paint_below_children(self, ctx, rect):
        (width, height) = self.get_allocation()

        ctx.set_source_rgba(*color.to_rgba(self.props.color))
        x,y,w,h = self.align(width, height)
        ctx.rectangle(x,y,w,h)
        ctx.clip()
        rtl  = self.props.radius_top_left
        rtr  = self.props.radius_top_right
        rbl  = self.props.radius_bottom_left
        rbr  = self.props.radius_bottom_right
#        #  A****BQ
#        # H      C
#        # *      *
#        # G      D
#        #  F****E
        ctx.move_to(x+rtl,y)                      # A
        ctx.line_to(x+w-rtr,y)                    # B
        ctx.curve_to(x+w,y,x+w,y,x+w,y+rtr)       # C, both control points at Q
        ctx.line_to(x+w,y+h-rbr)                  # D
        ctx.curve_to(x+w,y+h,x+w,y+h,x+w-rbr,y+h) # E
        ctx.line_to(x+rbl,y+h)                    # F
        ctx.curve_to(x,y+h,x,y+h,x,y+h-rbl)       # G
        ctx.line_to(x,y+rtl)                      # H
        ctx.curve_to(x,y,x,y,x+rtl,y)     
        ctx.close_path()       
        ctx.fill_preserve()
예제 #4
0
    def do_paint_above_children(self, ctx, rect):
        if not self.show_rulers:
            return
        ctx.set_source_rgba(*color.to_rgba(self.cal.colors['inactive']))
        ctx.rectangle(rect.x, rect.y, rect.width, rect.height)
        ctx.set_line_width(1)
        ctx.set_dash((1, 1))
        ctx.clip()
        w, h = self.get_allocation()

        for n in range(0, 24):
            y = n * h / 24
            ctx.move_to(0, y)
            ctx.line_to(w, y)
        ctx.stroke()
예제 #5
0
    def do_paint_above_children(self, ctx, rect):
        if not self.show_rulers:
            return
        ctx.set_source_rgba(*color.to_rgba(self.cal.colors["inactive"]))
        ctx.rectangle(rect.x, rect.y, rect.width, rect.height)
        ctx.set_line_width(1)
        ctx.set_dash((1, 1))
        ctx.clip()
        w, h = self.get_allocation()

        for n in range(0, 24):
            y = n * h / 24
            ctx.move_to(0, y)
            ctx.line_to(w, y)
        ctx.stroke()
예제 #6
0
    def draw(self, ctx, w, h):
        if ctx is None:
            return
        if not self.show_annotations:
            return

        # Draw the dashes that connect annotations to their marker.
        ctx.set_line_width(1)
        ctx.set_dash((3, 2))
        right_margin = self.get_right_margin()
        for annotation in self.anno_layout.get_children():
            mark_x, mark_y = self._get_annotation_mark_position(annotation)
            anno_x, anno_y, anno_w, anno_h, d = annotation.window.get_geometry(
            )
            path = [(mark_x, mark_y - 5), (mark_x, mark_y),
                    (w - right_margin, mark_y), (w, anno_y + anno_h / 2)]

            stroke_color = annotation.get_border_color()
            ctx.set_source_rgba(*color.to_rgba(stroke_color))
            ctx.move_to(*path[0])
            for x, y in path[1:]:
                ctx.line_to(x, y)
            ctx.stroke()
예제 #7
0
    def draw(self, ctx, w, h):
        if ctx is None:
            return
        if not self.show_annotations:
            return

        # Draw the dashes that connect annotations to their marker.
        ctx.set_line_width(1)
        ctx.set_dash((3, 2))
        right_margin = self.get_right_margin()
        for annotation in self.anno_layout.get_children():
            mark_x, mark_y = self._get_annotation_mark_position(annotation)
            anno_x, anno_y, anno_w, anno_h, d = annotation.window.get_geometry()
            path = [(mark_x,           mark_y - 5),
                    (mark_x,           mark_y),
                    (w - right_margin, mark_y),
                    (w,                anno_y + anno_h / 2)]

            stroke_color = annotation.get_border_color()
            ctx.set_source_rgba(*color.to_rgba(stroke_color))
            ctx.move_to(*path[0])
            for x, y in path[1:]:
                ctx.line_to(x, y)
            ctx.stroke()