예제 #1
0
파일: element.py 프로젝트: albesca/books
def get_menu_text(element):
    constants = get_constants(element)
    title = ''
    text = ''
    if base_manager.has_title(element):
        title = constants.MENU_TEXT_TITLE_FORMAT.format(get_title(element))

    if base_manager.has_text(element):
        text = base_manager.get_text(element)

    menu_text = constants.MENU_TEXT_FORMAT.format(title, text)

    return menu_text
예제 #2
0
파일: paragr.py 프로젝트: albesca/books
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
예제 #3
0
파일: book.py 프로젝트: albesca/books
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