From 973dc1a85c8b770c8e365457546c6fe816f58aa8 Mon Sep 17 00:00:00 2001 From: flavio Date: Wed, 18 Jul 2012 01:12:14 +0000 Subject: The activity starts --- (limited to 'mouth.py') diff --git a/mouth.py b/mouth.py index 631189f..2b517bd 100644 --- a/mouth.py +++ b/mouth.py @@ -32,8 +32,8 @@ import numpy.core class Mouth(Gtk.DrawingArea): def __init__(self, audioSource, fill_color): - GObject.GObject.__init__(self) - self.connect("expose_event", self.expose) + Gtk.DrawingArea.__init__(self) + self.buffers = [] self.buffer_size = 256 self.main_buffers = [] @@ -63,7 +63,7 @@ class Mouth(Gtk.DrawingArea): self.volume = numpy.core.max(self.main_buffers) # -\ # numpy.core.min(self.main_buffers) - def expose(self, widget, event): + def do_draw(self, context): """This function is the "expose" event handler and does all the drawing.""" bounds = self.get_allocation() @@ -71,15 +71,15 @@ class Mouth(Gtk.DrawingArea): self.processBuffer(bounds) #Create context, disable antialiasing - self.context = widget.window.cairo_create() + self.context = context self.context.set_antialias(cairo.ANTIALIAS_NONE) # set a clip region for the expose event. # This reduces redrawing work (and time) - self.context.rectangle(event.area.x, - event.area.y, - event.area.width, - event.area.height) + self.context.rectangle(bounds.x, + bounds.y, + bounds.width, + bounds.height) self.context.clip() # background -- cgit v0.9.1