Пример #1
0
 def play_cb(self, widget):
     self.stop_btn.set_sensitive(True)
     if widget.get_active():
         self.play_btn.set_icon_name("media-playback-pause")
         logging.error("Paused %s", self.is_paused)
         if not self.is_paused:
             # get the text to speech, if there are a selection,
             # play selected text, if not, play all
             abi = self._activity.abiword_canvas
             selection = abi.get_selection("text/plain")
             if not selection or selection[0] is None or selection[1] == 0:
                 # nothing selected
                 abi.select_all()
                 text = abi.get_selection("text/plain")[0]
                 abi.moveto_bod()
             else:
                 text = selection[0]
             speech.play(text)
         else:
             logging.error("Continue play")
             speech.continue_play()
     else:
         self.play_btn.set_icon_name("media-playback-start")
         self.is_paused = True
         speech.pause()
Пример #2
0
 def play_cb(self, widget):
     self.stop_btn.set_sensitive(True)
     if widget.get_active():
         self.play_btn.set_icon_name('media-playback-pause')
         logging.error('Paused %s', self.is_paused)
         if not self.is_paused:
             # get the text to speech, if there are a selection,
             # play selected text, if not, play all
             abi = self._activity.abiword_canvas
             selection = abi.get_selection('text/plain')
             if not selection or selection[0] is None or selection[1] == 0:
                 # nothing selected
                 abi.select_all()
                 text = abi.get_selection('text/plain')[0]
                 abi.moveto_bod()
             else:
                 text = selection[0]
             speech.play(text)
         else:
             logging.error('Continue play')
             speech.continue_play()
     else:
         self.play_btn.set_icon_name('media-playback-start')
         self.is_paused = True
         speech.pause()
Пример #3
0
 def get_more_text(self):
     if self.current_word < len(self.word_tuples):
         speech.stop()
         more_text = self.get_marked_words()
         speech.play(more_text)
     else:
         if speech.reset_buttons_cb is not None:
             speech.reset_buttons_cb()
Пример #4
0
 def play_cb(self, widget):
     if widget.get_active():
         self.play_btn.set_named_icon('media-playback-pause')
         if speech.is_stopped():
             speech.play(self._activity._view.get_marked_words())
     else:
         self.play_btn.set_named_icon('media-playback-start')
         speech.stop()
Пример #5
0
    def _play_cb(self, widget, images):
        widget.set_icon_widget(images[int(widget.get_active())])

        if widget.get_active():
            if speech.is_stopped():
                speech.play(self.activity.add_word_marks())
        else:
            speech.stop()
Пример #6
0
    def play_cb(self, widget, images):
        widget.set_icon_widget(images[int(widget.get_active())])

        if widget.get_active():
            if speech.is_stopped():
                speech.play(self.activity.add_word_marks())
        else:
            speech.stop()
Пример #7
0
 def keypress_cb(self, widget, event):
     "Respond when the user presses one of the arrow keys"
     global done
     global speech_supported
     keyname = Gdk.keyval_name(event.keyval)
     if keyname == 'KP_End' and speech_supported:
         if speech.is_paused() or speech.is_stopped():
             speech.play(self.words_on_page)
         else:
             speech.pause()
         return True
     if keyname == 'plus':
         self.font_increase()
         return True
     if keyname == 'minus':
         self.font_decrease()
         return True
     if speech_supported and speech.is_stopped() == False and speech.is_paused == False:
         # If speech is in progress, ignore other keys.
         return True
     if keyname == '7':
         speech.pitch_down()
         speech.say('Pitch Adjusted')
         return True
     if keyname == '8':
         speech.pitch_up()
         speech.say('Pitch Adjusted')
         return True
     if keyname == '9':
         speech.rate_down()
         speech.say('Rate Adjusted')
         return True
     if keyname == '0':
         speech.rate_up()
         speech.say('Rate Adjusted')
         return True
     if keyname == 'KP_Right':
         self.page_next()
         return True
     if keyname == 'Page_Up' or keyname == 'KP_Up':
         self.page_previous()
         return True
     if keyname == 'KP_Left':
         self.page_previous()
         return True
     if keyname == 'Page_Down' or keyname == 'KP_Down':
         self.page_next()
         return True
     if keyname == 'Up':
         self.scroll_up()
         return True
     if keyname == 'Down':
         self.scroll_down()
         return True
     return False
Пример #8
0
 def play_cb(self, widget):
     self.stop_btn.set_sensitive(True)
     if widget.get_active():
         self.play_btn.set_icon_name('media-playback-pause')
         if not self.is_paused:
             speech.play(self._activity._view.get_marked_words())
         else:
             speech.continue_play()
     else:
         self.play_btn.set_icon_name('media-playback-start')
         self.is_paused = True
         speech.pause()
Пример #9
0
 def play_cb(self, widget):
     self.stop_btn.set_sensitive(True)
     if widget.get_active():
         self.play_btn.set_icon_name('media-playback-pause')
         if not self.is_paused:
             speech.play(self._activity._view.get_marked_words())
         else:
             speech.continue_play()
     else:
         self.play_btn.set_icon_name('media-playback-start')
         self.is_paused = True
         speech.pause()
Пример #10
0
 def get_more_text(self):
     if self.current_word < len(self.word_tuples):
         speech.stop()
         more_text = self.get_marked_words()
         speech.play(more_text)