Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflavio <fdanesse@gmail.com>2012-07-19 00:05:25 (GMT)
committer flavio <fdanesse@gmail.com>2012-07-19 00:05:25 (GMT)
commitc1b905046c4bfd681a82f32d9c26cefb789aed1b (patch)
tree9a5a6a4bd990665ecace471ed02ff0cbba3e9c32
parent773832227b3309e9ba327de6a4ebb5cc42b0b367 (diff)
Cairo corrections
-rw-r--r--fft_mouth.py14
-rw-r--r--glasses.py12
-rw-r--r--mouth.py4
-rw-r--r--waveform_mouth.py12
4 files changed, 21 insertions, 21 deletions
diff --git a/fft_mouth.py b/fft_mouth.py
index 8200ef6..f91d900 100644
--- a/fft_mouth.py
+++ b/fft_mouth.py
@@ -93,7 +93,7 @@ class FFTMouth(Mouth):
self.peaks = val
- def expose(self, widget, event):
+ def do_draw(self, context):
"""This function is the "expose" event
handler and does all the drawing."""
@@ -102,15 +102,15 @@ class FFTMouth(Mouth):
self.processBuffer(bounds)
#Create context, disable antialiasing
- self.context = widget.window.cairo_create()
- self.context.set_antialias(cairo.ANTIALIAS_NONE)
+ 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
diff --git a/glasses.py b/glasses.py
index 5ac1f10..c491085 100644
--- a/glasses.py
+++ b/glasses.py
@@ -28,7 +28,7 @@ class Glasses(Eye):
def __init__(self, fill_color):
Eye.__init__(self, fill_color)
- def expose(self, widget, event):
+ def do_draw(self, context):
bounds = self.get_allocation()
eyeSize = min(bounds.width, bounds.height)
@@ -43,15 +43,15 @@ class Glasses(Eye):
pupilX = bounds.width / 2 + dX * limit / distance
pupilY = bounds.height / 2 + dY * limit / distance
- 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
diff --git a/mouth.py b/mouth.py
index 2b517bd..6ff6243 100644
--- a/mouth.py
+++ b/mouth.py
@@ -24,7 +24,7 @@
# This code is a super-stripped down version of the waveform view from Measure
from gi.repository import Gtk
-import cairo
+from gi.repository import cairo
from struct import unpack
import numpy.core
@@ -72,7 +72,7 @@ class Mouth(Gtk.DrawingArea):
#Create context, disable antialiasing
self.context = context
- self.context.set_antialias(cairo.ANTIALIAS_NONE)
+ #self.context.set_antialias(cairo.ANTIALIAS_NONE)
# set a clip region for the expose event.
# This reduces redrawing work (and time)
diff --git a/waveform_mouth.py b/waveform_mouth.py
index b9c4238..c3a4ba5 100644
--- a/waveform_mouth.py
+++ b/waveform_mouth.py
@@ -39,7 +39,7 @@ class WaveformMouth(Mouth):
self.y_mag_bias_multiplier = 1
self.y_mag = 0.7
- def expose(self, widget, event):
+ def do_draw(self, context):
"""This function is the "expose"
event handler and does all the drawing."""
@@ -48,15 +48,15 @@ class WaveformMouth(Mouth):
self.param2 = bounds.height / 2.0
#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