How to use the radian.get_app function in radian

To help you get started, we’ve selected a few radian examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github randy3k / radian / radian / key_bindings.py View on Github external
def _(event):
        app = get_radian_app()
        app.session.change_mode("shell")
github randy3k / radian / radian / key_bindings.py View on Github external
def commit_text(event, text, add_history=True):
    app = get_radian_app()
    app.session.add_history = add_history
    buf = event.current_buffer
    buf.text = text
    buf.validate_and_handle()
github randy3k / radian / radian / key_bindings.py View on Github external
def prompt_mode(mode):
    try:
        return _prompt_mode_cache[mode]
    except KeyError:
        pass
    app = get_radian_app()
    condition = Condition(lambda: app.session.current_mode_name == mode)
    _prompt_mode_cache[mode] = condition
    return condition
github randy3k / radian / radian / key_bindings.py View on Github external
def map_key(key, value, mode="r", filter_str=""):
    app = get_radian_app()
    kb = app.session.modes[mode].prompt_key_bindings
    @kb.add(*key, filter=insert_mode & default_focused, eager=True)
    def _(event):
        event.current_buffer.insert_text(value)
github randy3k / radian / radian / reticulate / __init__.py View on Github external
def configure():
    set_hook(package_event("reticulate", "onLoad"), reticulate_config_hook)

    if package_is_installed("reticulate") and roption("radian.enable_reticulate_prompt", True):
        set_hook(package_event("reticulate", "onLoad"), reticulate_prompt_hook)

        session = get_app().session
        kb = session.modes["r"].prompt_key_bindings
        browsekb = session.modes["browse"].prompt_key_bindings

        @kb.add('~', filter=insert_mode & default_focused & cursor_at_begin & text_is_empty)
        @browsekb.add('~', filter=insert_mode & default_focused & cursor_at_begin & text_is_empty)
        def _(event):
            commit_text(event, "reticulate::repl_python()", False)
github randy3k / radian / radian / key_bindings.py View on Github external
def _(event):
        app = get_radian_app()
        app.session.change_mode("r")