示例#1
0
def init(injector):
    injector.add_context('editor-with-cursor-in-string', 'editor', in_string)

    injector.bind('editor-active', 'delete-line', 'Edit/_Delete line#20', delete_line).to('<ctrl>d')

    injector.bind('editor-active', 'smart-select', 'Edit/Smart _select', smart_select).to('<alt>w')
    injector.bind('editor-with-selection', 'smart-unselect', 'Edit/Smart _unselect',
        smart_unselect).to('<shift><alt>w')

    injector.bind_check('editor-active', 'show_offset', 'Tools/Show offset and column#10',
        toggle_offset).to('<ctrl><alt>o')

    injector.bind('editor-with-selection', 'wrap-text', 'Edit/_Wrap block', wrap_text).to('<alt>f')

    injector.bind('editor-with-selection', 'move-selection-left',
        'Edit/Move selection _left', move_word_left).to('<alt>Left')
    injector.bind('editor-with-selection', 'move-selection-right',
        'Edit/Move selection _right', move_word_right).to('<alt>Right')

    injector.bind('editor-with-cursor-in-string', 'swap-quotes',
        'Edit/Swap _quotes', swap_quotes).to('<alt>apostrophe')

    from snaked.core.prefs import add_option
    add_option('DOUBLE_BRACKET_MATCHER', True, "Enable custom bracket matcher")
    add_option('COPY_DELETED_LINE', True, "Put deleted line into clipboard")

    injector.on_ready('editor-with-new-buffer', editor_created)
示例#2
0
def init(injector):
    injector.add_context('python-editor', 'editor-active',
        lambda e: e if is_python_editor(e) else None)

    injector.bind('python-editor', 'goto-definition', '_Python#70/Goto _defenition', goto_definition)
    injector.bind('python-editor', 'show-outline', 'Python/Show _outline', open_outline)

    injector.bind('python-editor', 'show-calltip', 'Python/Show _calltip', show_calltips)

    injector.bind_dynamic('python-editor', 'select-interpreter', 'Python/_Executable/executables',
        generate_python_executable_menu, resolve_python_executable_menu_entry, True)

    injector.bind('editor', 'run-test', 'Python/_Tests/_Run test in cursor scope', run_test)
    injector.bind('editor', 'run-all-tests', 'Python/Tests/Run _all tests', run_all_tests)
    injector.bind('editor', 'rerun-test', 'Python/Tests/Rerun last test', rerun_test)
    injector.bind('editor', 'toggle-test-panel', 'View/Toggle _test panel', toggle_test_panel)

    from snaked.core.prefs import add_option, add_internal_option

    add_internal_option('PYTHON_EXECUTABLE', 'default')
    add_option('PYTHON_EXECUTABLES', dict,
        'Path to python executables. Used by test runner and completion framework')
    add_option('PYTHON_EXECUTABLE_ENV', dict,
        'Python interpreter environment. Used by test runner and completion framework')
    add_option('PYTHON_SUPP_CONFIG', dict, 'Config for supplement')

    add_option('PYTHON_SPYPKG_HANDLER_MAX_CHARS', 25, 'Maximum allowed python package title length')

    add_option('PYTHON_LINT_ON_FILE_LOAD', False, 'Run lint check on file load')

    from snaked.core.titler import add_title_handler
    add_title_handler('pypkg', pypkg_handler)
    add_title_handler('spypkg', spypkg_handler)

    injector.on_ready('editor-with-new-buffer-created', editor_created)
    injector.on_ready('editor-with-new-buffer', editor_opened)
    injector.on_ready('manager', start_supplement)
    injector.on_done('last-buffer-editor', editor_closed)
    injector.on_done('manager', quit)
示例#3
0
def init(injector):
    injector.bind('editor', 'toggle-ipython', 'View/Toggle _IPython', show_ipython).to('<ctrl>i')
    injector.bind('editor', 'ipython-run-current-code',
        'Python/Run current code', send_code).to('<ctrl>r')
    injector.bind('editor', 'ipython-run-file', 'Python/Run file', run_file).to('F6')
    injector.bind('editor', 'ipython-run-last', 'Python/Run last command', run_last).to('<shift>F6')
    injector.bind('editor', 'ipython-debug', 'Python/Debug', debug_file).to('<ctrl>F6')
    injector.bind('editor', 'restart-ipython', 'Python/Restart IPython',
        restart_ipython).to('<ctrl><shift>i')

    from snaked.core.prefs import add_option

    add_option('IPYTHON_GRAB_FOCUS_ON_SHOW', True,
        'Option controls ipython panel focus grabbing on its show')
    add_option('IPYTHON_MATPLOTLIB_INTERACTIVE_SUPPORT', False,
        'Option controls matplotlib interactive mode in ipython console')
    add_option('IPYTHON_AUTOEXECUTE', '',
        'Automatically run the specified scripts when the console is started.')
示例#4
0
def init(injector):
    injector.on_ready('editor-with-new-buffer', editor_created)

    from snaked.core.prefs import add_option
    add_option('PYTHON_BCSP_GOTO_TO_ERROR', True,
        'Automatically jumps to line where syntax error occured')