Example #1
0
File: caw.py Project: Roger/caw
    def _update_background(self, *_):
        #print "updating background"
        conn = self.connection
        rp = self._root_pixmap()
        if rp is not None:
            conn.core.CopyArea(rp,
                self.back_pixmap,
                self._gc,
                self.x, self.y,
                0,0,
                self.width, self.height)

        self.set_source(self._back_cairo_c, self.bg, self.shading, self.height)
        cawc.cairo_set_line_width(self._back_cairo_c, 4)
        cawc.cairo_rectangle(self._back_cairo_c, 0, 0, self.width, self.height);
        cawc.cairo_fill(self._back_cairo_c)

        i = 0
        r,g,b = self.rgb(self.border)
        cawc.cairo_set_line_width(self._back_cairo_c, 1.0)
        cawc.cairo_set_source_rgba(self._back_cairo_c, r, g, b, 1.0)
        while i < self.border_width:
            cawc.cairo_rectangle(self._back_cairo_c, i, i, self.width-2*i-1, self.height-2*i-1);
            cawc.cairo_stroke(self._back_cairo_c)
            i+=1
Example #2
0
File: caw.py Project: Roger/caw
    def draw_rectangle(self, x, y, w, h, color=None, shading=None, line_width=1):
        if color is not None:
            if shading is None:
                shading = self.shading
            self.set_source(self.cairo_c, color, shading, h)


        cawc.cairo_set_line_width(self.cairo_c, line_width)
        cawc.cairo_rectangle(self.cairo_c, x, y, w, h)
        cawc.cairo_stroke(self.cairo_c)