コード例 #1
0
    def btnpress(self, show, happ=""):
        try:
            saythis = {
                "X": "multiply by",
                "/": "divide by",
                "(": "opening bracket",
                ")": "closing bracket",
                "00": "double zero",
                "-": "minus",
                "+": "plus",
                "^": "raised to",
                ".": "point"
            }
            say = saythis[show] if show in saythis.keys() else show
            say = "" if self.ids.sound.text == "Sound : Off" else say
            tts.speak(say)
            chk = self.dstack[-1][-1]
            nums = "1234567890.^-+*X)"
            print("check : ", chk, "show : ", show[0])
            if chk in nums and show[0] not in nums:
                print("*" + str(show))
                self.ids.deqn.text += ("*" + show) if happ == "" else ("*" +
                                                                       happ)
                print(self.ids.deqn.text)
            else:
                self.ids.deqn.text += show if happ == "" else happ
        except:
            self.ids.deqn.text += show if happ == "" else happ

        self.ids.eqn.text += show
        self.stack.append(self.ids.eqn.text)
        self.dstack.append(self.ids.deqn.text)
コード例 #2
0
 def check_user(self, user, pwd):
     if pwd.lower() == 'pyconindia':
         tts.speak('Hello {}. Welcome to Pycon India!'.format(user))
     if pwd.lower() == 'funny':
         tts.speak('Lalu ji ko rabri achi lagti hai')
     # load screen 2
     self.root.current = 'screen 2' 
 def voz_boton(self, texto):
     hoy = datetime.date.today()
     print(hoy)
     self.ids.txt_Fecha.text = str(hoy)
     r= sr.Recognizer()
     #leyenda= self.ids.btn_Producto.text
     print(texto)
     try:
         tts.speak("Ingrese "+texto)
         #print ("Escuchando")
         with sr.Microphone() as source:
             #r.adjust_for_ambient_noise(source)
             #print("Hable ahora...")
             audio = r.listen(source)
             entrada = r.recognize_google(audio, language='es-ES')
             if (texto=='Nombre'):
                 self.ids.txt_Producto.text = entrada
             elif(texto=='Precio'):
                 self.ids.txt_Precio.text = entrada
             elif(texto=='Cantidad'):
                 self.ids.txt_Cantidad.text = entrada
                
         
     except NotImplementedError:
         popup = ErrorPopup()
         popup.open()
     except:
         print("No entendí o tardó demasiado")
コード例 #4
0
 def style(self, style=None, A=None):
     """Display the aphorism text in a given style"""
     if int(app.config.get('display', 'bg_enabled')) == 1:
         app.background_set(app.background_get_random())
     if isinstance(A, Aphorism):
         self.aphorism = A
     else:
         A = self.aphorism
     if style is None:
         tpl = """\"[b]{aphorism}[/b]\"\n\n    -- [i]{author}[/i]"""
         formatted = tpl.format(aphorism=A.aphorism, author=A.author)
         self.ids.quote.text = formatted
     elif style == 'full':
         tpl = """\"[b]{aphorism}[/b]\"\n\n    -- [i]{author}[/i]\n\n{source}"""
         formatted = tpl.format(
             aphorism=A.aphorism,
             author=A.author,
             source=A.source)
         self.ids.quote.text = formatted
     if int(app.config.get('accessibility', 'tts')) == 1 and str(platform) != 'linux':
         tts.speak("New aphorism.")
         tts.speak(A.aphorism)
         tts.speak('spoken by')
         tts.speak(A.author)
         tts.speak("End of new aphorism.")
コード例 #5
0
 def style(self, style=None, A=None):
     """Display the aphorism text in a given style"""
     if int(app.config.get('display', 'bg_enabled')) == 1:
         app.background_set(app.background_get_random())
     if isinstance(A, Aphorism):
         self.aphorism = A
     else:
         A = self.aphorism
     if style is None:
         tpl = """\"[b]{aphorism}[/b]\"\n\n    -- [i]{author}[/i]"""
         formatted = tpl.format(aphorism=A.aphorism, author=A.author)
         self.ids.quote.text = formatted
     elif style == 'full':
         tpl = """\"[b]{aphorism}[/b]\"\n\n    -- [i]{author}[/i]\n\n{source}"""
         formatted = tpl.format(aphorism=A.aphorism,
                                author=A.author,
                                source=A.source)
         self.ids.quote.text = formatted
     if int(app.config.get('accessibility',
                           'tts')) == 1 and str(platform) != 'linux':
         tts.speak("New aphorism.")
         tts.speak(A.aphorism)
         tts.speak('spoken by')
         tts.speak(A.author)
         tts.speak("End of new aphorism.")
