Ejemplo n.º 1
0
def get_choice_text(element, index=None):
    default_text = paragraph_const.CHOICE_TEXT
    if base_manager.has_title(element):
        title = paragraph_const.CHOICE_TEXT_TITLE_FORMAT.format(
            base_manager.get_title(element)
        )
        default_text = paragraph_const.CHOICE_TEXT_FORMAT.format(title)

    choice_text = base_manager.get_choice_text(element, None, True)
    if choice_text is None:
        choice_text = default_text

    return choice_text
Ejemplo n.º 2
0
def get_choice_text(element, index=None):
    if index is not None:
        indexed = base_manager.is_indexed(element, book_const)
    else:
        indexed = False

    default_text = book_const.CHOICE_TEXT
    if base_manager.has_title(element):
        title = book_const.CHOICE_TEXT_TITLE_FORMAT.format(
            base_manager.get_title(element)
        )
        if indexed:
            default_text = book_const.CHOICE_TEXT_INDEXED_FORMAT.format(index, title)
        else:
            default_text = book_const.CHOICE_TEXT_FORMAT.format(title)

    choice_text = base_manager.get_choice_text(element, None, True)
    if choice_text is None:
        choice_text = default_text

    return choice_text
Ejemplo n.º 3
0
def get_title(element):
    constants = get_constants(element)
    title = base_manager.get_title(element, constants)
    return title
Ejemplo n.º 4
0
def get_menu_text(book):
    title = base_manager.get_title(book, book_const.DEFAULT_TITLE)
    author = get_author(book)
    text = book_const.MENU_TEXT_FORMAT.format(title, author)
    return text