Ejemplo n.º 1
0
 def draw(self, context, layout):
     widgetutil.circular_rect(context, 0, 0, context.width, context.height)
     gradient = widgetset.Gradient(0, 0, 0, context.height)
     gradient.set_start_color(self.BACKGROUND_GRADIENT_TOP)
     gradient.set_end_color(self.BACKGROUND_GRADIENT_BOTTOM)
     context.gradient_fill(gradient)
     progress_width = (
         (context.width - context.height) * self.progress_ratio +
         context.height)
     widgetutil.circular_rect_negative(context, 1, 1, progress_width - 2,
                                       context.height - 2)
     gradient = widgetset.Gradient(1, 1, 1, context.height - 2)
     gradient.set_start_color(self.PROGRESS_GRADIENT_TOP)
     gradient.set_end_color(self.PROGRESS_GRADIENT_BOTTOM)
     context.gradient_fill(gradient)
Ejemplo n.º 2
0
 def _draw_border(self, context):
     # Set the clipping region to be the on the border of the progress bar.
     # This is a little tricky.  We have to make a path around the outside
     # of the border that goes in one direction, then a path that is inset
     # by 1 px going the other direction.  This causes the clip region to
     # be the 1 px area between the 2 paths.
     context.save()
     self._outer_border(context)
     self._inner_border(context)
     context.clip()
     # Render the borders
     self._progress_top_rectangle(context)
     context.set_color(self.color_set.PROGRESS_BORDER_TOP)
     context.fill()
     self._progress_bottom_rectangle(context)
     context.set_color(self.color_set.PROGRESS_BORDER_BOTTOM)
     context.fill()
     self._non_progress_rectangle(context)
     gradient = widgetset.Gradient(self.x + self.progress_width, self.y,
                                   self.x + self.progress_width,
                                   self.y + self.height)
     gradient.set_start_color(self.color_set.BORDER_GRADIENT_TOP)
     gradient.set_end_color(self.color_set.BORDER_GRADIENT_BOTTOM)
     context.gradient_fill(gradient)
     # Restore the old clipping region
     context.restore()
     self._draw_progress_highlight(context)
     self._draw_progress_right(context)
Ejemplo n.º 3
0
 def draw(self, context, layout):
     gradient = widgetset.Gradient(0, 0, 0, context.height - 1)
     gradient.set_start_color(widgetutil.css_to_color('#a92928'))
     gradient.set_end_color(widgetutil.css_to_color('#7e1c1b'))
     context.rectangle(0, 0, context.width, context.height - 1)
     context.gradient_fill(gradient)
     context.rectangle(0, context.height - 1, context.width, context.height)
     context.set_color((0, 0, 0))
     context.fill()
Ejemplo n.º 4
0
 def draw(self, context, layout):
     context.set_line_width(1)
     context.set_color(widgetutil.css_to_color('#d8d8d8'))
     context.move_to(0, 0.5)
     context.line_to(context.width, 0.5)
     context.stroke()
     gradient = widgetset.Gradient(0, 1, 0, context.height)
     gradient.set_start_color(widgetutil.css_to_color('#f7f7f7'))
     gradient.set_end_color(widgetutil.css_to_color('#cacaca'))
     context.rectangle(0, 1, context.width, context.height)
     context.gradient_fill(gradient)
Ejemplo n.º 5
0
    def draw(self, context, layout_manager):
        gradient = widgetset.Gradient(0, 2, 0, context.height)
        gradient.set_start_color(widgetutil.css_to_color('#d4d4d4'))
        gradient.set_end_color(widgetutil.css_to_color('#a8a8a8'))
        context.rectangle(0, 2, context.width, context.height)
        context.gradient_fill(gradient)

        context.set_line_width(1)
        context.move_to(0, 0.5)
        context.line_to(context.width, 0.5)
        context.set_color(widgetutil.css_to_color('#585858'))
        context.stroke()
        context.move_to(0, 1.5)
        context.line_to(context.width, 1.5)
        context.set_color(widgetutil.css_to_color('#e6e6e6'))
        context.stroke()
Ejemplo n.º 6
0
 def draw(self, context, layout):
     context.set_line_width(1)
     context.move_to(0, 0.5)
     context.line_to(context.width, 0.5)
     context.set_color(self.TOP_BORDER)
     context.stroke()
     gradient = widgetset.Gradient(0, 1, context.width, context.height - 2)
     gradient.set_start_color(self.TOP_GRADIENT)
     gradient.set_end_color(self.BOTTOM_GRADIENT)
     context.rectangle(0, 1, context.width, context.height - 2)
     context.gradient_fill(gradient)
     context.move_to(0, context.height - 1.5)
     context.line_to(context.width, context.height - 1.5)
     context.set_color(self.BOTTOM_BORDER1)
     context.stroke()
     context.move_to(0, context.height - 0.5)
     context.line_to(context.width, context.height - 0.5)
     context.set_color(self.BOTTOM_BORDER2)
     context.stroke()
Ejemplo n.º 7
0
 def draw(self, context, layout):
     gradient = widgetset.Gradient(0, 0, 0, context.height)
     gradient.set_start_color(widgetutil.css_to_color('#c2c2c2'))
     gradient.set_end_color(widgetutil.css_to_color('#a3a3a3'))
     context.rectangle(0, 0, context.width, context.height)
     context.gradient_fill(gradient)