コード例 #6
0
 def calculate(self, speak_ans=False):
     try:
         eqnn = self.ids.deqn.text
         eqnn = eqnn.replace("^", "**").replace("/", "*1.0/")
         while eqnn.count("(") > eqnn.count(")"):
             eqnn += ")"
         print(eqnn)
         Ans = eval(eqnn)
         print(Ans)
         self.ids.ans.text = "0" if Ans > 0.000000001 and Ans < -0.000000001 else str(
             Ans)
         Ans = str(Ans)
         Ans = Ans.replace("-", "negative") if Ans[0] == '-' else Ans
         speak_ans = False if self.ids.sound.text == "Sound : Off" or speak_ans == False else True
         if speak_ans == True: tts.speak(str(Ans))
     except ZeroDivisionError:
         self.clr_btn()
         popup = Popup(title='Error !!!',
                       content=Label(text="Dividing by zero Error !!!"),
                       size=(200, 100),
                       size_hint=(None, None))
         popup.open()
     except:
         self.clr_btn()
         popup = Popup(title='Error !!!',
                       content=Label(text="Syntax Error !!!"),
                       size=(200, 100),
                       size_hint=(None, None))
         popup.open()
コード例 #7
0
 def readactivity(self, activity):
     activity = activity.split("*****")
     activity = activity[0]
     msg = str("You are " + activity)
     try:
         tts.speak(msg)
     except NotImplementedError:
         print "Error!"
コード例 #8
0
 def speak(self):
     print("speech: ", self.text)
     if (is_debug_mode):
         lang = "zh-cn"
         self.speech = Speech(self.text, lang)
         self.speech.play()
     else:
         tts.speak(self.text)
コード例 #9
0
def com_sound_text_to_speech(message_to_speak):
    """
    # text to speech
    """
    try:
        tts.speak(message_to_speak)
    except NotImplementedError:
        pass
コード例 #10
0
 def read_intro(self, sb_button):
     sb_button.disabled = True
     if self.speak_flag == 0:
         tts.speak(self.text_label_1)
     self.speak_flag = 1
     self.animation_count = 0
     Clock.schedule_once(self.reset_speak_flag, 5)
     sb_button.disabled = False
コード例 #11
0
 def say_something(self, text):
     try:
         tts.speak(text)
     except NotImplementedError:
         popup = Popup(title='TTS Not Implemented',
                       content=Label(text='Sorry. TTS is not available.'),
                       size_hint=(None, None),
                       size=(300, 300))
         popup.open()
コード例 #12
0
ファイル: main.py プロジェクト: brousch/saythis
 def say_something(self, text):
     try:
         tts.speak(text)
     except NotImplementedError:
         popup = Popup(title='TTS Not Implemented',
                       content=Label(text='Sorry. TTS is not available.'),
                       size_hint=(None, None), 
                       size=(300, 300))
         popup.open()
コード例 #13
0
 def speak(the_text):
     for txt in the_text:
         if the_tts is 'pyttsx':
             TTS.engine.say(txt)
         if the_tts is 'plyer':
             tts.speak(txt)
             time.sleep(float(len(txt)) * 0.05)
     if the_tts is 'pyttsx':
         TTS.engine.runAndWait()
         time.sleep(1)
コード例 #14
0
ファイル: main.py プロジェクト: barliant/krextown
 def say_something(self, text):
   #subprocess.call(["espeak", text])
   try:
     tts.speak(text)
   except NotImplementedError:
     popup = Popup(title='Text-to-Speech not implemented',
         content=Label(text='Sorry, TTS is not available.'),
         size_hint=(None, None),
         size=(300, 300))
     popup.open()
コード例 #15
0
ファイル: main.py プロジェクト: Fogapod/korm3.0
def LogInVk(*args):
    LOGIN, PASSWORD = args
    global api
    api = vk.API(vk.AuthSession(app_id = "5649665", user_login = LOGIN, user_password = PASSWORD, scope = '74752'), v = '5.59') #9216
                   
    try: tts.speak(u'Добрый день, ' + api.users.get()[0]['first_name'])
    except: notification.notify(title=u'Error',message=u'Greetings failed!',timeout=2)
    txt = re.split(r'\n', decode('code'))
    encode('code', '%s\n%s\n%s\n' %(txt[0], LOGIN, PASSWORD))
    return True
