Exemple #1
0
    def start(js_view_key, arguments, index, dataToUse):
        
        time = arguments['arguments']['time']
        text = arguments['speech']['title']

        dataJsonToSendCurrentView = {
                "view": js_view_key,
                "data": {
                    'textToShow': text,
                    'time' : time
                },
                "step":arguments,
                "index":index
        }
        socketIO.emit('currentViewToSend',dataJsonToSendCurrentView,broadcast=True)


    # @staticmethod
    # def received_data(local_manager, data):
    #     if hasattr(Wait, 'action_id') and data['data'] != "1":
    #         return {'id': Wait.action_id}
    #     return False

    # @staticmethod
    # def stop(local_manager):
    #     if hasattr(Wait, 'topic_name') and Wait.topic_name:
    #         local_manager.dialog.deactivateTopic(Wait.topic_name)
    #         local_manager.dialog.unloadTopic(Wait.topic_name)
    #         if hasattr(Wait, 'reactivateMovement'):
    #             local_manager.autonomous_life.setAutonomousAbilityEnabled("SpeakingMovement", True)
    #             delattr(Wait, 'reactivateMovement')
    #         delattr(Wait, "topic_name")
    def start(js_view_key, arguments, index, dataToUse):

        if (dataToUse != 'ETI' and dataToUse != 'CGP'):
            desc = arguments['speech']['description']

        if (dataToUse == 'ETI'):
            desc = arguments['speech']['description1']
        if (dataToUse == 'CGP'):
            desc = arguments['speech']['description2']

        text = arguments['speech']['title']

        dataJsonToSendCurrentView = {
            "view": js_view_key,
            "data": {
                'textToShow': {
                    'title': text,
                    'description': [desc]
                }
            },
            "step": arguments,
            "index": index
        }

        socketIO.emit('currentViewToSend',
                      dataJsonToSendCurrentView,
                      broadcast=True)
    def start(js_view_key, arguments, index, dataToUse):
        # ShowVideo.action_id = arg_fetcher.get_argument(arguments, 'id')
        # if not ShowVideo.action_id:
        #     logger.log("Missing id in {0} action arguments".format(js_view_key), "Views Manager", logger.ERROR)
        #     local_manager.send_view_result(js_view_key, {'error': 400})

        # args = arg_fetcher.get_argument(arguments, 'args')
        # speech = arg_fetcher.get_argument(args, 'speech')

        text = arguments['speech']['title']
        text = arguments['arguments']['description']
        if desc:
            desc = desc.split(';')
        else:
            desc = [""]

        dataJsonToSendCurrentView = {
            "view": js_view_key,
            'data': {
                'textToShow': {
                    'title': text,
                    'description': desc
                },
                # 'video': arg_fetcher.get_argument(args, 'video')
                'video': videos
            },
            "step": arguments,
            "index": index
        }
        socketIO.emit('currentViewToSend',
                      dataJsonToSendCurrentView,
                      broadcast=True)
Exemple #4
0
    def start(js_view_key, arguments, index, dataToUse):
        # AskName.action_id = arg_fetcher.get_argument(arguments, 'id')
        # if not AskName.action_id:
        #     logger.log("Missing id in {0} action arguments".format(js_view_key), "Views Manager", logger.ERROR)
        #     local_manager.send_view_result(js_view_key, {'error': 400})

        # args = arg_fetcher.get_argument(arguments, 'args')
        # speech = arg_fetcher.get_argument(args, 'speech')

        # text = arg_fetcher.get_argument(speech, 'title')
        text = arguments['speech']['title']

        # names = arg_fetcher.get_argument(args, 'names')
        names = people
        AskName.names = names

        dataJsonToSendCurrentView = {
            "view": js_view_key,
            "data": {
                'textToShow': text,
                'names': names
            },
            "step": arguments,
            "index": index
        }
        socketIO.emit('currentViewToSend',
                      dataJsonToSendCurrentView,
                      broadcast=True)
