Thanks, please read my reply to your review mail <a href="http://lists.sugarlabs.org/archive/sugar-devel/2012-January/035292.html">http://lists.sugarlabs.org/archive/sugar-devel/2012-January/035292.html</a><br>More below...<br>
<br><div class="gmail_quote">On Wed, Jan 18, 2012 at 5:05 AM, Simon Schampijer <span dir="ltr"><<a href="mailto:simon@schampijer.de">simon@schampijer.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 17/01/12 22:49, <a href="mailto:godiard@sugarlabs.org" target="_blank">godiard@sugarlabs.org</a> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
From: Gonzalo Odiard<<a href="mailto:godiard@gmail.com" target="_blank">godiard@gmail.com</a>><br>
<br>
Added controls to pause/stop and addressed suggestions<br>
in the review process.<br>
</blockquote>
<br></div>
Thanks for the update!<br>
<br>
- one thing that is not solved yet, is the item that gets created in the clipboard tray<br>
<br></blockquote><div><br>I think is a Write problem, no clue at the moment.<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
- when I do not have text selected I can still click on the 'play' icon<br>
<br></blockquote><div><br>Yes. But does not harm, and I think will overcomplicate.<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
- sometimes the button inactive part is out of sync (the stop button is not inactive even though I am not playing back). Maybe if it is too complicated to get it right we can make them always available and find other means of indicating when something is played back, not sure yet how/if, just a random thought.<br>
</blockquote><div><br>Did you paused the spoken text? The stop button is disabled when all the text was played. Should work ok and I have tested it.<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<br>
- nitpick: for the copyright, I think it should be either your or OLPC, I think OLPC is the one to pick in this case, and welcome to 2012 :)<br>
<br></blockquote><div><br>Ok, I was confused about how do it. About the year... started the last year :)<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

Regards,<br>
   Simon<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br>
  data/<a href="http://sugar.schemas.in" target="_blank">sugar.schemas.in</a>             |   28 ++++<br>
  extensions/deviceicon/<u></u>Makefile.am |    1 +<br>
  extensions/deviceicon/speech.<u></u>py   |  204 ++++++++++++++++++++++++++++<br>
  extensions/globalkey/Makefile.<u></u>am  |    1 +<br>
  extensions/globalkey/speech.py    |   24 ++++<br>
  src/jarabe/model/Makefile.am      |    1 +<br>
  src/jarabe/model/speech.py        |  266 ++++++++++++++++++++++++++++++<u></u>+++++++<br>
  src/jarabe/view/keyhandler.py     |   29 +----<br>
  8 files changed, 526 insertions(+), 28 deletions(-)<br>
  create mode 100644 extensions/deviceicon/speech.<u></u>py<br>
  create mode 100644 extensions/globalkey/speech.py<br>
  create mode 100644 src/jarabe/model/speech.py<br>
<br>
diff --git a/data/<a href="http://sugar.schemas.in" target="_blank">sugar.schemas.in</a> b/data/<a href="http://sugar.schemas.in" target="_blank">sugar.schemas.in</a><br>
index 8b3e1ad..66d3391 100644<br>
--- a/data/<a href="http://sugar.schemas.in" target="_blank">sugar.schemas.in</a><br>
+++ b/data/<a href="http://sugar.schemas.in" target="_blank">sugar.schemas.in</a><br>
@@ -368,5 +368,33 @@<br>
        </locale><br>
      </schema><br>
