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


Python Application.find_window_with_editor方法代码示例

本文整理汇总了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)
开发者ID:editxt,项目名称:editxt,代码行数:11,代码来源:test_application.py

示例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)
开发者ID:editxt,项目名称:editxt,代码行数:42,代码来源:test_application.py


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