Exemple #5
0
    def start(js_view_key, arguments, index, dataToUse):
        # AskAge.action_id = arg_fetcher.get_argument(arguments, 'id')
        # if not AskAge.action_id:
        #     logger.log("Missing id in {0} action arguments".format(js_view_key), "Views Manager", logger.ERROR)
        #     local_manager.send_view_result(js_view_key, {'error': 400})

        # args = arg_fetcher.get_argument(arguments, 'args')
        # speech = arg_fetcher.get_argument(args, 'speech')

        # text = arg_fetcher.get_argument(speech, 'title')
        # said = arg_fetcher.get_argument(speech, 'said')

        # name = arg_fetcher.get_argument(speech, 'name')

        # text = text.format(name=name)
        # said = said.format(name=name)

        # ages = [str(i) for i in range(99)]
        text = arguments['speech']['title']

        dataJsonToSendCurrentView = {
            "view": js_view_key,
            "data": {
                'textToShow': text
            },
            "step": arguments,
            "index": index
        }
        socketIO.emit('currentViewToSend',
                      dataJsonToSendCurrentView,
                      broadcast=True)
    def start(js_view_key, arguments, index, dataToUse):

        text = arguments['speech']['title']

        if js_view_key == 'askDrink':

            drinks = drink
            AskSomething.drinks = drinks

            dataJsonToSendCurrentView = {
                "view": 'askSomething',
                "data": {
                    'textToShow': text,
                    'drinks': drinks
                },
                "step": arguments,
                "index": index
            }

        if js_view_key == 'askName':
            names = people
            AskSomething.names = names

            dataJsonToSendCurrentView = {
                "view": 'askSomething',
                "data": {
                    'textToShow': text,
                    'names': names
                },
                "step": arguments,
                "index": index
            }

        if js_view_key == 'askSpeciality':
            name = speciality
            AskSomething.name = name

            dataJsonToSendCurrentView = {
                "view": 'askSomething',
                "data": {
                    'textToShow': text,
                    'names': name
                },
                "step": arguments,
                "index": index
            }

        socketIO.emit('currentViewToSend',
                      dataJsonToSendCurrentView,
                      broadcast=True)
Exemple #7
0
    def start(js_view_key, arguments, index, dataToUse):

        text = arguments['speech']['title']

        # text = arguments['speech']['name']

        dataJsonToSendCurrentView = {
            "view": js_view_key,
            "data": {
                'textToShow': text,
            },
            "step": arguments,
            "index": index
        }
        socketIO.emit('currentViewToSend',
                      dataJsonToSendCurrentView,
                      broadcast=True)
Exemple #8
0
    def start(js_view_key, arguments, index, dataToUse):
        # AskDrink.action_id = arg_fetcher.get_argument(arguments, 'id')
        # if not AskDrink.action_id:
        #     logger.log("Missing id in {0} action arguments".format(js_view_key), "Views Manager", logger.ERROR)
        #     local_manager.send_view_result(js_view_key, {'error': 400})
        
        drinks = drink
        AskDrink.drinks = drinks
        
        text = arguments['speech']['title']


        dataJsonToSendCurrentView = {
                "view": js_view_key,
                "data": {
                    'textToShow': text,
                    'drinks' : drinks
                },
                "step":arguments,
                "index":index
        }
        socketIO.emit('currentViewToSend',dataJsonToSendCurrentView,broadcast=True)
        # emit('currentStep',dataJsonToSendCurrentStep)
        # socketio.sleep(5)

    # @staticmethod
    # def received_data(local_manager, data):
    #     if hasattr(AskDrink, 'action_id'):
    #         if hasattr(AskDrink, 'drinks'):
    #             for drink in AskDrink.drinks:
    #                 if data['data'] == drink['name']:
    #                     return {'id': AskDrink.action_id, 'drink': drink}
    #     return True

    # @staticmethod
    # def stop(local_manager):
    #     if hasattr(AskDrink, 'topic_name') and AskDrink.topic_name:
    #         local_manager.dialog.deactivateTopic(AskDrink.topic_name)
    #         local_manager.dialog.unloadTopic(AskDrink.topic_name)
    #         if hasattr(AskDrink, 'reactivateMovement'):
    #             local_manager.autonomous_life.setAutonomousAbilityEnabled("SpeakingMovement", True)
    #             delattr(AskDrink, 'reactivateMovement')
    #         delattr(AskDrink, "topic_name")
Exemple #9
0
    def start(js_view_key, arguments, index, dataToUse):
        # CallHuman.action_id = arg_fetcher.get_argument(arguments, 'id')
        # if not CallHuman.action_id:
        #     logger.log("Missing id in {0} action arguments".format(js_view_key), "Views Manager", logger.ERROR)
        #     local_manager.send_view_result(js_view_key, {'error': 400})

        text = arguments['speech']['title']
        # time = arguments['arguments']['time']

        dataJsonToSendCurrentView = {
            "view": js_view_key,
            'data': {
                'textToShow': text,
                # 'time': time
            },
            "step": arguments,
            "index": index
        }
        socketIO.emit('currentViewToSend',
                      dataJsonToSendCurrentView,
                      broadcast=True)