<br>
+<schema><br>
+<key>/schemas/desktop/sugar/<u></u>speech/pitch</key><br>
+<applyto>/desktop/sugar/<u></u>speech/pitch</applyto><br>
+<owner>sugar</owner><br>
+<type>int</type><br>
+<default>50</default><br>
+<locale name="C"><br>
+<short>Default pitch to the speech sugar service</short><br>
+<long>Pitch value used by the speech service in Sugar,<br>
+        can be changed by the user, with controls in a icon<br>
+        in the frame</long><br>
+</locale><br>
+</schema><br>
+<br>
+<schema><br>
+<key>/schemas/desktop/sugar/<u></u>speech/rate</key><br>
+<applyto>/desktop/sugar/<u></u>speech/rate</applyto><br>
+<owner>sugar</owner><br>
+<type>int</type><br>
+<default>170</default><br>
+<locale name="C"><br>
+<short>Default rate to the speech sugar service</short><br>
+<long>Rate value used by the speech service in Sugar,<br>
+        can be changed by the user, with controls in a icon<br>
+        in the frame</long><br>
+</locale><br>
+</schema><br>
+<br>
    </schemalist><br>
  </gconfschemafile><br>
diff --git a/extensions/deviceicon/<u></u>Makefile.am b/extensions/deviceicon/<u></u>Makefile.am<br>
index 118d866..7ed1f77 100644<br>
--- a/extensions/deviceicon/<u></u>Makefile.am<br>
+++ b/extensions/deviceicon/<u></u>Makefile.am<br>
@@ -5,5 +5,6 @@ sugar_PYTHON =          \<br>
        battery.py      \<br>
        network.py      \<br>
        speaker.py      \<br>
+       speech.py       \<br>
        touchpad.py     \<br>
        volume.py<br>
