本文整理汇总了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
示例2: test
def test():
"""Local test."""
from spyder.utils.qthelpers import qapplication
app = qapplication()
dlg = ProjectDialog(None)
dlg.show()
sys.exit(app.exec_())
示例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())
示例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_())
示例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()
示例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()
示例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_())
示例8: test
def test():
from spyder.utils.qthelpers import qapplication
app = qapplication()
test = ProjectExplorerTest()
test.resize(250, 480)
test.show()
app.exec_()
示例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
示例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_())
示例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_())
示例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_()
示例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()
示例14: test
def test():
from spyder.utils.qthelpers import qapplication
app = qapplication()
table = ShortcutsTable()
table.show()
app.exec_()
table.check_shortcuts()
示例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_())