Add fg and bg circles, fill the paths
This commit is contained in:
@@ -8,6 +8,10 @@ class PieceItem(goocanvas.Path):
|
||||
self._angle_start = angle_start
|
||||
self._angle_end = angle_end
|
||||
|
||||
self.set_property('fill-color', '#e8e8e8')
|
||||
self.set_property('stroke-color', '#d8d8d8')
|
||||
self.set_property('line-width', 4)
|
||||
|
||||
def construct(self):
|
||||
r = self.get_parent().get_radius()
|
||||
|
||||
@@ -33,6 +37,15 @@ class DonutItem(goocanvas.Group):
|
||||
self._radius = radius
|
||||
self._angle_start = 0
|
||||
|
||||
bg = goocanvas.Ellipse(radius_x=radius, radius_y=radius,
|
||||
fill_color='#c2c3c5', line_width=0)
|
||||
self.add_child(bg)
|
||||
|
||||
fg_radius = radius / 2
|
||||
fg = goocanvas.Ellipse(radius_x=fg_radius, radius_y=fg_radius,
|
||||
fill_color='#d8d8d8', line_width=0)
|
||||
self.add_child(fg)
|
||||
|
||||
def add_piece(self, perc):
|
||||
angle_end = self._angle_start + perc * 2 * math.pi / 100
|
||||
piece_item = PieceItem(self._angle_start, angle_end)
|
||||
@@ -40,7 +53,7 @@ class DonutItem(goocanvas.Group):
|
||||
|
||||
# FIXME can't override set_parent on the
|
||||
# PieceItem and there is no signal.
|
||||
self.add_child(piece_item)
|
||||
self.add_child(piece_item, 1)
|
||||
piece_item.construct()
|
||||
|
||||
return piece_item
|
||||
|
||||
Reference in New Issue
Block a user