diff --git a/extensions/deviceicon/<u></u>speech.py b/extensions/deviceicon/<u></u>speech.py<br>
new file mode 100644<br>
index 0000000..4528e98<br>
--- /dev/null<br>
+++ b/extensions/deviceicon/<u></u>speech.py<br>
@@ -0,0 +1,204 @@<br>
+# Copyright (C) 2011 One Laptop Per Child<br>
+# Copyright (C) 2011 Gonzalo Odiard<br>
+#<br>
+# This program is free software; you can redistribute it and/or modify<br>
+# it under the terms of the GNU General Public License as published by<br>
+# the Free Software Foundation; either version 2 of the License, or<br>
+# (at your option) any later version.<br>
+#<br>
+# This program is distributed in the hope that it will be useful,<br>
+# but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>
+# GNU General Public License for more details.<br>
+#<br>
+# You should have received a copy of the GNU General Public License<br>
+# along with this program; if not, write to the Free Software<br>
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA<br>
+<br>
+from gettext import gettext as _<br>
+import gconf<br>
+<br>
+import glib<br>
+import gtk<br>
+<br>
+from sugar.graphics.icon import Icon<br>
+from sugar.graphics.menuitem import MenuItem<br>
+from sugar.graphics.tray import TrayIcon<br>
+from sugar.graphics.palette import Palette<br>
+from sugar.graphics.xocolor import XoColor<br>
+from sugar.graphics.toolbutton import ToolButton<br>
+<br>
+from jarabe.frame.frameinvoker import FrameWidgetInvoker<br>
+from jarabe.model import speech<br>
+<br>
+<br>
+_ICON_NAME = 'microphone'<br>
+<br>
+<br>
+class SpeechDeviceView(TrayIcon):<br>
+<br>
+    FRAME_POSITION_RELATIVE = 105<br>
+<br>
+    def __init__(self):<br>
+        client = gconf.client_get_default()<br>
+        self._color = XoColor(client.get_string('/<u></u>desktop/sugar/user/color'))<br>
+<br>
+        TrayIcon.__init__(self, icon_name=_ICON_NAME, xo_color=self._color)<br>
+<br>
+        self.set_palette_invoker(<u></u>FrameWidgetInvoker(self))<br>
+<br>
+        self._manager = speech.get_speech_manager()<br>
+<br>
+        self.connect('expose-event', self.__expose_event_cb)<br>
+<br>
+        self._icon_widget.connect('<u></u>button-release-event',<br>
+                                  self.__button_release_event_<u></u>cb)<br>
+<br>
+    def create_palette(self):<br>
+        label = glib.markup_escape_text(_('<u></u>Speech'))<br>
+        palette = SpeechPalette(label, manager=self._manager)<br>
+        palette.set_group_id('frame')<br>
+        return palette<br>
+<br>
+    def __button_release_event_cb(<u></u>self, widget, event):<br>
+        if event.button != 1:<br>
+            return False<br>
+<br>
+        self.palette_invoker.notify_<u></u>right_click()<br>
+        return True<br>
+<br>
+    def __expose_event_cb(self, *args):<br>
+        self._update_info()<br>
+<br>
+<br>
+class SpeechPalette(Palette):<br>
+<br>
+    def __init__(self, primary_text, manager):<br>
+        Palette.__init__(self, label=primary_text)<br>
+<br>
+<br>
+<br>
+        self._manager = manager<br>
+        self._manager.connect('play', self._set_buttons_state, 'play')<br>
+        self._manager.connect('stop', self._set_buttons_state, 'stop')<br>
+        self._manager.connect('pause', self._set_buttons_state, 'pause')<br>
+<br>
+        vbox = gtk.VBox()<br>
+        self.set_content(vbox)<br>
+<br>
+        """<br>
+        self._play_item = MenuItem('Say selected text')<br>
+        self._play_icon = Icon(icon_name='player_play',<br>
+                icon_size=gtk.ICON_SIZE_MENU)<br>
+        self._pause_icon = Icon(icon_name='player_pause',<br>
+                icon_size=gtk.ICON_SIZE_MENU)<br>
+        self._play_item.set_image(<u></u>self._play_icon)<br>
+        self.menu.append(self._play_<u></u>item)<br>
+        self._play_item.show()<br>
+        self._play_item.connect('<u></u>activate', self.__play_clicked_cb)<br>
+<br>
+        self._stop_item = MenuItem('Stop talking')<br>
+        self._stop_icon = Icon(icon_name='player_stop',<br>
+                icon_size=gtk.ICON_SIZE_MENU)<br>
+        self._stop_item.set_image(<u></u>self._stop_icon)<br>
+        self.menu.append(self._stop_<u></u>item)<br>
+        self._stop_item.show()<br>
+        self._stop_item.connect('<u></u>activate', self.__stop_clicked_cb)<br>
+        self._stop_item.set_sensitive(<u></u>False)<br>
+        """<br>
+        hbox_play_pause = gtk.HBox()<br>
+        self._play_pause_button = ToolButton(icon_name='player_<u></u>play')<br>
+        self._play_pause_button.<u></u>connect('clicked', self.__play_clicked_cb)<br>
+        hbox_play_pause.pack_start(<u></u>self._play_pause_button)<br>
+        self._stop_button = ToolButton(icon_name='player_<u></u>stop')<br>
+        self._stop_button.connect('<u></u>clicked', self.__stop_clicked_cb)<br>
+        self._stop_button.set_<u></u>sensitive(False)<br>
+        hbox_play_pause.pack_start(<u></u>self._stop_button)<br>
+        hbox_play_pause.pack_start(<u></u>gtk.Label(_('Say selected text')))<br>
+        vbox.add(hbox_play_pause)<br>
+<br>
+        vbox.add(gtk.HSeparator())<br>
+<br>
+        pitch_step = 10<br>
+        self._adj_pitch = gtk.Adjustment(value=self._<u></u>manager.get_pitch(),<br>
+                                          lower=self._manager.MIN_PITCH,<br>
+                                          upper=self._manager.MAX_PITCH,<br>
+                                          step_incr=pitch_step,<br>
+                                          page_incr=pitch_step,<br>
+                                          page_size=pitch_step)<br>
+        self._hscale_pitch = gtk.HScale(self._adj_pitch)<br>
+        self._hscale_pitch.set_digits(<u></u>0)<br>
+        self._hscale_pitch.set_draw_<u></u>value(False)<br>
+<br>
+        hbox_pitch = gtk.HBox()<br>
+        hbox_pitch.pack_start(gtk.<u></u>Label(_('Pitch')))<br>
+        hbox_pitch.pack_start(self._<u></u>hscale_pitch)<br>
+        vbox.add(hbox_pitch)<br>
+<br>
+        rate_step = 10<br>
+        self._adj_rate = gtk.Adjustment(value=self._<u></u>manager.get_rate(),<br>
+                                          lower=self._manager.MIN_RATE,<br>
+                                          upper=self._manager.MAX_RATE,<br>
+                                          step_incr=rate_step,<br>
+                                          page_incr=rate_step,<br>
+                                          page_size=rate_step)<br>
+        self._hscale_rate = gtk.HScale(self._adj_rate)<br>
+        self._hscale_rate.set_digits(<u></u>0)<br>
+        self._hscale_rate.set_draw_<u></u>value(False)<br>
+<br>
+        hbox_rate = gtk.HBox()<br>
+        hbox_rate.pack_start(gtk.<u></u>Label(_('Rate')))<br>
+        hbox_rate.pack_start(self._<u></u>hscale_rate)<br>
+        vbox.add(hbox_rate)<br>
+        vbox.show_all()<br>
+<br>
+        self._adj_pitch.connect('<u></u>value_changed', self.__adj_pitch_changed_cb)<br>
+        self._adj_rate.connect('value_<u></u>changed', self.__adj_rate_changed_cb)<br>
+<br>
+    def __adj_pitch_changed_cb(self, adjustement):<br>
+        self._manager.set_pitch(int(<u></u>adjustement.value))<br>
+<br>
+    def __adj_rate_changed_cb(self, adjustement):<br>
+        self._manager.set_rate(int(<u></u>adjustement.value))<br>
+<br>
+    def __play_clicked_cb(self, widget):<br>
+        if self._manager.is_paused:<br>
+            self._manager.restart()<br>
+        else:<br>
+            if not self._manager.is_playing:<br>
+                self._manager.say_selected_<u></u>text()<br>
+            else:<br>
+                self._manager.pause()<br>
+<br>
+    def __stop_clicked_cb(self, widget):<br>
+        self._manager.stop()<br>
+<br>
+    def _set_buttons_state(self, manager, signal):<br>
+        if signal == 'play':<br>
+            """<br>
+            self._play_item.set_image(<u></u>self._pause_icon)<br>
+            self._play_item.set_label('<u></u>Pause talking selected text')<br>
+            self._stop_item.set_sensitive(<u></u>True)<br>
+            """<br>
+            self._play_pause_button.set_<u></u>icon('player_pause')<br>
+            self._stop_button.set_<u></u>sensitive(True)<br>
+<br>
+        elif signal == 'pause':<br>
+            """<br>
+            self._play_item.set_image(<u></u>self._play_icon)<br>
+            self._play_item.set_label('Say selected text')<br>
+            self._stop_item.set_sensitive(<u></u>True)<br>
+            """<br>
+            self._play_pause_button.set_<u></u>icon('player_play')<br>
+            self._stop_button.set_<u></u>sensitive(True)<br>
+<br>
+        elif signal == 'stop':<br>
+            """<br>
+            self._play_item.set_image(<u></u>self._play_icon)<br>
+            self._stop_item.set_sensitive(<u></u>False)<br>
+            """<br>
+            self._play_pause_button.set_<u></u>icon('player_play')<br>
+            self._stop_button.set_<u></u>sensitive(False)<br>
+<br>
+def setup(tray):<br>
+    tray.add_device(<u></u>SpeechDeviceView())<br>
diff --git a/extensions/globalkey/<u></u>Makefile.am b/extensions/globalkey/<u></u>Makefile.am<br>
index 69afac2..b6cbbd6 100644<br>
--- a/extensions/globalkey/<u></u>Makefile.am<br>
+++ b/extensions/globalkey/<u></u>Makefile.am<br>
@@ -3,4 +3,5 @@ sugardir = $(pkgdatadir)/extensions/<u></u>globalkey<br>
  sugar_PYTHON =                \<br>
        __init__.py     \<br>
        screenshot.py   \<br>
