当前位置: 首页>>代码示例>>Python>>正文


Python qthelpers.qapplication函数代码示例

本文整理汇总了Python中spyder.utils.qthelpers.qapplication函数的典型用法代码示例。如果您正苦于以下问题:Python qapplication函数的具体用法?Python qapplication怎么用?Python qapplication使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了qapplication函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setup_editor

def setup_editor(qtbot, monkeypatch):
    """Set up the Editor plugin."""
    qapplication()
    from spyder.plugins.editor.plugin import Editor

    monkeypatch.setattr('spyder.plugins.editor.plugin.add_actions', Mock())

    class MainMock(QWidget):
        def __getattr__(self, attr):
            if attr.endswith('actions'):
                return []
            elif attr == 'projects':
                projects = Mock()
                projects.get_active_project.return_value = None
                return projects
            else:
                return Mock()

        def get_spyder_pythonpath(*args):
            return []

    editor = Editor(MainMock())
    qtbot.addWidget(editor)
    editor.show()

    yield editor, qtbot
开发者ID:burrbull,项目名称:spyder,代码行数:26,代码来源:test_plugin.py

示例2: test

def test():        
    """Local test."""
    from spyder.utils.qthelpers import qapplication
    app = qapplication()
    dlg = ProjectDialog(None)
    dlg.show()
    sys.exit(app.exec_())
开发者ID:burrbull,项目名称:spyder,代码行数:7,代码来源:projectdialog.py

示例3: test

def test(text):
    """Test"""
    from spyder.utils.qthelpers import qapplication
    _app = qapplication()  # analysis:ignore
    dialog = ImportWizard(None, text)
    if dialog.exec_():
        print(dialog.get_data())
开发者ID:ShenggaoZhu,项目名称:spyder,代码行数:7,代码来源:importwizard.py

示例4: test

def test():
    """Run breakpoint widget test"""
    from spyder.utils.qthelpers import qapplication
    app = qapplication()
    widget = BreakpointWidget(None)
    widget.show()
    sys.exit(app.exec_())
开发者ID:0xBADCA7,项目名称:spyder,代码行数:7,代码来源:breakpointsgui.py

示例5: construct_editor

def construct_editor(qtbot, *args, **kwargs):
    os.environ['SPY_TEST_USE_INTROSPECTION'] = 'True'
    app = qapplication()
    lsp_manager = LSPManager(parent=None)
    editor = CodeEditor(parent=None)
    kwargs['language'] = 'Python'
    editor.setup_editor(*args, **kwargs)
    wrapper = LSPEditorWrapper(None, editor, lsp_manager)

    lsp_manager.register_plugin_type(
        LSPEventTypes.DOCUMENT, wrapper.sig_initialize)
    with qtbot.waitSignal(wrapper.sig_initialize, timeout=30000):
        editor.filename = 'test.py'
        editor.language = 'Python'
        lsp_manager.start_lsp_client('python')

    text = ("def some_function():\n"  # D100, D103: Missing docstring
            "    \n"  # W293 trailing spaces
            "    a = 1 # a comment\n"  # E261 two spaces before inline comment
            "\n"
            "    a += s\n"  # Undefined variable s
            "    return a\n"
            )
    editor.set_text(text)
    with qtbot.waitSignal(editor.lsp_response_signal, timeout=30000):
        editor.document_did_open()

    yield editor, lsp_manager
    os.environ['SPY_TEST_USE_INTROSPECTION'] = 'False'
    lsp_manager.closing_plugin()
开发者ID:burrbull,项目名称:spyder,代码行数:30,代码来源:test_warnings.py

示例6: setup_editor

