diff options
author | Tomeu Vizoso <tomeu@sugarlabs.org> | 2009-01-20 18:09:38 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@sugarlabs.org> | 2009-01-20 18:09:38 (GMT) |
commit | a4848bf6ea047b90cbd16712b2b3cb6c9747365c (patch) | |
tree | 713f94793a4416c9bf4e26b00f9a5a20a8d09a82 /view.py | |
parent | da678e141dd79422a799f89ef6bae4fa43a28b4b (diff) |
Added background colors to the model and display them
Diffstat (limited to 'view.py')
-rw-r--r-- | view.py | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -148,11 +148,25 @@ class ThoughtView(CanvasElement): return layout def draw(self, context): + + # draw background + if self.model.color is None or not self.model.color: + color = style.Color('#FFFFFF') + else: + color = style.Color(self.model.color) + + r, g, b, a = color.get_rgba() + context.save() + context.set_source_rgb(r, g, b) + context.paint() + context.restore() + if self._dragging: context.set_source_rgb(0.8, 0.8, 0.8) else: context.set_source_rgb(0, 0, 0) + # draw text context.save() layout = self._get_name_layout(context) @@ -166,6 +180,7 @@ class ThoughtView(CanvasElement): context.show_layout(layout) context.restore() + # draw bounding box context.save() context.set_line_width(4) |