예제 #1
0
def completions_codeeditor_outline(completions_codeeditor, outlineexplorer):
    editor, _ = completions_codeeditor
    editor.oe_proxy = OutlineExplorerProxyEditor(editor, editor.filename)
    outlineexplorer.register_editor(editor.oe_proxy)
    outlineexplorer.set_current_editor(
        editor.oe_proxy, update=False, clear=False)
    return editor, outlineexplorer
예제 #2
0
    def _create_outlineexplorer(code, filename, follow_cursor=False):
        code_editor = CodeEditor(None)
        code_editor.set_language('py', filename)
        code_editor.set_text(code)

        editor = OutlineExplorerProxyEditor(code_editor, filename)

        outlineexplorer = OutlineExplorerWidget(follow_cursor=follow_cursor)
        outlineexplorer.set_current_editor(editor, False, False)
        outlineexplorer.show()
        outlineexplorer.setFixedSize(400, 350)

        qtbot.addWidget(outlineexplorer)
        return outlineexplorer
예제 #3
0
def editor_outline_explorer_bot():
    """setup editor and outline_explorer."""
    app = qapplication()
    editor = CodeEditor(parent=None)
    editor.setup_editor(language='Python')
    outlineexplorer = OutlineExplorerWidget(editor)

    editor.set_text(text)

    editor.oe_proxy = OutlineExplorerProxyEditor(editor, "test.py")
    outlineexplorer.set_current_editor(editor.oe_proxy,
                                       update=False,
                                       clear=False)
    outlineexplorer.setEnabled(True)

    return editor, outlineexplorer, editor.oe_proxy
예제 #4
0
@pytest.fixture
def create_outlineexplorer(qtbot):
    def _create_outlineexplorer(case, follow_cursor=False):
        case_info = CASES[case]
        filename = case_info['file']
        with open(case_info['file'], 'r') as f:
            text = f.read()

        symbol_info = json.load(open(case_info['data'], 'r'))
        expected_tree = json.load(open(case_info['tree'], 'r'))

        code_editor = CodeEditor(None)
        code_editor.set_language('py', filename)
        code_editor.set_text(text)

        editor = OutlineExplorerProxyEditor(code_editor, filename)

        outlineexplorer = OutlineExplorerWidget(follow_cursor=follow_cursor,
                                                display_variables=True,
                                                group_cells=True,
                                                show_comments=True)
        outlineexplorer.register_editor(editor)
        outlineexplorer.set_current_editor(editor, False, False)
        outlineexplorer.show()
        outlineexplorer.setFixedSize(400, 350)

        editor.update_outline_info(symbol_info)
        qtbot.addWidget(outlineexplorer)
        return outlineexplorer, expected_tree
    return _create_outlineexplorer
예제 #5
0
def lsp_codeeditor_outline(lsp_codeeditor, outlineexplorer):
    editor, _ = lsp_codeeditor
    editor.oe_proxy = OutlineExplorerProxyEditor(editor, editor.filename)
    outlineexplorer.set_current_editor(
        editor.oe_proxy, update=False, clear=False)
    return editor, outlineexplorer