Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/speech_gst.py
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2012-03-07 16:15:47 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2012-03-07 16:15:47 (GMT)
commitaaad25feac3830ffee561078daac93fe71e1d998 (patch)
tree215376be8c021a15745381cd74a1529c7a930acb /speech_gst.py
parent15cc1ddd9a3def8f8245d25fa6595bf8b507d83b (diff)
Add a stop button to the speech toolbar
This is needed to restart reading from the start of the page. Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'speech_gst.py')
-rw-r--r--speech_gst.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/speech_gst.py b/speech_gst.py
index 73e1710..0b3a5b7 100644
--- a/speech_gst.py
+++ b/speech_gst.py
@@ -25,6 +25,7 @@ _logger = logging.getLogger('read-etexts-activity')
def _message_cb(bus, message, pipe):
+ logging.error('gstreamer message %s', message)
if message is None:
return
if message.type == Gst.Message.EOS:
@@ -34,7 +35,10 @@ def _message_cb(bus, message, pipe):
if message.type == Gst.Message.ERROR:
pipe.set_state(Gst.State.NULL)
if pipe is play_speaker[1]:
- speech.reset_cb()
+ if speech.reset_cb is not None:
+ speech.reset_cb()
+ if speech.reset_buttons_cb is not None:
+ speech.reset_buttons_cb()
elif message.type == Gst.Message.ELEMENT and \
message.structure.get_name() == 'espeak-mark':
mark = message.structure['mark']
@@ -54,7 +58,9 @@ def _create_pipe():
bus = pipe.get_bus()
bus.add_signal_watch()
+ logging.error('before adding message callback')
bus.connect('message', _message_cb, pipe)
+ logging.error('ater adding message callback')
return (source, pipe)
@@ -92,5 +98,14 @@ def is_stopped():
return False
+def pause():
+ play_speaker[1].set_state(Gst.State.NULL)
+
+
def stop():
play_speaker[1].set_state(Gst.State.NULL)
+ play_speaker[0].props.text = ''
+ if speech.reset_cb is not None:
+ speech.reset_cb()
+ if speech.reset_buttons_cb is not None:
+ speech.reset_buttons_cb()