diff options
author | Agustin Zubiaga <aguz@sugarlabs.org> | 2012-02-23 19:23:25 (GMT) |
---|---|---|
committer | Agustin Zubiaga <aguz@sugarlabs.org> | 2012-02-23 19:23:25 (GMT) |
commit | 7714b7ba0520803994cd042e82c4cc20f7576e91 (patch) | |
tree | e01598413a6774422ccc788bc6b7177d19d89a3b /activity.py | |
parent | 38ff55a56ef9aa9ff6bc64633dad6ca94bb2b106 (diff) |
Paint the chart in the center
Diffstat (limited to 'activity.py')
-rw-r--r-- | activity.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/activity.py b/activity.py index d422b89..303e98f 100644 --- a/activity.py +++ b/activity.py @@ -118,7 +118,15 @@ class ChartArea(gtk.DrawingArea): context.fill() # Paint the chart: - context.set_source_surface(self._parent.current_chart.surface) + cw = self._parent.current_chart.width + ch = self._parent.current_chart.height + + x, y, w, h = self.get_allocation() + + cx = x + w / 2 - cw / 2 + cy = y + h / 2 - ch / 2 + + context.set_source_surface(self._parent.current_chart.surface, cx, cy) context.paint() |