def do_paint(self):

        # Draw a rectangle for the clipping
        cogl.path_round_rectangle(0, 0, self._width, self._height, self._arc,
                                  self._step)
        cogl.path_close()
        # Start the clip
        cogl.clip_push_from_path()

        # set color to border color
        cogl.set_source_color(self._border_color)
        # draw the rectangle for the border which is the same size and the
        # object
        cogl.path_round_rectangle(0, 0, self._width, self._height, self._arc,
                                  self._step)
        cogl.path_close()
        # color the path usign the border color
        ##cogl.path_fill()
        #cogl.path_stroke()

        if True:  #False:
            # set the color of the filled area
            cogl.set_source_color(self._color)
            # draw the content with is the same size minus the wirth of the border
            # finish the clip
            cogl.path_round_rectangle(self._border_width, self._border_width,
                                      self._width - self._border_width,
                                      self._height - self._border_width,
                                      self._arc, self._step)
            cogl.path_fill()
        cogl.path_close()

        cogl.clip_pop()
Esempio n. 2
0
    def __paint_triangle(self, width, height, color):
        cogl.path_move_to(width / 2, 0)
        cogl.path_line_to(width, height)
        cogl.path_line_to(0, height)
        cogl.path_line_to(width / 2, 0)
        cogl.path_close()

        cogl.set_source_color(color)
        cogl.path_fill()
Esempio n. 3
0
    def __paint_triangle (self, width, height, color):
        cogl.path_move_to(width / 2, 0)
        cogl.path_line_to(width, height)
        cogl.path_line_to(0, height)
        cogl.path_line_to(width / 2, 0)
        cogl.path_close()

        cogl.set_source_color(color)
        cogl.path_fill()
Esempio n. 4
0
    def __paint_triangle (self, color):
        cogl.push_matrix()
        cogl.set_source_color(color)

        width, height = self.get_geometry()[2:]

        # Paint a triangle
        cogl.path_polygon(0, 0, 0, height, width, height)
        cogl.path_fill()
        cogl.pop_matrix()
Esempio n. 5
0
    def __paint_triangle(self, color):
        cogl.push_matrix()
        cogl.set_source_color(color)

        width, height = self.get_geometry()[2:]

        # Paint a triangle
        cogl.path_polygon(0, 0, 0, height, width, height)
        cogl.path_fill()
        cogl.pop_matrix()
Esempio n. 6
0
	def do_paint(self):
		(x1,y1,x2,y2) = self.get_allocation_box()
		width=x2-x1
		height=y2-y1
		cogl.path_move_to(width / 2,0)
		cogl.path_line_to(width, height)
		cogl.path_line_to(0,height)
		cogl.path_line_to(width / 2, 0)
		cogl.path_close()
		cogl.set_source_color(self._color)
		cogl.path_fill()
Esempio n. 7
0
    def do_paint(self):
        """paint signal handler."""
        w, h = self.get_size()
        color = self.trace.color
        dark_color = color.darken()

        cogl.set_source_color(dark_color)
        cogl.path_round_rectangle(0, 0, w, h, 5, 10)
        cogl.path_fill()

        cogl.set_source_color(color)
        cogl.path_round_rectangle(3, 3, w - 3, h - 3, 3, 10)
        cogl.path_fill()
        clutter.Group.do_paint(self)
Esempio n. 8
0
    def do_paint(self):
        """paint signal handler."""
        w, h = self.get_size()
        color = self.trace.color
        dark_color = color.darken()

        cogl.set_source_color(dark_color)
        cogl.path_round_rectangle(0, 0, w, h, 5, 10)
        cogl.path_fill()

        cogl.set_source_color(color)
        cogl.path_round_rectangle(3, 3, w - 3, h - 3, 3, 10)
        cogl.path_fill()
        clutter.Group.do_paint(self)
 def pick_self(self, color):
     if self.should_pick_paint() == False:
         return
     cogl.path_round_rectangle(0, 0, self._width, self._height, self._arc, self._step)
     cogl.path_close()
     # Start the clip
     cogl.clip_push_from_path()
     # set color to border color
     cogl.set_source_color(color)
     # draw the rectangle for the border which is the same size and the
     # object
     cogl.path_round_rectangle(0, 0, self._width, self._height, self._arc, self._step)
     cogl.path_close()
     cogl.path_fill() 
     cogl.clip_pop()
Esempio n. 10
0
    def do_paint(self):
        x = numpy.arange(-400, 400)
        y = 20 * numpy.sin(x * 0.1)

        # Plot trace, setting down lines wherever both x and y are finite
        # (neither NaN, nor infinity, nor minus infinity)
        pendown = False
        for x, y in zip(x, y):
            if numpy.isfinite(x) and numpy.isfinite(y):
                if pendown:
                    cogl.path_line_to(x, -y)
                else:
                    cogl.path_move_to(x, -y)
                    pendown = True
            else:
                pendown = False
        cogl.set_source_color(self.color)
        cogl.path_stroke()