Exemple #10
0
    def start(js_view_key, arguments, index, dataToUse):
        # PresentPerson.action_id = arg_fetcher.get_argument(arguments, 'id')
        # if not PresentPerson.action_id:
        #     logger.log("Missing id in {0} action arguments".format(js_view_key), "Views Manager", logger.ERROR)
        #     local_manager.send_view_result(js_view_key, {'error': 400})

        # args = arg_fetcher.get_argument(arguments, 'args')
        # speech = arg_fetcher.get_argument(args, 'speech')

        # text = arg_fetcher.get_argument(speech, 'title')
        # said = arg_fetcher.get_argument(speech, 'said')

        text = arguments['speech']['said']
        who = arguments['arguments']['who']
        to = arguments['arguments']['to']
        print("WHO!!")
        print(who)
        dataJsonToSendCurrentView = {
            "view": js_view_key,
            'data': {
                'textToShow': text,
                'people': {
                    'who': {
                        'drink': who['drinkObj'],
                        'name': who['name']
                    },
                    'to': to
                }
            },
            "step": arguments,
            "index": index
        }
        # dataJsonToSendCurrentStep = {
        #         "index": index
        #     }
        socketIO.emit('currentViewToSend',
                      dataJsonToSendCurrentView,
                      broadcast=True)
    def start(js_view_key, arguments, index, dataToUse):

        text = arguments['speech']['title']
        
        names = speciality
        AskSpeciality.names = names
        
        dataJsonToSendCurrentView = {
                "view": js_view_key,
                "data": {
                    'textToShow': text,
                    'names' : names
                },
                "step":arguments,
                "index":index
        }
        socketIO.emit('currentViewToSend',dataJsonToSendCurrentView,broadcast=True)
        # emit('currentStep',dataJsonToSendCurrentStep)
        # socketio.sleep(5)
        # stepCompletedJson = {"idSteps": index}
        # emit('stepCompleted',stepCompletedJson)

    # @staticmethod
    # def received_data(local_manager, data):
    #     logger.log("AskName: data = " + str(data), "Views Manager", logger.DEBUG)
    #     if hasattr(AskName, 'action_id') and hasattr(AskName, 'names') and data['data'] in AskName.names:
    #         return {'id': AskName.action_id, 'name': data['data']}
    #     return True

    # @staticmethod
    # def stop(local_manager):
    #     if hasattr(AskName, 'topic_name') and AskName.topic_name:
    #         local_manager.dialog.deactivateTopic(AskName.topic_name)
    #         local_manager.dialog.unloadTopic(AskName.topic_name)
    #         if hasattr(AskName, 'reactivateMovement'):
    #             local_manager.autonomous_life.setAutonomousAbilityEnabled("SpeakingMovement", True)
    #             delattr(AskName, 'reactivateMovement')
    #         delattr(AskName, "topic_name")
    def start(js_view_key, arguments, index, dataToUse):
        
        text = arguments['speech']['title']
        locations = arguments['arguments']['location']

        dataJsonToSendCurrentView = {
                "view": js_view_key,
                "data": {
                    'textToShow': text,
                    'location': locations
                },
                "step":arguments,
                "index":index
        }
        socketIO.emit('currentViewToSend',dataJsonToSendCurrentView,broadcast=True)
        # emit('currentStep',dataJsonToSendCurrentStep)
        # socketio.sleep(5)
        

    # @staticmethod
    # def received_data(local_manager, data):
    #     if hasattr(AskToFollow, 'topic_name'): # Means that a .top is loaded, need to check if it's done
    #         if data['data'] == "1":
    #             return {'id': AskToFollow.action_id}
    #     elif hasattr(AskToFollow, 'action_id'):
    #         return {'id': AskToFollow.action_id}
    #     return False

    # @staticmethod
    # def stop(local_manager):
    #     if hasattr(AskToFollow, 'topic_name') and AskToFollow.topic_name:
    #         local_manager.dialog.deactivateTopic(AskToFollow.topic_name)
    #         local_manager.dialog.unloadTopic(AskToFollow.topic_name)
    #         if hasattr(AskToFollow, 'reactivateMovement'):
    #             local_manager.autonomous_life.setAutonomousAbilityEnabled("SpeakingMovement", True)
    #             delattr(AskToFollow, 'reactivateMovement')
    #         delattr(AskToFollow, "topic_name")
Exemple #13
0
    def start(js_view_key, arguments, index, dataToUse):
        # Confirm.action_id = arg_fetcher.get_argument(arguments, 'id')
        # if not Confirm.action_id:
        #     logger.log("Missing id in {0} action arguments".format(js_view_key), "Views Manager", logger.ERROR)
        #     local_manager.send_view_result(js_view_key, {'error': 400})

        text = arguments['speech']['title']
        if text and "{drink}" in text:
            text = text.format(drink=dataToUse)
        if text and "{name}" in text:
            text = text.format(name=dataToUse)

        dataJsonToSendCurrentView = {
            "view": js_view_key,
            "data": {
                'textToShow': text
            },
            "step": arguments,
            "index": index
        }

        socketIO.emit('currentViewToSend',
                      dataJsonToSendCurrentView,
                      broadcast=True)