+       speech.py       \<br>
        viewsource.py<br>
diff --git a/extensions/globalkey/speech.<u></u>py b/extensions/globalkey/speech.<u></u>py<br>
new file mode 100644<br>
index 0000000..1e7ea66<br>
--- /dev/null<br>
+++ b/extensions/globalkey/speech.<u></u>py<br>
@@ -0,0 +1,24 @@<br>
+# Copyright (C) 2011 One Laptop Per Child<br>
+# Copyright (C) 2011 Gonzalo Odiard<br>
+#<br>
+# This program is free software; you can redistribute it and/or modify<br>
+# it under the terms of the GNU General Public License as published by<br>
+# the Free Software Foundation; either version 2 of the License, or<br>
+# (at your option) any later version.<br>
+#<br>
+# This program is distributed in the hope that it will be useful,<br>
+# but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>
+# GNU General Public License for more details.<br>
+#<br>
+# You should have received a copy of the GNU General Public License<br>
+# along with this program; if not, write to the Free Software<br>
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA<br>
+<br>
+from jarabe.model import speech<br>
+<br>
+BOUND_KEYS = ['<alt>s']<br>
+<br>
+<br>
+def handle_key_press(key):<br>
+    speech.get_speech_manager().<u></u>say_selected_text()<br>
diff --git a/src/jarabe/model/Makefile.am b/src/jarabe/model/Makefile.am<br>
index 92e8712..2fc6b1c 100644<br>
--- a/src/jarabe/model/Makefile.am<br>
+++ b/src/jarabe/model/Makefile.am<br>
@@ -16,4 +16,5 @@ sugar_PYTHON =                        \<br>
        screen.py               \<br>
          session.py            \<br>
        sound.py                \<br>
