Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2011-10-30 22:06:13 (GMT)
committer Simon Schampijer <simon@schampijer.de>2011-10-30 22:09:57 (GMT)
commitdbe93bd0f95e9ce82d4c7d1b6e3876d409f60096 (patch)
tree7a107ed38e109423e62d300982abbb9b39827931
parentcfdcb99ea6ae4c91e8982399919288f4594cd637 (diff)
Replace "expose-event" signal by a new "draw" signal
GtkWidget "expose-event" signal has been replaced by a new "draw" signal [1]. The context is already clipped [2], so do not base it on the values returned by get_allocation like before. [1] http://developer.gnome.org/gtk3/3.0/ch25s02.html#id1467092 [2] http://developer.gnome.org/gtk3/3.0/GtkWidget.html#GtkWidget-draw
-rw-r--r--src/sugar3/graphics/alert.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/sugar3/graphics/alert.py b/src/sugar3/graphics/alert.py
index a7d57f1..c30c243 100644
--- a/src/sugar3/graphics/alert.py
+++ b/src/sugar3/graphics/alert.py
@@ -351,10 +351,9 @@ class _TimeoutIcon(Gtk.Alignment):
self._text.set_attributes(attrlist)
self.add(self._text)
self._text.show()
- self.connect("expose_event", self.__expose_cb)
+ self.connect('draw', self.__draw_cb)
- def __expose_cb(self, widget, event):
- context = widget.get_window().cairo_create()
+ def __draw_cb(self, widget, context):
self._draw(context)
return False
@@ -367,13 +366,15 @@ class _TimeoutIcon(Gtk.Alignment):
return height, height
def _draw(self, context):
- rect = self.get_allocation()
- x = rect.x + rect.width * 0.5
- y = rect.y + rect.height * 0.5
- radius = rect.width / 2
+ w = self.get_allocated_width()
+ h = self.get_allocated_height()
+ x = 0 + w * 0.5
+ y = 0 + h * 0.5
+ radius = w / 2
context.arc(x, y, radius, 0, 2 * math.pi)
widget_style = self.get_style()
- context.set_source_color(widget_style.bg[self.get_state()])
+ color = widget_style.bg[self.get_state()]
+ context.set_source_rgb(color.red, color.green, color.blue)
context.fill_preserve()
def set_text(self, text):