本文整理汇总了Python中editxt.application.Application.open_documents_with_paths方法的典型用法代码示例。如果您正苦于以下问题:Python Application.open_documents_with_paths方法的具体用法?Python Application.open_documents_with_paths怎么用?Python Application.open_documents_with_paths使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类editxt.application.Application
的用法示例。
在下文中一共展示了Application.open_documents_with_paths方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test
# 需要导入模块: from editxt.application import Application [as 别名]
# 或者: from editxt.application.Application import open_documents_with_paths [as 别名]
def test(c):
m = Mocker()
app = Application()
create_window = m.method(app.create_window)
window = m.mock(Window)
m.method(app.current_window)() >> (window if c.has_window else None)
if not c.has_window:
create_window() >> window
items = window.open_paths("<paths>") >> m.mock()
with m:
app.open_documents_with_paths("<paths>")
示例2: test
# 需要导入模块: from editxt.application import Application [as 别名]
# 或者: from editxt.application.Application import open_documents_with_paths [as 别名]
def test(c):
m = Mocker()
app = Application()
exists = lambda path: True
alog = m.replace(mod, 'log')
ed = m.mock(Editor)
dv_class = m.replace(edoc, 'TextDocumentView')
m.method(app.current_editor)() >> (ed if c.has_editor else None)
if not c.has_editor:
m.method(app.create_editor)() >> ed
focus = None
for p in c.paths:
exists(p.path) >> p.exists
dv = dv_class.create_with_path(p.path) >> m.mock(TextDocumentView)
focus = ed.add_document_view(dv) >> dv
if focus is not None:
ed.current_view = dv
with replattr(os.path, 'isfile', exists), m:
app.open_documents_with_paths([p.path for p in c.paths])
示例3: test
# 需要导入模块: from editxt.application import Application [as 别名]
# 或者: from editxt.application.Application import open_documents_with_paths [as 别名]
def test(c):
m = Mocker()
app = Application()
exists = m.replace("os.path.isfile")
alog = m.replace("editxt.application.log", passthrough=False)
ed = m.mock(Editor)
dv_class = m.replace(TextDocumentView, passthrough=False)
m.method(app.current_editor)() >> (ed if c.has_editor else None)
if not c.has_editor:
m.method(app.create_editor)() >> ed
focus = None
for p in c.paths:
exists(p.path) >> p.exists
dv = dv_class.create_with_path(p.path) >> m.mock(TextDocumentView)
focus = ed.add_document_view(dv) >> dv
if focus is not None:
ed.current_view = dv
with m:
app.open_documents_with_paths([p.path for p in c.paths])