Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/mouth.py
diff options
context:
space:
mode:
Diffstat (limited to 'mouth.py')
-rw-r--r--mouth.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/mouth.py b/mouth.py
index a72312a..4d88feb 100644
--- a/mouth.py
+++ b/mouth.py
@@ -7,17 +7,17 @@
#
# Parts of Speak.activity are based on code from Measure.activity
# Copyright (C) 2007 Arjun Sarwal - arjun@laptop.org
-#
+#
# Speak.activity is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
-#
+#
# Speak.activity is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with Speak.activity. If not, see <http://www.gnu.org/licenses/>.
@@ -46,7 +46,8 @@ class Mouth(gtk.DrawingArea):
if len(buf) < 28:
self.newest_buffer = []
else:
- self.newest_buffer = list(unpack(str(int(len(buf)) / 2) + 'h', buf))
+ self.newest_buffer = list(unpack(str(int(len(buf)) / 2) + 'h',
+ buf))
self.main_buffers += self.newest_buffer
if(len(self.main_buffers) > self.buffer_size):
del self.main_buffers[0:(len(self.main_buffers) - \
@@ -59,10 +60,12 @@ class Mouth(gtk.DrawingArea):
if len(self.main_buffers) == 0 or len(self.newest_buffer) == 0:
self.volume = 0
else:
- self.volume = numpy.core.max(self.main_buffers) # - numpy.core.min(self.main_buffers)
+ 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."""
+ """This function is the "expose" event
+ handler and does all the drawing."""
bounds = self.get_allocation()
self.processBuffer(bounds)
@@ -71,8 +74,12 @@ class Mouth(gtk.DrawingArea):
self.context = widget.window.cairo_create()
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)
+ # 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.clip()
# background
@@ -83,7 +90,7 @@ class Mouth(gtk.DrawingArea):
# Draw the mouth
volume = self.volume / 30000.
mouthH = volume * bounds.height
- mouthW = volume**2 * (bounds.width / 2.) + bounds.width / 2.
+ mouthW = volume ** 2 * (bounds.width / 2.) + bounds.width / 2.
# T
# L R
# B