Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/view.py
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@sugarlabs.org>2009-01-20 18:09:38 (GMT)
committer Tomeu Vizoso <tomeu@sugarlabs.org>2009-01-20 18:09:38 (GMT)
commita4848bf6ea047b90cbd16712b2b3cb6c9747365c (patch)
tree713f94793a4416c9bf4e26b00f9a5a20a8d09a82 /view.py
parentda678e141dd79422a799f89ef6bae4fa43a28b4b (diff)
Added background colors to the model and display them
Diffstat (limited to 'view.py')
-rw-r--r--view.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/view.py b/view.py
index 8ba64ea..c4a1a3f 100644
--- a/view.py
+++ b/view.py
@@ -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)