+       speech.py               \<br>
        telepathyclient.py<br>
diff --git a/src/jarabe/model/speech.py b/src/jarabe/model/speech.py<br>
new file mode 100644<br>
index 0000000..6330b0f<br>
--- /dev/null<br>
+++ b/src/jarabe/model/speech.py<br>
@@ -0,0 +1,266 @@<br>
+# Copyright (C) 2011 One Laptop Per Child<br>
+# Copyright (C) 2011 Gonzalo Odiard<br>
+#<br>
+# This program is free software; you can redistribute it and/or modify<br>
+# it under the terms of the GNU General Public License as published by<br>
+# the Free Software Foundation; either version 2 of the License, or<br>
+# (at your option) any later version.<br>
+#<br>
+# This program is distributed in the hope that it will be useful,<br>
+# but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>
+# GNU General Public License for more details.<br>
+#<br>
+# You should have received a copy of the GNU General Public License<br>
+# along with this program; if not, write to the Free Software<br>
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA<br>
+<br>
+import gconf<br>
+<br>
+import gst<br>
+import gtk<br>
+import gobject<br>
+<br>
+import os<br>
+from gettext import gettext as _<br>
+import logging<br>
+<br>
+# TRANS: The language pitch (range [0 - 99], default 50 for English)<br>
+# Look at <a href="http://espeak.sourceforge.net/commands.html" target="_blank">http://espeak.sourceforge.net/<u></u>commands.html</a> for details<br>
+DEFAULT_PITCH = int(_('50'))<br>
+<br>
+<br>
+# TRANS: The diction speed, in average words per minute (range [80 - 390],<br>
+# default 170 for English).<br>
+# Look at <a href="http://espeak.sourceforge.net/commands.html" target="_blank">http://espeak.sourceforge.net/<u></u>commands.html</a> for details<br>
+DEFAULT_RATE = int(_('170'))<br>
+<br>
+_speech_manager = None<br>
+<br>
+<br>
+class SpeechManager(gobject.GObject)<u></u>:<br>
+<br>
+    __gtype_name__ = 'SpeechManager'<br>
+<br>
+    __gsignals__ = {<br>
+        'play': (gobject.SIGNAL_RUN_FIRST, None, []),<br>
+        'pause': (gobject.SIGNAL_RUN_FIRST, None, []),<br>
+        'stop': (gobject.SIGNAL_RUN_FIRST, None, [])<br>
+    }<br>
+<br>
+    MIN_PITCH = 0<br>
+    MAX_PITCH = 99<br>
+<br>
+    MIN_RATE = 80<br>
+    MAX_RATE = 390<br>
+<br>
+    def __init__(self, **kwargs):<br>
+        gobject.GObject.__init__(self, **kwargs)<br>
+        self._player = AudioGrabGst()<br>
+        self._player.connect('play', self._emit_signal, 'play')<br>
+        self._player.connect('stop', self._emit_signal, 'stop')<br>
+        self._player.connect('pause', self._emit_signal, 'pause')<br>
+        logging.debug('SpeechManager setting default parameters')<br>
+        self._voice_name = self._player.get_default_<u></u>voice()<br>
+        self._pitch = DEFAULT_PITCH<br>
+        self._rate = DEFAULT_RATE<br>
+        self._is_playing = False<br>
+        self._is_paused = False<br>
+<br>
+        try:<br>
+            self._loading = True<br>
+            self.restore()<br>
+            self._loading = False<br>
+        except:<br>
+            pass<br>
+<br>
+    def _emit_signal(self, player, signal):<br>
+        self._is_playing = (signal == 'play')<br>
+        self._is_paused = (signal == 'pause')<br>
+        self.emit(signal)<br>
+<br>
+    def get_is_playing(self):<br>
+        return self._is_playing<br>
+<br>
+    is_playing = gobject.property(type=bool, getter=get_is_playing,<br>
+            setter=None, default=False)<br>
+<br>
+    def get_is_paused(self):<br>
+        return self._is_paused<br>
+<br>
+    is_paused = gobject.property(type=bool, getter=get_is_paused,<br>
+            setter=None, default=False)<br>
+<br>
+    def get_pitch(self):<br>
+        return self._pitch<br>
+<br>
+    def get_rate(self):<br>
+        return self._rate<br>
+<br>
+    def set_pitch(self, pitch):<br>
+        self._pitch = pitch<br>
+        if not self._loading:<br>
+            self.save()<br>
+<br>
+    def set_rate(self, rate):<br>
+        self._rate = rate<br>
+        if not self._loading:<br>
+            self.save()<br>
+<br>
+    def say_text(self, text):<br>
+        if text:<br>
+            self._player.speak(self._<u></u>pitch, self._rate, self._voice_name, text)<br>
+<br>
+    def say_selected_text(self):<br>
+        clipboard = gtk.clipboard_get(selection='<u></u>PRIMARY')<br>
+        clipboard.request_text(self._<u></u>primary_selection_cb)<br>
+<br>
+    def pause(self):<br>
+        self._player.pause_sound_<u></u>device()<br>
+<br>
+    def restart(self):<br>
+        self._player.restart_sound_<u></u>device()<br>
+<br>
+    def stop(self):<br>
+        self._player.stop_sound_<u></u>device()<br>
+<br>
+    def _primary_selection_cb(self, clipboard, text, user_data):<br>
+        logging.debug('SpeechManager._<u></u>primary_selection_cb: %r', text)<br>
+        self.say_text(text)<br>
+<br>
+    def save(self):<br>
+        client = gconf.client_get_default()<br>
+        client.set_int('/desktop/<u></u>sugar/speech/pitch', self.get_pitch())<br>
+        client.set_int('/desktop/<u></u>sugar/speech/rate',<br>
+                self.get_rate())<br>
+        logging.debug('saving speech configuration pitch %s rate %s' %<br>
+                (self._pitch, self._rate))<br>
+<br>
+    def restore(self):<br>
+        client = gconf.client_get_default()<br>
+        self.set_pitch(client.get_int(<u></u>'/desktop/sugar/speech/pitch')<u></u>)<br>
+        self.set_rate(client.get_int('<u></u>/desktop/sugar/speech/rate'))<br>
+        logging.debug('loading speech configuration pitch %s rate %s' %<br>
+                (self._pitch, self._rate))<br>
+<br>
+<br>
+class AudioGrabGst(gobject.GObject):<br>
+<br>
+    __gsignals__ = {<br>
+        'play': (gobject.SIGNAL_RUN_FIRST, None, []),<br>
+        'pause': (gobject.SIGNAL_RUN_FIRST, None, []),<br>
+        'stop': (gobject.SIGNAL_RUN_FIRST, None, [])<br>
+    }<br>
+<br>
+    def __init__(self):<br>
+        gobject.GObject.__init__(self)<br>
+        self._pipeline = None<br>
+        self._quiet = True<br>
+<br>
+    def restart_sound_device(self):<br>
+        if self._pipeline is None:<br>
+            return<br>
+<br>
+        self._quiet = False<br>
+        self._pipeline.set_state(gst.<u></u>STATE_PLAYING)<br>
+        self.emit('play')<br>
+<br>
+    def pause_sound_device(self):<br>
+        if self._pipeline is None:<br>
+            return<br>
+<br>
+        self._pipeline.set_state(gst.<u></u>STATE_PAUSED)<br>
+        self.emit('pause')<br>
+        self._quiet = True<br>
+<br>
+    def stop_sound_device(self):<br>
+        if self._pipeline is None:<br>
+            return<br>
+<br>
+        self._pipeline.set_state(gst.<u></u>STATE_NULL)<br>
+        self.emit('stop')<br>
+<br>
+        self._quiet = True<br>
+<br>
+    def make_pipeline(self, cmd):<br>
+        if self._pipeline is not None:<br>
+            self.stop_sound_device()<br>
+            del self._pipeline<br>
+<br>
+        self._pipeline = gst.parse_launch(cmd)<br>
+<br>
+        bus = self._pipeline.get_bus()<br>
+        bus.add_signal_watch()<br>
+        bus.connect('message::element'<u></u>, self.__pipe_message_cb)<br>
+<br>
+    def __pipe_message_cb(self, bus, message):<br>
+        logging.error('Gst message %s' % message)<br>
+        if message.structure.get_name() == 'espeak-mark' and \<br>
+                message.structure['mark'] == 'end':<br>
+            self.emit('stop')<br>
+<br>
+    def speak(self, pitch, rate, voice_name, text):<br>
+        # XXX workaround for <a href="http://bugs.sugarlabs.org/ticket/1801" target="_blank">http://bugs.sugarlabs.org/<u></u>ticket/1801</a><br>
+        if not [i for i in text if i.isalnum()]:<br>
+            return<br>
+        text = text + '<mark name="end>"></mark>'<br>
+<br>
+        self.make_pipeline('espeak name=espeak ! autoaudiosink')<br>
+        src = self._pipeline.get_by_name('<u></u>espeak')<br>
+<br>
+        logging.debug('pitch=%d rate=%d voice=%s text=%s' % (pitch, rate,<br>
+                voice_name, text))<br>
+<br>
+        src.props.text = text<br>
+        src.props.pitch = pitch<br>
+        src.props.rate = rate<br>
+        src.props.voice = voice_name<br>
+        src.props.track = 2  # track for marks<br>
+<br>
+        self.restart_sound_device()<br>
+<br>
+    def get_all_voices(self):<br>
+        all_voices = {}<br>
+        for i in gst.element_factory_make('<u></u>espeak').props.voices:<br>
+            name, language, dialect = i<br>
+            #if name in ('en-rhotic','english_rp','<u></u>english_wmids'):<br>
+                # these voices don't produce sound<br>
+             #   continue<br>
+            all_voices[language] = name<br>
+        return all_voices<br>
+<br>
+    def get_default_voice(self):<br>
+        """Try to figure out the default voice, from the current locale ($LANG)<br>
+           Fall back to espeak's voice called Default."""<br>
+        voices = self.get_all_voices()<br>
+<br>
+        try:<br>
+            lang = os.environ['LANG']<br>
+            if lang.find('.')>  --1:<br>
+                lang = lang[0:lang.find('.')]<br>
+                lang = lang.replace('_', '-').lower()<br>
+        except:<br>
+            lang = ""<br>
+<br>
+        best = "default"<br>
+<br>
+        try:<br>
+            best = voices[lang]<br>
+        except:<br>
+            try:<br>
+                lang = lang[0:lang.find('-')]<br>
+                best = voices[lang]<br>
+            except:<br>
+                pass<br>
+<br>
+        logging.debug('Best voice for LANG %s seems to be %s' %<br>
+                (lang, best))<br>
+        return best<br>
+<br>
+<br>
+def get_speech_manager():<br>
+    global _speech_manager<br>
+<br>
+    if _speech_manager == None:<br>
+        _speech_manager = SpeechManager()<br>
+    return _speech_manager<br>
diff --git a/src/jarabe/view/keyhandler.<u></u>py b/src/jarabe/view/keyhandler.<u></u>py<br>
index d79bfe6..a71f260 100644<br>
--- a/src/jarabe/view/keyhandler.<u></u>py<br>
+++ b/src/jarabe/view/keyhandler.<u></u>py<br>
@@ -60,13 +60,9 @@ _actions_table = {<br>
      '<alt><shift>f': 'frame',<br>
      '<alt><shift>q': 'quit_emulator',<br>
      'XF86Search': 'open_search',<br>
-    '<alt><shift>o': 'open_search',<br>
-    '<alt><shift>s': 'say_text',<br>
+    '<alt><shift>o': 'open_search'<br>
  }<br>
