2
# -*- coding: utf-8 -*-
5
# a redefinition of senses
7
__authors__ = ["Jan Jokela <janjokela@gmail.com>"]
8
__licenses__ = ["LICENSE.LGPL"]
9
__description__ = "Slider unfilled area texture"
14
from cluttercairo import CairoTexture
16
class Texture(CairoTexture):
17
""" A CairoTexture for the unfilled area of a slider """
19
def __init__(self, width, height):
21
CairoTexture.__init__(self, width, height)
26
self.context = self.cairo_create()
28
#self.context.set_line_width(self.height * 0.01)
29
#self.context.set_source_rgba(1.0, 1.0, 1.0, 1.0)
30
#self.context.rectangle(0.0, 0.0, self.width, self.height)
32
linpat = cairo.LinearGradient(self.width / 2.0, 0.0, self.width / 2.0, self.height);
34
linpat.add_color_stop_rgba (0.0, 0.5, 0.5, 0.5, 1.0);
35
linpat.add_color_stop_rgba (0.1, 0.7, 0.7, 0.7, 1.0);
36
linpat.add_color_stop_rgba (0.1, 0.2, 0.2, 0.2, 1.0);
37
linpat.add_color_stop_rgba (0.45, 0.4, 0.4, 0.4, 1.0);
38
linpat.add_color_stop_rgba (0.45, 0.4, 0.4, 0.4, 1.0);
39
linpat.add_color_stop_rgba (0.55, 0.5, 0.5, 0.5, 1.0);
40
linpat.add_color_stop_rgba (0.55, 0.5, 0.5, 0.5, 1.0);
41
linpat.add_color_stop_rgba (1.0, 0.7, 0.7, 0.7, 1.0);
43
self.context.arc(self.height * 0.5, self.height * 0.5,
44
self.height * 0.5, math.pi, 3.0 * math.pi / 2.0)
45
self.context.line_to(self.width - (self.height * 0.5), 0.0)
46
self.context.arc(self.width - (self.height * 0.5),
51
self.context.line_to(self.width, self.height - (self.height * 0.5))
52
self.context.arc(self.width - (self.height * 0.5),
53
self.height - (self.height * 0.5),
57
self.context.line_to(self.height * 0.5, self.height)
58
self.context.arc(self.height * 0.5,
59
self.height - (self.height * 0.5),
64
self.context.close_path()
65
#self.context.set_source_rgba(0.0, 1.0, 0.0, 1.0)
66
self.context.set_source(linpat)