diff options
author | Daniel Francis <francis@sugarlabs.org> | 2012-06-29 21:25:58 (GMT) |
---|---|---|
committer | Rafael Ortiz <rafael@activitycentral.com> | 2012-06-30 04:13:22 (GMT) |
commit | 4e2df4e10931eac04393c3cc8abe99953b17dcc6 (patch) | |
tree | 2248b9dda4744b1b9e1a2e48e2f1eb325c887ea9 /mouth.py | |
parent | a8630e53fe8077e684652b240c236ccba807838d (diff) |
A lot of pep8 corrections
I'm porting Speak Activity to Gtk3, this patch is the first step.
I have these pending steps to do:
. Remove the toolkit modules and migrate the activity to sugar-toolkit
. Migrate from Hippo to Gtk
. Convert the activity to PyGI; Gtk3 Port Start
. Use gi.repository.Gst in the place of pygst
. Extra corrections; Finishing port
Signed-off-by: Daniel Francis <francis@sugarlabs.org>
Diffstat (limited to 'mouth.py')
-rw-r--r-- | mouth.py | 25 |
1 files changed, 16 insertions, 9 deletions
@@ -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 |