Esempio n. 11
0
    def do_paint(self):
        x = numpy.arange(-400, 400)
        y = 20 * numpy.sin(x * 0.1)

        # Plot trace, setting down lines wherever both x and y are finite
        # (neither NaN, nor infinity, nor minus infinity)
        pendown = False
        for x, y in zip(x, y):
            if numpy.isfinite(x) and numpy.isfinite(y):
                if pendown:
                    cogl.path_line_to(x, -y)
                else:
                    cogl.path_move_to(x, -y)
                    pendown = True
            else:
                pendown = False
        cogl.set_source_color(self.color)
        cogl.path_stroke()
Esempio n. 12
0
    def do_paint(self):
        """paint signal handler."""
        w = self.get_width()
        h = self.get_height()
        half_w = 0.5 * w
        half_h = 0.5 * h
        half_major = self.MAJOR_PIXELS / 2
        tenth_major = self.MAJOR_PIXELS / 10

        # Fill background.
        cogl.set_source_color(self.BACKGROUND_COLOR)
        cogl.rectangle(-half_w, -half_h, half_w, half_h)

        # Create paths for vertical gridlines.
        x0 = int((-half_w // self.MAJOR_PIXELS) * self.MAJOR_PIXELS)
        for x in xrange(x0, int(math.ceil(half_w)), self.MAJOR_PIXELS):
            halfway = x + half_major
            vline(x, -half_h, half_h)
            vline(halfway, -8, 0)
            for xx in xrange(x + tenth_major, halfway, tenth_major):
                vline(xx, -4, 0)
            for xx in xrange(halfway + tenth_major, x + self.MAJOR_PIXELS,
                             tenth_major):
                vline(xx, -4, 0)

        # Create paths for horizontal gridlines.
        y0 = int((-half_h // self.MAJOR_PIXELS) * self.MAJOR_PIXELS)
        for y in xrange(y0, int(math.ceil(half_h)), self.MAJOR_PIXELS):
            halfway = y + half_major
            hline(y, -half_w, half_w)
            hline(halfway, 0, 8)
            for yy in xrange(y + tenth_major, halfway, tenth_major):
                hline(yy, 0, 4)
            for yy in xrange(halfway + tenth_major, y + self.MAJOR_PIXELS,
                             tenth_major):
                hline(yy, 0, 4)

        # Stroke gridlines.
        cogl.set_source_color(self.GRIDLINE_COLOR)
        cogl.path_stroke()

        # Chain up to parent.
        clutter.Group.do_paint(self)
Esempio n. 13
0
    def do_pick(self, color):
        if self.should_pick_paint() == False:
            return

        #return
        cogl.path_round_rectangle(0, 0, self._width, self._height, self._arc,
                                  self._step)
        cogl.path_close()
        # Start the clip
        cogl.clip_push_from_path()
        # set color to border color
        cogl.set_source_color(color)
        # draw the rectangle for the border which is the same size and the
        # object
        cogl.path_round_rectangle(0, 0, self._width, self._height, self._arc,
                                  self._step)
        cogl.path_close()
        cogl.path_fill()
        cogl.clip_pop()
Esempio n. 14
0
    def do_paint(self):
        """paint signal handler."""
        w = self.get_width()
        h = self.get_height()
        half_w = 0.5 * w
        half_h = 0.5 * h
        half_major = self.MAJOR_PIXELS / 2
        tenth_major = self.MAJOR_PIXELS / 10

        # Fill background.
        cogl.set_source_color(self.BACKGROUND_COLOR)
        cogl.rectangle(-half_w, -half_h, half_w, half_h)

        # Create paths for vertical gridlines.
        x0 = int((-half_w // self.MAJOR_PIXELS) * self.MAJOR_PIXELS)
        for x in xrange(x0, int(math.ceil(half_w)), self.MAJOR_PIXELS):
            halfway = x + half_major
            vline(x, -half_h, half_h)
            vline(halfway, -8, 0)
            for xx in xrange(x + tenth_major, halfway, tenth_major):
                vline(xx, -4, 0)
            for xx in xrange(halfway + tenth_major, x + self.MAJOR_PIXELS, tenth_major):
                vline(xx, -4, 0)

                # Create paths for horizontal gridlines.
        y0 = int((-half_h // self.MAJOR_PIXELS) * self.MAJOR_PIXELS)
        for y in xrange(y0, int(math.ceil(half_h)), self.MAJOR_PIXELS):
            halfway = y + half_major
            hline(y, -half_w, half_w)
            hline(halfway, 0, 8)
            for yy in xrange(y + tenth_major, halfway, tenth_major):
                hline(yy, 0, 4)
            for yy in xrange(halfway + tenth_major, y + self.MAJOR_PIXELS, tenth_major):
                hline(yy, 0, 4)

                # Stroke gridlines.
        cogl.set_source_color(self.GRIDLINE_COLOR)
        cogl.path_stroke()

        # Chain up to parent.
        clutter.Group.do_paint(self)