コード例 #16
0
ファイル: Root.py プロジェクト: errnesto/next-word-prediction
    def talk(self, words_widget):
        try:
            tts.speak(self.text_output.text.encode("utf8") + ".")
        except NotImplementedError:
            pass

        self.text_output.text = ""

        # update word list if it not in other view
        if words_widget.__class__.__name__ == "WordList":
            words      = self.word_predictor.getWordList()
            words_widget.build_list(words)
コード例 #17
0
 def speak(the_text, finished=None):
     for txt in the_text:
         if the_tts is 'pyttsx':
             TTS.engine.say(txt)
         if the_tts is 'plyer':
             tts.speak(txt)
             time.sleep(float(len(txt)) * 0.05)
             if finished:
                 Clock.schedule_once(finished, 0)
     if the_tts is 'pyttsx':
         TTS.engine.runAndWait()
         time.sleep(1)
         if finished:
             finished(0.0)
コード例 #18
0
 def speak(the_text, finished=None):
     for txt in the_text:
         if the_tts is 'pyttsx':
             TTS.engine.say(txt)
         if the_tts is 'plyer':
             tts.speak(txt)
             time.sleep(float(len(txt)) * 0.05)
             if finished:
                 Clock.schedule_once(finished, 0)
     if the_tts is 'pyttsx':
         TTS.engine.runAndWait()
         time.sleep(1)
         if finished:
             finished(0.0)
コード例 #19
0
 def message(self, msg_type, msg):
     """Show the message using an icon named after the given type"""
     self.msg_type = msg_type
     self.msg = msg
     if int(app.config.get('accessibility', 'tts')) == 1 and str(platform) != 'linux':
         tts.speak("New notification. Notification type is " + msg_type)
         tts.speak('Notification message follows.')
         tts.speak(msg)
         tts.speak('End of notification message.')
     self.icon = 'assets/img/icons/notify/' + msg_type + '.png'
コード例 #20
0
ファイル: main.py プロジェクト: benbongalon/twiddletalk
    def speak(self, text):
        """Calls the speech synthesizer.

        Parameters:
            text (str): The text to be spoken.
            
        Returns:
            none
        """

        try:
            tts.speak(text)
        except NotImplementedError:
            popup = Popup(title='TTS Not Implemented',
                          content=Label(text='Sorry. TTS is not available.'),
                          size_hint=(None, None),
                          size=(300, 300))
            popup.open()
コード例 #21
0
 def message(self, msg_type, msg):
     """Show the message using an icon named after the given type"""
     self.msg_type = msg_type
     self.msg = msg
     if int(app.config.get('accessibility',
                           'tts')) == 1 and str(platform) != 'linux':
         tts.speak("New notification. Notification type is " + msg_type)
         tts.speak('Notification message follows.')
         tts.speak(msg)
         tts.speak('End of notification message.')
     self.icon = 'assets/img/icons/notify/' + msg_type + '.png'
コード例 #22
0
 def calspeak(self):
     saythis, say = {
         "X": " multiply by ",
         "/": " divide by ",
         "(": " opening bracket ",
         ")": " closing bracket ",
         "-": " minus ",
         "+": " plus ",
         "^": " raised to ",
         ".": " point "
     }, ""
     msg = "value of " + self.ids.eqn.text + " is " + self.ids.ans.text
     for x in saythis.keys():
         msg = msg.replace(x, saythis[x])
     for show in msg.split():
         say += " " + saythis[show] if show in saythis.keys(
         ) else " " + show
     say = "" if self.ids.sound.text == "Sound : Off" else say
     print(say)
     tts.speak(say)
コード例 #23
0
 def on_touch_down(self, touch):
     ret, img = self.capture.read()
     self.capture.release()
     tts.speak(message="El pastel es una mentira. The cake is a lie")
コード例 #24
0
import json
from random import choice
import time
the_tts = None
try:
    from plyer import tts
    tts.speak('hello')
    the_tts = 'plyer'
except:
    pass

try:
    import pyttsx
    the_tts = 'pyttsx'
except:
    pass


class TTS:
    engine = None
    what = ''

    @staticmethod
    def start():
        TTS.engine =  None
        if the_tts is 'pyttsx':
            TTS.engine = pyttsx.init()
            TTS.engine.setProperty('voice', 'HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Speech/Voices/Tokens/TTS_MS_EN-US_ZIRA_11.0')
            TTS.engine.connect(topic='finished-utterance', cb=TTS.finished)

    @staticmethod
コード例 #25
0
 def ola(self, *args):
     notification.notify('Olá Python Brasil :)')
     tts.speak(
         "Hello Python Brazil, "
         "I'm Plyer's Text to Speech Module. Have fun!")
