def init_reviewer():
    card_will_show.append(obscure_editcurrent)

    webview_will_set_content.append(setup_reviewer)
    reviewer_did_show_question.append(stop_fading_on_question)
    reviewer_did_answer_card.append(start_fading_again)
    reviewer_will_end.append(close_editcurrent)
Example #2
0
def patch_reviewer():
    global _reviewer_patched

    if _reviewer_patched:
        return

    from aqt.gui_hooks import (
        webview_will_set_content,
        webview_did_receive_js_message,
    )

    webview_will_set_content.append(on_webview_will_set_content)
    webview_did_receive_js_message.append(on_webview_did_receive_js_message)

    _reviewer_patched = True
Example #3
0
def init_webview():
    editor_did_init.append(js_inserter)
    webview_will_set_content.append(append_js_to_Editor)
    editor_will_load_note.append(append_css_to_Editor)
        # And replace the row with an html table row
        tr = u'<tr>'
        for p in r:
            tr += u'<td>{0}</td>'.format(p)
        trows.append(tr + u'</tr>\n')
    return fen_template.format(rows=''.join(trows),
                               act=active,
                               cas=fen.castling,
                               enp=fen.enpassant,
                               half=fen.halfmove,
                               full=fen.fullmove)


def insert_fen_table(output: TemplateRenderOutput,
                     context: TemplateRenderContext):
    u"""
    Replace well formed  FEN data with a chess board diagram.

    This is a wrapper that looks for `[fen]`, `[/fen]` tags and
    replaces the content.
    """
    # replace both answer and question tag
    output.question_text = fen_re.sub(insert_table, output.question_text)
    output.answer_text = fen_re.sub(insert_table, output.answer_text)


# replace output text with html
hooks.card_did_render.append(insert_fen_table)
# add CSS
webview_will_set_content.append(chess_card_css)
Example #5
0
def init_webview():
    webview_will_set_content.append(include_closet_code)
    webview_did_receive_js_message.append(add_occlusion_messages)
Example #6
0
def init_webview():
    webview_will_set_content.append(load_grid_js)
    webview_did_receive_js_message.append(handle_grid_messages)
def init_webview():
    webview_will_set_content.append(load_collapsible_icon_js)
    webview_did_receive_js_message.append(handle_collapsible_messages)
Example #8
0
def init_webview():
    webview_will_set_content.append(load_frozen_icon_js)
    webview_did_receive_js_message.append(sticky_getter_and_setter)
Example #9
0
def init_webview():
    webview_will_set_content.append(load_package)
    webview_will_set_content.append(append_scripts)
def init_editcurrent():
    webview_will_set_content.append(setup_editcurrent)

    EditCurrent.show = persistent_show
    EditCurrent.reopen = wrap(EditCurrent.reopen, reshow, pos="around")
    EditCurrent.eventFilter = eventFilter
Example #11
0
def init_webview():
    webview_will_set_content.append(add_js_libraries)