Exemple #1
0
def _get_choices(element):
    constants = get_constants(element)
    element_choices = base_manager.get_choices(element, constants)
    choices = base_manager.create_empty_list()
    for element_choice in element_choices:
        choice = element_choice
        choices = base_manager.add_element(choices, choice)

    return choices
Exemple #2
0
def get_branches_choices(paragraph, data_provider=None):
    branches_list = base_manager.get_children(paragraph)
    choices = base_manager.create_empty_list()
    if branches_list is not None:
        branches = list_manager.get_elements(branches_list)
        for branch_reference in branches:
            branch = base_manager.get_element(branch_reference, data_provider)
            text = base_manager.get_text(branch)
            target = branch_manager.get_target(branch)
            action_open = action_manager.get_open_action(target)
            branch_choice = choice_manager.create_choice(text, action_open)
            choices = base_manager.add_element(choices, branch_choice)

    return choices
Exemple #3
0
def get_details_choice(book, data_provider=None):
    synopsis = get_synopsis(book)
    action_open = action_manager.get_open_action(book)
    choice_text = base_manager.get_back_choice_text(book, book_const)
    choice_open = choice_manager.create_choice(choice_text, action_open)
    choice_list = base_manager.create_empty_list()
    choice_list = base_manager.add_element(choice_list, choice_open)
    menu = menu_manager.create_menu(synopsis,
                                    choice_list,
                                    base_manager.get_question(book)
                                    )
    details_text = get_details_text(book)
    action_show = action_manager.get_show_action(menu)
    details_choice = choice_manager.create_choice(details_text, action_show)
    return details_choice