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()
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()
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()