def setup_editor(qtbot, monkeypatch):
    """Set up the Editor plugin."""
    app = qapplication()
    os.environ['SPY_TEST_USE_INTROSPECTION'] = 'True'
    monkeypatch.setattr('spyder.dependencies', Mock())
    from spyder.plugins.editor import Editor

    monkeypatch.setattr('spyder.plugins.editor.add_actions', Mock())

    class MainMock(QWidget):
        def __getattr__(self, attr):
            if attr.endswith('actions'):
                return []
            else:
                return Mock()

        def get_spyder_pythonpath(*args):
            return []

    editor = Editor(MainMock())
    qtbot.addWidget(editor)
    editor.show()
    editor.new(fname="test.py", text="")
    editor.introspector.set_editor_widget(editor.editorstacks[0])

    yield editor, qtbot
    # teardown
    os.environ['SPY_TEST_USE_INTROSPECTION'] = 'False'
    editor.introspector.plugin_manager.close()
开发者ID:0xBADCA7,项目名称:spyder,代码行数:29,代码来源:test_editor_introspection.py

示例7: test

def test():
    """Run history widget."""
    from spyder.utils.qthelpers import qapplication
    app = qapplication(test_time=8)
    widget = History(None)
    widget.show()
    sys.exit(app.exec_())
开发者ID:burrbull,项目名称:spyder,代码行数:7,代码来源:widgets.py

示例8: test

def test():
    from spyder.utils.qthelpers import qapplication
    app = qapplication()
    test = ProjectExplorerTest()
    test.resize(250, 480)
    test.show()
    app.exec_()
开发者ID:0xBADCA7,项目名称:spyder,代码行数:7,代码来源:explorer.py

示例9: test

def test():
    """Run path manager test"""
    from spyder.utils.qthelpers import qapplication
    _app = qapplication()  # analysis:ignore
    test = PathManager(None, pathlist=sys.path[:-10],
                       ro_pathlist=sys.path[-10:])
    test.exec_()
    print(test.get_path_list())  # spyder: test-skip
开发者ID:rlaverde,项目名称:spyder,代码行数:8,代码来源:pathmanager.py

示例10: test

def test():
    """Run web browser"""
    from spyder.utils.qthelpers import qapplication
    app = qapplication(test_time=8)
    widget = PydocBrowser(None)
    widget.show()
    widget.initialize()
    sys.exit(app.exec_())
开发者ID:cfanpc,项目名称:spyder,代码行数:8,代码来源:widgets.py

示例11: test

def test():
    """Run Find in Files widget test"""
    from spyder.utils.qthelpers import qapplication
    app = qapplication()
    widget = FindInFilesWidget(None)
    widget.resize(640, 480)
    widget.show()
    sys.exit(app.exec_())
开发者ID:rlaverde,项目名称:spyder,代码行数:8,代码来源:findinfiles.py

示例12: test

def test():  # pragma: no cover
    from spyder.utils.qthelpers import qapplication
    app = qapplication()
    dlg_table = NumpyArrayDialog(None, inline=False)
    dlg_inline = NumpyArrayDialog(None, inline=True)
    dlg_table.show()
    dlg_inline.show()
    app.exec_()
开发者ID:ShenggaoZhu,项目名称:spyder,代码行数:8,代码来源:arraybuilder.py

示例13: test

def test():
    from spyder.utils.qthelpers import qapplication
    app = qapplication()
    table = ShortcutsTable()
    table.show()
    app.exec_()
    print([str(s) for s in table.source_model.shortcuts])  # spyder: test-skip
    table.check_shortcuts()
开发者ID:0xBADCA7,项目名称:spyder,代码行数:8,代码来源:shortcuts.py

示例14: test

def test():
    from spyder.utils.qthelpers import qapplication
    app = qapplication()
    table = ShortcutsTable()
    table.show()
    app.exec_()

    table.check_shortcuts()
开发者ID:impact27,项目名称:spyder,代码行数:8,代码来源:shortcuts.py

示例15: test

def test():
    """Run web browser"""
    from spyder.utils.qthelpers import qapplication
    app = qapplication(test_time=8)
    widget = WebBrowser()
    widget.show()
    widget.set_home_url('http://www.google.com/')
    widget.go_home()
    sys.exit(app.exec_())
开发者ID:silentquasar,项目名称:spyder,代码行数:9,代码来源:browser.py


注:本文中的spyder.utils.qthelpers.qapplication函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。