def do_paint_background(self, cr, damaged_box): [width, height] = self.get_allocation() x = self._BORDER_DEFAULT / 2 y = self._BORDER_DEFAULT / 2 width -= self._BORDER_DEFAULT height -= self._BORDER_DEFAULT cr.move_to(x + self._radius, y) cr.arc(x + width - self._radius, y + self._radius, self._radius, math.pi * 1.5, math.pi * 2) cr.arc(x + width - self._radius, x + height - self._radius, self._radius, 0, math.pi * 0.5) cr.arc(x + self._radius, y + height - self._radius, self._radius, math.pi * 0.5, math.pi) cr.arc(x + self._radius, y + self._radius, self._radius, math.pi, math.pi * 1.5) hippo.cairo_set_source_rgba32(cr, self.props.background_color) cr.fill_preserve() # TODO: we should be more consistent here with the border properties. if self.props.border_color: hippo.cairo_set_source_rgba32(cr, self.props.border_color) cr.set_line_width(self.props.border_top) cr.stroke()
def do_paint_background(self, cr, damaged_box): [width, height] = self.get_allocation() xval = width * 0.5 yval = height * 0.5 radius = min(width * 0.5, height * 0.5) hippo.cairo_set_source_rgba32(cr, self.props.background_color) cr.arc(xval, yval, radius, 0, 2*math.pi) cr.fill_preserve()
def do_paint_above_children(self, cr, damaged_box): if not self._hovering: return width, height = self.get_allocation() x = ActivityIcon._BORDER_WIDTH / 2.0 y = ActivityIcon._BORDER_WIDTH / 2.0 width -= ActivityIcon._BORDER_WIDTH height -= ActivityIcon._BORDER_WIDTH radius = width / 10.0 cr.move_to(x + radius, y) cr.arc(x + width - radius, y + radius, radius, math.pi * 1.5, math.pi * 2.0) cr.arc(x + width - radius, x + height - radius, radius, 0, math.pi * 0.5) cr.arc(x + radius, y + height - radius, radius, math.pi * 0.5, math.pi) cr.arc(x + radius, y + radius, radius, math.pi, math.pi * 1.5) color = style.COLOR_SELECTION_GREY.get_int() hippo.cairo_set_source_rgba32(cr, color) cr.set_line_width(ActivityIcon._BORDER_WIDTH) cr.stroke()