~glitter-team/glitter/trunk

« back to all changes in this revision

Viewing changes to glitter/data/themes/nublo/resources/toolbar_background_texture_normal.py

bliss

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
        
22
22
        self.width = width
23
23
        self.height = height
 
24
 
 
25
        border_offset = self.height * 0.2
 
26
        line_width = self.height * 0.005
 
27
 
 
28
        if border_offset > self.width / 2.0:
 
29
            border_offset = self.width / 2.0
24
30
        
25
31
        self.context = self.cairo_create()
26
32
        
27
33
        linpat = cairo.LinearGradient(self.width / 2.0, 0.0, self.width / 2.0, self.height);
28
34
        linpat.add_color_stop_rgba (0.0, 0.0, 0.0, 0.0, 0.5);
29
 
        linpat.add_color_stop_rgba (1.0, 0.1, 0.1, 0.1, 0.5);
30
 
        
31
 
        self.context.arc(self.height * 0.2, self.height * 0.2, 
32
 
                         self.height * 0.2, math.pi, 3.0 * math.pi / 2.0)
33
 
        self.context.line_to(self.width - (self.height * 0.2), 0.0)
34
 
        self.context.arc(self.width - (self.height * 0.2),
35
 
                         self.height * 0.2, 
36
 
                         self.height * 0.2, 
 
35
        linpat.add_color_stop_rgba (1.0, 1.0, 1.0, 1.0, 0.5);
 
36
        self._draw_cornered_rect(border_offset, line_width)        
 
37
        self.context.close_path()
 
38
        self.context.set_source(linpat)
 
39
        self.context.fill()
 
40
 
 
41
        self.context.set_source_rgba(1.0, 1.0, 1.0, 1.0)
 
42
        self._draw_cornered_rect(border_offset, line_width)                 
 
43
        self.context.set_line_width(self.height*0.01);
 
44
        self.context.stroke()
 
45
        
 
46
        self.context.stroke()
 
47
        del self.context
 
48
    
 
49
    def _draw_cornered_rect(self, border_offset, line_width):
 
50
        """ Draws a cornered rectangle """
 
51
        
 
52
        self.context.arc(border_offset + line_width, 
 
53
                         border_offset + line_width, 
 
54
                         border_offset, math.pi, 3.0 * math.pi / 2.0)
 
55
        self.context.line_to(self.width - border_offset, line_width)
 
56
        self.context.arc(self.width - border_offset,
 
57
                         border_offset, 
 
58
                         border_offset - line_width, 
37
59
                         3.0 * math.pi / 2.0, 
38
60
                         0.0)
39
 
        self.context.line_to(self.width, self.height - (self.height * 0.2))
40
 
        self.context.arc(self.width - (self.height * 0.2),
41
 
                         self.height - (self.height * 0.2), 
42
 
                         self.height * 0.2, 
 
61
        self.context.line_to(self.width - line_width, self.height - border_offset)
 
62
        self.context.arc(self.width - border_offset - line_width,
 
63
                         self.height - border_offset - line_width, 
 
64
                         border_offset, 
43
65
                         0.0, 
44
66
                         math.pi / 2.0)
45
 
        self.context.line_to(self.height * 0.2, self.height)
46
 
        self.context.arc(self.height * 0.2,
47
 
                         self.height - (self.height * 0.2), 
48
 
                         self.height * 0.2, 
 
67
        self.context.line_to(border_offset + line_width, self.height - line_width)
 
68
        self.context.arc(border_offset + line_width,
 
69
                         self.height - border_offset - line_width, 
 
70
                         border_offset, 
49
71
                         math.pi / 2.0, 
50
72
                         math.pi)
51
 
        
52
 
        self.context.close_path()
53
 
        self.context.set_source(linpat)
54
 
        self.context.fill()
55
 
        
56
 
        self.context.stroke()
57
 
        del self.context
 
73
        self.context.close_path()        
58
74
          
59
75
    def resize(self, width, height):
60
76