Exemple #1
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
Exemple #2
0
def get_children_choice(element, data_provider=None):
    children_choice = None
    children = base_manager.get_children(element)
    if children is not None:
        choice_text = list_manager.get_choice_text(children)
        action_browse = action_manager.get_browse_action(children)
        children_choice = choice_manager.create_choice(choice_text,
                                                       action_browse
                                                       )
    return children_choice
Exemple #3
0
def get_open_choice(element_reference, data_provider, back_choice=False, index=None):
    element = base_manager.get_element(element_reference, data_provider)
    if back_choice:
        choice_text = get_back_choice_text(element)
    else:
        manager = get_manager(element)
        method = get_method(manager, element_const.CHOICE_TEXT)
        choice_text = method(element, index)

    action_open = action_manager.get_open_action(element_reference)
    open_choice = choice_manager.create_choice(choice_text,
                                               action_open
                                               )
    return open_choice
Exemple #4
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