Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Schampijer <simon@laptop.org>2013-01-23 13:23:04 (GMT)
committer Simon Schampijer <simon@laptop.org>2013-02-01 16:30:09 (GMT)
commitf8a1f8c7a2af0405b8940b308eef5eb405deeb33 (patch)
treefe635d78c66b9293077905a7f13f49443454c8f6
parent2578d1cbb289cbe97b3c4791d8a0b57746e3561e (diff)
Replace "expose-event" signal by the new "draw" signal
GtkWidget "expose-event" signal has been replaced by a new "draw" signal [1]. [1] http://developer.gnome.org/gtk3/3.0/ch25s02.html#id1467092 Signed-off-by: Simon Schampijer <simon@schampijer.de>
-rw-r--r--face.py7
-rw-r--r--port/roundbox.py4
-rw-r--r--speak/eye.py4
-rw-r--r--speak/mouth.py6
-rw-r--r--svgcard.py13
-rw-r--r--svglabel.py7
6 files changed, 23 insertions, 18 deletions
diff --git a/face.py b/face.py
index 703a126..ffbc2a1 100644
--- a/face.py
+++ b/face.py
@@ -37,16 +37,17 @@ class Face(Gtk.EventBox):
self.show_all()
self.set_app_paintable(True)
- self.connect('expose-event', self._expose_cb)
+ self.connect('draw', self.__draw_cb)
self.connect('unrealize', self._unrealize_cb)
def _unrealize_cb(self, widget):
self.face.shut_up()
- def _expose_cb(self, widget, event):
+ def __draw_cb(self, widget, context):
card = self.parent.parent
pixbuf = card._read_icon_data('front')
- self.window.draw_pixbuf(None, pixbuf, 0, 0, 0, 0)
+ Gdk.cairo_set_source_pixbuf(context, pixbuf, 0, 0)
+ context.paint()
def look_at():
diff --git a/port/roundbox.py b/port/roundbox.py
index 8f5a184..7dd0051 100644
--- a/port/roundbox.py
+++ b/port/roundbox.py
@@ -17,7 +17,7 @@ class RoundBox(Gtk.HBox):
self.border = self._BORDER_DEFAULT
self.border_color = style.COLOR_BLACK
self.background_color = None
- self.connect("expose_event", self.__expose_cb)
+ self.connect("draw", self.__draw_cb)
self.connect("size-allocate", self.__size_allocate_cb)
self.connect("add", self.__add_cb)
@@ -30,7 +30,7 @@ class RoundBox(Gtk.HBox):
self._width = allocation.width
self._height = allocation.height
- def __expose_cb(self, widget, event):
+ def __draw_cb(self, widget, context):
cr = widget.window.cairo_create()
#cr.save()
x = self._x + self._BORDER_DEFAULT / 2
diff --git a/speak/eye.py b/speak/eye.py
index dc2349f..426c2f1 100644
--- a/speak/eye.py
+++ b/speak/eye.py
@@ -33,7 +33,7 @@ class Eye(Gtk.DrawingArea):
def __init__(self, fill_color):
Gtk.DrawingArea.__init__(self)
- self.connect("expose_event", self.expose)
+ self.connect("draw", self.__draw_cb)
self.frame = 0
self.blink = False
self.x, self.y = 0,0
@@ -110,7 +110,7 @@ class Eye(Gtk.DrawingArea):
return a.width/2 + dx, a.height/2 + dy
- def expose(self, widget, event):
+ def __draw_cb(self, widget, context):
self.frame += 1
bounds = self.get_allocation()
diff --git a/speak/mouth.py b/speak/mouth.py
index 796d6e6..cfda012 100644
--- a/speak/mouth.py
+++ b/speak/mouth.py
@@ -34,7 +34,7 @@ class Mouth(Gtk.DrawingArea):
Gtk.DrawingArea.__init__(self)
- self.connect("expose_event",self.expose)
+ self.connect("draw",self.__draw_cb)
self.buffers = []
self.buffer_size = 256
self.main_buffers = []
@@ -62,8 +62,8 @@ class Mouth(Gtk.DrawingArea):
else:
self.volume = numpy.core.max(self.main_buffers)# - numpy.core.min(self.main_buffers)
- def expose(self, widget, event):
- """This function is the "expose" event handler and does all the drawing."""
+ def __draw_cb(self, widget, context):
+ """This function is the "draw" event handler and does all the drawing."""
bounds = self.get_allocation()
self.processBuffer(bounds)
diff --git a/svgcard.py b/svgcard.py
index 06f5244..942e78f 100644
--- a/svgcard.py
+++ b/svgcard.py
@@ -96,7 +96,7 @@ class SvgCard(Gtk.EventBox):
self.draw = Gtk.DrawingArea()
self.draw.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse(bg_color))
self.draw.set_events(Gdk.EventMask.ALL_EVENTS_MASK)
- self.draw.connect('expose-event', self._expose_cb)
+ self.draw.connect('draw', self.__draw_cb)
self.draw.connect('realize', self._realize_cb)
self.draw.show_all()
@@ -110,13 +110,16 @@ class SvgCard(Gtk.EventBox):
def _realize_cb(self, widget):
self.gc = widget.window.new_gc()
- def _expose_cb(self, widget, event):
+ def __draw_cb(self, widget, context):
pixbuf = self._read_icon_data(self.current_face)
- widget.window.draw_pixbuf(None, pixbuf, 0, 0, 0, 0)
+ Gdk.cairo_set_source_pixbuf(context, pixbuf, 0, 0)
+ context.paint()
if self.show_jpeg:
- widget.window.draw_pixbuf(None, self.jpeg, 0, 0,
- theme.SVG_PAD, theme.SVG_PAD)
+ print 'draw'
+ Gdk.cairo_set_source_pixbuf(context, self.jpeg, 0, 0)
+ context.paint()
+ # FIXME theme.SVG_PAD, theme.SVG_PAD)
if self.show_text:
props = self.props[self.flipped and 'front_text' or 'back_text']
diff --git a/svglabel.py b/svglabel.py
index 9f14987..1930cd2 100644
--- a/svglabel.py
+++ b/svglabel.py
@@ -44,10 +44,11 @@ class SvgLabel(Gtk.DrawingArea):
self.pixbuf = self._read_icon_data(self.filename, self.fill_color,
self.stroke_color)
- self.connect('expose-event', self._expose_cb)
+ self.connect('draw', self.__draw_cb)
- def _expose_cb(self, widget, event):
- widget.window.draw_pixbuf(None, self.pixbuf, 0, 0, 0, 0)
+ def __draw_cb(self, widget, context):
+ Gdk.cairo_set_source_pixbuf(context, self.pixbuf, 0, 0)
+ context.paint()
return False
def _read_icon_data(self, filename, fill_color, stroke_color):