<br>
-SPEECH_DBUS_SERVICE = 'org.laptop.Speech'<br>
-SPEECH_DBUS_PATH = '/org/laptop/Speech'<br>
-SPEECH_DBUS_INTERFACE = 'org.laptop.Speech'<br>
<br>
  _instance = None<br>
<br>
@@ -77,7 +73,6 @@ class KeyHandler(object):<br>
          self._key_pressed = None<br>
          self._keycode_pressed = 0<br>
          self._keystate_pressed = 0<br>
-        self._speech_proxy = None<br>
<br>
          self._key_grabber = KeyGrabber()<br>
          self._key_grabber.connect('<u></u>key-pressed',<br>
@@ -114,28 +109,6 @@ class KeyHandler(object):<br>
          sound.set_volume(volume)<br>
          sound.set_muted(volume == 0)<br>
<br>
-    def _get_speech_proxy(self):<br>
-        if self._speech_proxy is None:<br>
-            bus = dbus.SessionBus()<br>
-            speech_obj = bus.get_object(SPEECH_DBUS_<u></u>SERVICE, SPEECH_DBUS_PATH,<br>
-                                        follow_name_owner_changes=<u></u>True)<br>
-            self._speech_proxy = dbus.Interface(speech_obj,<br>
-                                                SPEECH_DBUS_INTERFACE)<br>
-        return self._speech_proxy<br>
-<br>
-    def _on_speech_err(self, ex):<br>
-        logging.error('An error occurred with the ESpeak service: %r', ex)<br>
-<br>
-    def _primary_selection_cb(self, clipboard, text, user_data):<br>
-        logging.debug('KeyHandler._<u></u>primary_selection_cb: %r', text)<br>
-        if text:<br>
-            self._get_speech_proxy().<u></u>SayText(text, reply_handler=lambda: None,<br>
-                error_handler=self._on_speech_<u></u>err)<br>
-<br>
-    def handle_say_text(self, event_time):<br>
-        clipboard = gtk.clipboard_get(selection='<u></u>PRIMARY')<br>
-        clipboard.request_text(self._<u></u>primary_selection_cb)<br>
-<br>
      def handle_previous_window(self, event_time):<br>
          self._tabbing_handler.<u></u>previous_activity(event_time)<br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br>