当前位置: 首页>>代码示例>>Python>>正文


Python AddViews.callbacks方法代码示例

本文整理汇总了Python中siriObjects.uiObjects.AddViews.callbacks方法的典型用法代码示例。如果您正苦于以下问题:Python AddViews.callbacks方法的具体用法?Python AddViews.callbacks怎么用?Python AddViews.callbacks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在siriObjects.uiObjects.AddViews的用法示例。


在下文中一共展示了AddViews.callbacks方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: call

# 需要导入模块: from siriObjects.uiObjects import AddViews [as 别名]
# 或者: from siriObjects.uiObjects.AddViews import callbacks [as 别名]
 def call(self, phone, person, language):
     
     if phone == None:
         print "abandon"
         self.complete_request()
         return
     
     root = ResultCallback(commands=[])
     rootView = AddViews("", temporary=False, dialogPhase="Completion", views=[])
     root.commands.append(rootView)
     rootView.views.append(AssistantUtteranceView(text=responses['callPerson'][language].format(person.fullName, numberTypesLocalized[phone.label][language], phone.number), speakableText=responses['callPersonSpeak'][language].format(person.fullName, numberTypesLocalized[phone.label][language]), dialogIdentifier="PhoneCall#initiatePhoneCall", listenAfterSpeaking=False))
     rootView.callbacks = []
     
     # create some infos of the target
     personAttribute=PersonAttribute(data=phone.number, displayText=person.fullName, obj=Person())
     personAttribute.object.identifer = person.identifier
     call = PhoneCall("", recipient=phone.number, faceTime=False, callRecipient=personAttribute)
     
     rootView.callbacks.append(ResultCallback(commands=[call]))
     
     call.callbacks = []
     # now fill in error messages (airplanemode, no service, invalidNumber, fatal)
     for i in range(4):
         errorRoot = AddViews(None, temporary=False, dialogPhase="Completion", scrollToTop=False, views=[])
         errorRoot.views.append(AssistantUtteranceView(text=errorOnCallResponse[language][i]['text'], speakableText=errorOnCallResponse[language][i]['text'], dialogIdentifier=errorOnCallResponse[language][i]['dialogIdentifier'], listenAfterSpeaking=False))
         call.callbacks.append(ResultCallback(commands=[errorRoot], code=errorOnCallResponse[language][i]['code']))
         
     self.complete_request([root])
开发者ID:hajimela,项目名称:SiriServer,代码行数:30,代码来源:phonecalls.py

示例2: webSearchConfirmation

# 需要导入模块: from siriObjects.uiObjects import AddViews [as 别名]
# 或者: from siriObjects.uiObjects.AddViews import callbacks [as 别名]
    def webSearchConfirmation(self, speech, language, regMatched):
        webSearchQuery = regMatched.group(1)
        webSearchConfirmation = regMatched.group(2)
        
        lang = language.split("-")[0]

        resultCallback1View = AddViews(refId="", views=[AssistantUtteranceView(dialogIdentifier="WebSearch#initiateWebSearch", text=webSearchAnswerText[lang].format(u"„{0}“".format(webSearchQuery)), speakableText=webSearchAnswerText[lang].format(webSearchQuery))])
        
        search = WebSearch(refId="", aceId="", query=webSearchQuery)
        resultCallback3View = AddViews(refId="", views=[AssistantUtteranceView(dialogIdentifier="WebSearch#fatalResponse", text=webSearchAnswerFailureText[lang], speakableText=webSearchAnswerFailureText[lang])])
        resultCallback3 = ResultCallback(commands=[resultCallback3View])
        search.callbacks = [resultCallback3]

        resultCallback2 = ResultCallback(commands=[search])
        resultCallback1View.callbacks = [resultCallback2]

        self.complete_request(callbacks=[ResultCallback(commands=[resultCallback1View])])
开发者ID:AbandonedCart,项目名称:SiriServerCore,代码行数:19,代码来源:startRequestHandler.py

示例3: webSearchConfirmation

# 需要导入模块: from siriObjects.uiObjects import AddViews [as 别名]
# 或者: from siriObjects.uiObjects.AddViews import callbacks [as 别名]
    def webSearchConfirmation(self, speech, language):
        # lets use a little hack to get that regex
        matcher = self.webSearchConfirmation.__dict__[__criteria_key__]['de-DE']
        regMatched = matcher.match(speech)
        webSearchQuery = regMatched.group(1)
        webSearchConfirmation = regMatched.group(2)
        
        lang = language.split("-")[0]

        resultCallback1View = AddViews(refId="", views=[AssistantUtteranceView(dialogIdentifier="WebSearch#initiateWebSearch", text=webSearchAnswerText[lang].format(u"„{0}“".format(webSearchQuery)), speakableText=webSearchAnswerText[lang].format(webSearchQuery))])
        
        search = WebSearch(refId="", aceId="", query=webSearchQuery)
        resultCallback3View = AddViews(refId="", views=[AssistantUtteranceView(dialogIdentifier="WebSearch#fatalResponse", text=webSearchAnswerFailureText[lang], speakableText=webSearchAnswerFailureText[lang])])
        resultCallback3 = ResultCallback(commands=[resultCallback3View])
        search.callbacks = [resultCallback3]

        resultCallback2 = ResultCallback(commands=[search])
        resultCallback1View.callbacks = [resultCallback2]

        self.complete_request(callbacks=[ResultCallback(commands=[resultCallback1View])])
开发者ID:Doriginal,项目名称:SiriServer,代码行数:22,代码来源:__init__.py


注:本文中的siriObjects.uiObjects.AddViews.callbacks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。