本文整理汇总了Python中editxt.application.Application.find_window_with_editor方法的典型用法代码示例。如果您正苦于以下问题:Python Application.find_window_with_editor方法的具体用法?Python Application.find_window_with_editor怎么用?Python Application.find_window_with_editor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类editxt.application.Application
的用法示例。
在下文中一共展示了Application.find_window_with_editor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_set_current_editor
# 需要导入模块: from editxt.application import Application [as 别名]
# 或者: from editxt.application.Application import find_window_with_editor [as 别名]
def test_set_current_editor():
ac = Application()
m = Mocker()
editor = m.mock(Editor)
ac.find_window_with_editor = m.method(ac.find_window_with_editor)
ed = ac.find_window_with_editor(editor) >> m.mock(Window)
ed.current_editor = editor
with m:
ac.set_current_editor(editor)
示例2: test
# 需要导入模块: from editxt.application import Application [as 别名]
# 或者: from editxt.application.Application import find_window_with_editor [as 别名]
def test(config):
"""Test argument structure:
[ # collection of window controllers
[ # window controller / collection of projects
["doc1", "doc2", "doc3", ...], # project / collection of editors
...
]
...
]
"""
result = None
ac = Application()
m = Mocker()
editor = m.mock(Editor) # this is the editor we're looking for
document = m.mock(TextDocument)
(editor.document << document).count(0, None)
ac.iter_windows = m.method(ac.iter_windows)
eds = ac.iter_windows() >> []
for ed_projects in config:
ed = m.mock(Window)
eds.append(ed)
projects = []
ed.projects >> projects
found = False
for project_editors in ed_projects:
project = m.mock(Project)
projects.append(project)
editors = []
if not found:
project.editors >> editors
for doc_name in project_editors:
if doc_name == DOC:
editors.append(editor)
result = ed
found = True
else:
editors.append(m.mock(Editor))
with m:
ed = ac.find_window_with_editor(editor)
eq_(ed, result)