1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 from box import EventBox
24 from draw import draw_line
25 import gobject
26 import gtk
27
29 '''
30 Statusbar.
31
32 @undocumented: expose_status_separator
33 '''
34
35 - def __init__(self,
36 height,
37 add_separator=False):
38 '''
39 Initialize Statusbar class.
40
41 @param height: Statusbar height.
42 @param add_separator: Whether add separator between statusbar and window body, default is False.
43 '''
44
45 EventBox.__init__(self)
46 self.set_size_request(-1, height)
47
48
49 self.status_box = gtk.VBox()
50 self.add(self.status_box)
51
52
53 if add_separator:
54 self.separator = gtk.HBox()
55 self.separator.set_size_request(-1, 2)
56 self.separator.connect("expose-event", self.expose_status_separator)
57 self.status_box.pack_start(self.separator, False, False)
58
59
60 self.status_item_box = gtk.HBox()
61 self.status_box.pack_start(self.status_item_box, True, True)
62
63
64 self.show_all()
65
67 '''
68 Internal callback for `expose-event` signal.
69 '''
70
71 cr = widget.window.cairo_create()
72 rect = widget.allocation
73
74
75 cr.set_source_rgba(0, 0, 0, 0.5)
76 draw_line(cr, rect.x + 1, rect.y + 1, rect.x + rect.width - 1, rect.y + 1)
77
78 cr.set_source_rgba(1, 1, 1, 0.5)
79 draw_line(cr, rect.x + 1, rect.y + 2, rect.x + rect.width - 1, rect.y + 2)
80
81 return True
82
83 gobject.type_register(Statusbar)
84