コード例 #26
0
ファイル: main.py プロジェクト: brousch/pyohio-kivy-2014
 def _do_speak(self, saythis):
     try:
         tts.speak(saythis)
     except NotImplementedError:
         Logger.info("Text to Speech is not implemented on this platform.")
コード例 #27
0
import json
from random import choice
import time
from kivy.clock import Clock

the_tts = None
try:
    from plyer import tts
    tts.speak('')
    the_tts = 'plyer'
except:
    pass

try:
    import pyttsx
    the_tts = 'pyttsx'
except:
    pass


class TTS:
    engine = None
    what = ''

    @staticmethod
    def start():
        TTS.engine = None
        if the_tts is 'pyttsx':
            TTS.engine = pyttsx.init()
            TTS.engine.setProperty(
                'voice',
コード例 #28
0
import json
from random import choice
import time
from kivy.clock import Clock

the_tts = None
try:
    from plyer import tts
    tts.speak(message='hello')
    the_tts = 'plyer'
except:
    pass

try:
    import pyttsx
    the_tts = 'pyttsx'
except:
    pass


class TTS:
    engine = None
    what = ''

    @staticmethod
    def start():
        TTS.engine =  None
        if the_tts is 'pyttsx':
            TTS.engine = pyttsx.init()
            TTS.engine.setProperty('voice', 'HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Speech/Voices/Tokens/TTS_MS_EN-US_ZIRA_11.0')
            TTS.engine.connect(topic='finished-utterance', cb=TTS.finished)
コード例 #29
0
 def speak(self, item):
     tts.speak(item)
コード例 #30
0
ファイル: main.py プロジェクト: dgatf/smartport_bluetooth
def do_speak(event_voice):
    global text_voice
    while True:
        event_voice.wait()
        tts.speak(text_voice)
        event_voice.clear()
コード例 #31
0
ファイル: main.py プロジェクト: UpToTime/weather-app
 def talk_back(self,words,*args):
     tts.speak(str(words))
コード例 #32
0
ファイル: helpers.py プロジェクト: VictorManhani/polingua
 def run():
     try:
         tts.speak(word)
     except NotImplementedError:
         print("error")
コード例 #33
0
ファイル: main.py プロジェクト: brousch/pyohio-kivy-2014
 def _do_speak(self, saythis):
     try:
         tts.speak(saythis)
     except NotImplementedError:
         Logger.info("Text to Speech is not implemented on this platform.")
コード例 #34
0
ファイル: main.py プロジェクト: autosportlabs/plyer
 def do_read(self):
     try:
         tts.speak(self.ids.notification_text.text)
     except NotImplementedError:
         popup = ErrorPopup()
         popup.open()
コード例 #35
0
ファイル: main.py プロジェクト: yumoqing/plyer
 def do_read(self):
     try:
         tts.speak(self.ids.notification_text.text)
     except NotImplementedError:
         popup = ErrorPopup()
         popup.open()
コード例 #36
0
ファイル: main.py プロジェクト: Zayn-Rekhi/SocialCheck
def beep(data):
    tts.speak(data)
コード例 #37
0
 def check_user(self, user, pwd):
     if pwd.lower() == 'pyconindia':
         tts.speak('Hello {}. Welcome to Pycon India!'.format(user))
     if pwd.lower() == 'funny':
         tts.speak('Lalu ji ko rabbri, bahoot pasand hai!')
コード例 #38
0
 def check_user(self, user, pwd):
     if pwd.lower() == 'pyconindia':
         tts.speak('Hello {}. Welcome to Pycon India!'.format(user))
     if pwd.lower() == 'funny':
         tts.speak('Lalu ji ko rabbri, bahoot pasand hai!')
コード例 #39
0
 def speak(self, text):
     tts.speak(text)
コード例 #40
0
 def talk(self, file_path):
     try:
         tts.speak(message=self.convert_pdf_to_txt(file_path[0]))
     except:
         print 'cant talk'
コード例 #41
0
 def read_aloud(self, text, button):
     button.disabled = True
     button.state = "down"
     tts.speak(text)
     button.disabled = False
     button.state = "normal"
コード例 #42
0
 def talk(self,file_path):
     try:
         tts.speak(message=self.convert_pdf_to_txt(file_path[0]))
     except:
         print 'cant talk'
コード例 #43
0
ファイル: main.py プロジェクト: TetoBertolla1/Site-1
 def responder(self, *args):
     self.respWidget.text = self.resp
     tts.speak(self.resp)
コード例 #44
0
 def ler(self, *args):
     tts.speak(self.txt_entrada.text)