예제 #1
0
def init(injector):
    injector.bind('editor', 'external-tools-default-config', 'Prefs/Global/_Tools',
        lazy_func('.plugin.edit_external_tools'), 'global')

    injector.bind('editor', 'external-tools-session-config', 'Prefs/Session/_Tools',
        lazy_func('.plugin.edit_external_tools'), 'session')

    injector.bind_dynamic('editor', 'external-tools', '_Run/external-tools',
        lazy_func('.plugin.generate_menu'), lazy_func('.plugin.resolve_menu_entry'))

    injector.bind_menu('Run').to('<Alt>X')
예제 #2
0
def init(injector):
    injector.add_context('editor', 'window', Window.get_editor_context)
    injector.add_context('editor-active', 'editor', lambda e: e if e.view.is_focus() else None)
    injector.add_context('editor-with-selection', 'editor-active',
        lambda e: e if e.buffer.get_has_selection() else None)
    injector.add_context('textview-active', 'window',
        lambda w: w.get_focus() if isinstance(w.get_focus(), gtk.TextView) else None)
    injector.add_context('panel-visible', 'window', Window.get_panel_visible_context)


    with injector.on('window', 'editor') as ctx:
        ctx.bind('save', 'File/_Save#20', Window.save_editor).to('<ctrl>s')

        ctx.bind('close-editor', 'Tab/_Close#100', Window.close_editor).to('<ctrl>w')
        ctx.bind('next-editor', 'Tab/_Next#50', Window.switch_to, 1).to('<ctrl>Page_Down', 1)
        ctx.bind('prev-editor', 'Tab/_Prev', Window.switch_to, -1).to('<ctrl>Page_Up', 1)
        ctx.bind('move-tab-left', 'Tab/Move to _left',
            Window.move_tab, False).to('<shift><ctrl>Page_Up', 1)
        ctx.bind('move-tab-right', 'Tab/Move to _right',
            Window.move_tab, True).to('<shift><ctrl>Page_Down', 1)

        ctx.bind('detach-editor', 'Tab/_Detach', Window.retach_editor)
        ctx.bind('duplicate-editor', 'Tab/D_uplicate', Window.duplicate_editor)

    injector.bind('editor', 'new-file', 'File/_New',
        lazy_func('snaked.core.gui.new_file.show_create_file')).to('<ctrl>n')

    with injector.on('window') as ctx:
        ctx.bind('escape', None, Window.process_escape)
        ctx.bind('close-window', 'Window/_Close#100', Window.close)

        #ctx.bind_accel('save-all', '_File/Save _all', '<ctrl><shift>s', Window.save_all)
        ctx.bind_check('fullscreen', 'Window/_Fullscreen#50', Window.toggle_fullscreen).to('F11')
        ctx.bind_check('show-tabs', 'Window/Show _Tabs', Window.show_tabs).to('<Alt>F11')

    with injector.on('panel-visible') as ctx:
        ctx.bind('increase-panel-height', 'Window/_Increase panel height',
            Window.change_panel_size, 10).to('<ctrl><alt>Up')
        ctx.bind('decrease-panel-height', 'Window/_Decrease panel height',
            Window.change_panel_size, -10).to('<ctrl><alt>Down')